/* Church CRM Main Stylesheet */

/* Reset & Base Styles */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f7fafc;
    color: #2d3748;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left svg {
    width: 40px;
    height: 40px;
    fill: white;
}

.header-title h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.header-title p {
    font-size: 14px;
    opacity: 0.9;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.mobile-menu-toggle:hover {
    background: rgba(255,255,255,0.3);
}

/* Navigation Menu */
.nav-menu {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 80px;
    z-index: 800;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 8px;
}

.nav-list li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-list li a:hover {
    color: #667eea;
    background: #f7fafc;
}

.nav-list li a.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f7fafc;
}

/* User Info */
.user-info {
    text-align: right;
}

.user-info .name {
    font-weight: 600;
    margin-bottom: 2px;
}

.user-info .role {
    font-size: 13px;
    opacity: 0.9;
}

/* Buttons */
.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

.btn-back {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255,255,255,0.3);
}

.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f7fafc;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #f7fafc;
}

.btn-icon.btn-edit {
    color: #667eea;
}

.btn-icon.btn-edit:hover {
    background: #edf2f7;
}

.btn-icon.btn-view {
    color: #48bb78;
}

.btn-icon.btn-view:hover {
    background: #f0fff4;
}

.btn-icon.btn-delete {
    color: #f56565;
}

.btn-icon.btn-delete:hover {
    background: #fff5f5;
}

/* Action buttons container (for tables) */
.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

/* Base button class */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-edit {
    color: #667eea;
    border-color: #667eea;
    background: white;
}

.btn-edit:hover {
    background: #667eea;
    color: white;
}

.btn-edit:hover svg {
    stroke: white;
}

.btn-view {
    color: #48bb78;
    border-color: #48bb78;
    background: white;
}

.btn-view:hover {
    background: #48bb78;
    color: white;
}

.btn-view:hover svg {
    stroke: white;
}

.btn-delete {
    color: #f56565;
    border-color: #f56565;
    background: white;
}

.btn-delete:hover {
    background: #f56565;
    color: white;
}

.btn-delete:hover svg {
    stroke: white;
}

.btn-back {
    color: #4a5568;
    border-color: #e2e8f0;
    background: white;
}

.btn-back:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Toolbar */
.toolbar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f7fafc;
    padding: 12px 16px;
    border-radius: 8px;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    outline: none;
}

/* Filter Group */
.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #2d3748;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
    min-width: 150px;
}

.filter-select:hover {
    border-color: #cbd5e0;
}

.filter-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Tables */
.members-table-container,
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

thead {
    background: #f7fafc;
    border-bottom: 2px solid #e2e8f0;
}

th {
    padding: 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f7fafc;
}

td {
    padding: 16px;
    font-size: 14px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-member { background: #c6f6d5; color: #2f855a; }
.badge-regular { background: #bee3f8; color: #2c5282; }
.badge-non-member { background: #fed7d7; color: #c53030; }
.badge-guest { background: #e2e8f0; color: #4a5568; }
.badge-active { background: #c6f6d5; color: #2f855a; }
.badge-inactive { background: #fed7d7; color: #c53030; }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

.modal.active {
    display: block;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    margin: 40px auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 16px;
}

.modal-header h2 {
    font-size: 20px;
    color: #2d3748;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #718096;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: #f7fafc;
    color: #2d3748;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 250px);
    flex: 1 1 auto;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Forms */
.form-section {
    margin-bottom: 32px;
}

.form-section h3 {
    font-size: 18px;
    color: #667eea;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:read-only {
    background: #f7fafc;
    color: #718096;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 20px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    width: auto;
    cursor: pointer;
}

/* Loading & Empty States */
.loading {
    text-align: center;
    padding: 40px;
    color: #718096;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.alert-success {
    background: #c6f6d5;
    color: #2f855a;
    border: 1px solid #9ae6b4;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 20px 0;
    margin-top: 40px;
    text-align: center;
    color: #718096;
    font-size: 14px;
}

.footer p {
    margin: 0;
}

.footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.footer a:hover {
    color: #5a67d8;
}

.footer .version {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #a0aec0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .header-left {
        flex: 1;
    }
    
    .mobile-menu-toggle {
        display: block;
        order: 3;
    }
    
    .header-right {
        order: 2;
        gap: 12px;
    }
    
    .user-info {
        display: none;
    }
    
    .nav-menu {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 80px);
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 0;
    }
    
    .nav-list li a {
        border-bottom: 1px solid #e2e8f0;
        border-left: 3px solid transparent;
    }
    
    .nav-list li a.active {
        border-left-color: #667eea;
        border-bottom-color: #e2e8f0;
    }
    
    .toolbar {
        flex-direction: column;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 16px;
    }
    
    /* Mobile Modal Improvements */
    .modal {
        padding: 0;
        align-items: flex-start;
    }
    
    .modal-content {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 16px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 16px;
        max-height: none;
        overflow-y: visible;
    }
    
    .modal-footer {
        padding: 16px;
        flex-direction: column-reverse;
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 2px solid #e2e8f0;
    }
    
    .modal-footer button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-title h1 {
        font-size: 18px;
    }
    
    .header-title p {
        font-size: 12px;
    }
    
    .header-left svg {
        width: 32px;
        height: 32px;
    }
    
    .modal {
        padding: 0;
    }
    
    .modal-content {
        border-radius: 0;
        max-width: 100%;
        margin: 0;
    }
    
    .modal-body {
        max-height: none;
    }
}

/* ============== VISUAL SUMMARY DASHBOARD STYLES ============== */

/* Section Headers */
.section-header {
    margin-top: 32px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h2 {
    font-size: 24px;
    color: #2d3748;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Stat Cards */
.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.stat-card-primary {
    border-left-color: #667eea;
}

.stat-card-success {
    border-left-color: #48bb78;
}

.stat-card-info {
    border-left-color: #4299e1;
}

.stat-card-warning {
    border-left-color: #f6ad55;
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-primary .stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-card-success .stat-icon {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.stat-card-info .stat-icon {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.stat-card-warning .stat-icon {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    color: white;
}

.stat-content h3 {
    font-size: 36px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
    line-height: 1;
}

.stat-content p {
    font-size: 14px;
    color: #718096;
    margin: 0;
}

/* Card Header with Stats Summary */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2d3748;
}

.stat-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.stat-badge-primary {
    background: #e6f0ff;
    color: #667eea;
}

.stat-badge-secondary {
    background: #f3e8ff;
    color: #764ba2;
}

.stat-badge-success {
    background: #e6fffa;
    color: #38a169;
}

.stat-badge-info {
    background: #e6f6ff;
    color: #3182ce;
}

.stat-badge-warning {
    background: #fff5eb;
    color: #ed8936;
}

.stat-badge strong {
    font-weight: 700;
    font-size: 15px;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-overlay p {
    margin-top: 16px;
    font-size: 16px;
    color: #4a5568;
}

/* Responsive adjustments for visual summary */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: 100%;
    }

    .filter-group {
        width: 100%;
        flex-direction: column;
    }

    .filter-select {
        width: 100%;
    }

    #clearFiltersBtn {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-content h3 {
        font-size: 32px;
    }

    .stat-icon {
        width: 56px;
        height: 56px;
    }

    .stat-icon svg {
        width: 28px;
        height: 28px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-summary {
        width: 100%;
    }

    .stat-badge {
        flex: 1;
        text-align: center;
    }
}

/* Loading Spinner Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}