/* assets/css/style.css - Version 1.0.3 - Optimized */

/* Base Styles */
.mauk-members-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.mauk-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.mauk-header h1 {
    margin: 0;
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}

.role-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Login Prompt Styles */
.mauk-login-prompt {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 40px;
}

.login-message {
    text-align: center;
    max-width: 500px;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-message h2 {
    color: #333;
    margin-bottom: 15px;
}

.login-message p {
    color: #666;
    margin-bottom: 25px;
}

.login-actions {
    margin-top: 25px;
}

.login-actions .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    font-size: 16px;
    text-decoration: none;
}

.login-help {
    margin-top: 15px;
    font-size: 14px;
    color: #888;
}

/* Access Denied Styles */
.mauk-access-denied {
    max-width: 600px;
    margin: 40px auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #dc3545;
}

.mauk-access-denied h2 {
    color: #dc3545;
    margin-bottom: 15px;
}

.mauk-access-denied p {
    color: #666;
    margin-bottom: 15px;
}

.access-actions {
    margin-top: 25px;
}

.access-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    text-decoration: none;
}

.help-text {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* Logout Link in Header */
.logout-link {
    margin-left: 15px;
    padding: 5px 15px;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
}

.logout-link:hover {
    background: #5a6268;
    color: white;
    text-decoration: none;
}

/* Tabs */
.mauk-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.tab-link {
    background: none;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.tab-link:hover {
    background: #f3f4f6;
    color: #374151;
}

.tab-link.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.tab-link:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tab-link:disabled:hover {
    background: none;
    color: #6b7280;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, #667eea, #764ba2);
}

.card-icon {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 15px;
}

.card-title {
    font-size: 14px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.card-value {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 5px;
}

.card-change {
    font-size: 14px;
    color: #059669;
}

.card-change.negative {
    color: #dc2626;
}

/* Dashboard List View */
.dashboard-list {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dashboard-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-search-box,
.search-box {
    display: flex;
    gap: 10px;
    max-width: 400px;
    width: 100%;
    min-width: 250px;
}

.dashboard-search-box input,
.search-box input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.dashboard-search-box input:focus,
.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.dashboard-search-box button,
.search-box button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0 15px;
    cursor: pointer;
    transition: background 0.3s ease;
    min-width: 40px;
}

.dashboard-search-box button:hover,
.search-box button:hover {
    background: #5a67d8;
}

.back-to-dashboard {
    background: #6b7280;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.back-to-dashboard:hover {
    background: #4b5563;
}

.dashboard-pagination-info,
.pagination-info,
.renewals-pagination-info {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: right;
}

/* Table Container - Fixed for mobile */
.table-container,
.dashboard-table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5e7eb;
}

#members-table,
#renewals-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

#members-table thead,
#renewals-table thead {
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 10;
}

#members-table th,
#renewals-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: nowrap;
    border-right: 1px solid #e5e7eb;
}

#members-table th:last-child,
#renewals-table th:last-child {
    border-right: none;
}

#members-table th:hover {
    background: #f3f4f6;
}

#members-table th i {
    margin-left: 5px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

#members-table th:hover i {
    opacity: 1;
}

#members-table th.sorted-asc i.fa-sort-up,
#members-table th.sorted-desc i.fa-sort-down {
    opacity: 1;
}

#members-table td,
#renewals-table td {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    color: #4b5563;
    white-space: nowrap;
    border-right: 1px solid #f3f4f6;
}

#members-table td:last-child,
#renewals-table td:last-child {
    border-right: none;
}

#members-table tbody tr,
#renewals-table tbody tr {
    transition: background 0.2s ease;
}

#members-table tbody tr:hover,
#renewals-table tbody tr:hover {
    background: #f9fafb;
}

#members-table tbody tr:last-child td,
#renewals-table tbody tr:last-child td {
    border-bottom: none;
}

/* Clickable text */
.clickable {
    color: #667eea;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.3s ease;
}

.clickable:hover {
    color: #5a67d8;
    text-decoration: underline;
}

/* Pagination */
.pagination-controls,
.dashboard-pagination-controls,
.renewals-pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination-controls button,
.dashboard-pagination-controls button,
.renewals-pagination-controls button {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.pagination-controls button:hover:not(:disabled),
.dashboard-pagination-controls button:hover:not(:disabled),
.renewals-pagination-controls button:hover:not(:disabled) {
    background: #5a67d8;
}

.pagination-controls button:disabled,
.dashboard-pagination-controls button:disabled,
.renewals-pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#page-numbers,
#dashboard-page-numbers,
#renewals-page-numbers {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.page-number,
.dashboard-page-number,
.renewals-page-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    font-size: 14px;
}

.page-number:hover,
.dashboard-page-number:hover,
.renewals-page-number:hover {
    background: #f3f4f6;
}

.page-number.active,
.dashboard-page-number.active,
.renewals-page-number.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Forms */
.form-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.form-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.form-section h3 {
    margin: 0 0 20px 0;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.form-row {
    display: grid;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-group {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.checkbox-group label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    font-size: 14px;
    padding: 8px 0;
}

.checkbox-group input[type="checkbox"],
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
    font-size: 14px;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    margin: 30px auto;
    width: 95%;
    max-width: 1400px;
    max-height: 85vh;
    border-radius: 10px;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    color: #374151;
    font-size: 20px;
}

.close-modal {
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.close-modal:hover {
    color: #374151;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    max-height: 70vh;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Member Details Cards Layout */
.member-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.member-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.member-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid #667eea;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-icon {
    color: #667eea;
    font-size: 18px;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card-row {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.card-row.inline-2,
.card-row.inline-3,
.card-row.inline-4 {
    display: grid;
    gap: 15px;
    align-items: start;
}

.card-row.inline-2 { grid-template-columns: 1fr 1fr; }
.card-row.inline-3 { grid-template-columns: 1fr 1fr 1fr; }
.card-row.inline-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.card-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-value {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    word-break: break-word;
    line-height: 1.4;
}

.card-value.amount {
    color: #059669;
    font-weight: 600;
}

.card-value.emphasized {
    font-weight: 700;
    color: #1f2937;
    font-size: 14px;
}

/* Status Badges - Consolidated */
.status-badge,
.card-value.status-active,
.card-value.status-inactive,
.card-value.status-expired,
.card-value.status-underpaid,
.card-value.status-deceased {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-active,
.card-value.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-inactive,
.card-value.status-inactive {
    background: #e5e7eb;
    color: #374151;
}

.status-expired,
.card-value.status-expired {
    background: #fee2e2;
    color: #991b1b;
}

.status-underpaid,
.card-value.status-underpaid {
    background: #fef3c7;
    color: #92400e;
}

.status-deceased,
.card-value.status-deceased {
    background: #1f2937;
    color: white;
}

.card-value.yes { color: #065f46; font-weight: 600; }
.card-value.no { color: #991b1b; font-weight: 600; }

/* Renewals */
.renewals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.report-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.report-btn {
    background: #e5e7eb;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap;
}

.report-btn:hover {
    background: #d1d5db;
}

.report-btn.active {
    background: #667eea;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 16px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 30px;
    color: #6b7280;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Days styling classes */
.days-critical { color: #ef4444 !important; font-weight: 700; }
.days-warning { color: #f59e0b !important; font-weight: 600; }
.days-caution { color: #f59e0b !important; font-weight: 500; }
.days-normal { color: #10b981 !important; font-weight: 500; }
.days-overdue-recent { color: #f59e0b !important; font-weight: 600; }
.days-overdue-medium { color: #ef4444 !important; font-weight: 600; }
.days-overdue-long { color: #991b1b !important; font-weight: 700; }

/* Compact display helpers */
.card-label.uppercase {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.card-content.compact { gap: 8px; }
.card-value.single-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Responsive Design */
/* Mobile (portrait) */
@media (max-width: 767px) {
    .mauk-members-container {
        padding: 10px !important;
        margin: 0;
        width: 100%;
        overflow-x: hidden;
    }
    
    .mauk-header {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
        border-radius: 8px;
        margin-bottom: 15px;
    }
    
    .mauk-header h1 {
        font-size: 20px;
        justify-content: center;
    }
    
    .user-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .mauk-tabs {
        margin-bottom: 15px;
        padding-bottom: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-link {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .dashboard-list-header,
    .renewals-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dashboard-search-box,
    .search-box {
        max-width: 100%;
    }
    
    .table-container,
    .dashboard-table-container {
        margin: 0 -10px;
        width: calc(100% + 20px);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .form-section {
        padding: 15px;
    }
    
    .form-row,
    .card-row.inline-2,
    .card-row.inline-3,
    .card-row.inline-4 {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    .report-selector {
        flex-direction: column;
    }
    
    .report-btn {
        text-align: center;
    }
    
    .modal-content {
        width: 95% !important;
        margin: 10px auto !important;
        max-height: 90vh !important;
    }
    
    .member-cards-grid {
        grid-template-columns: 1fr;
    }
    
    #members-table,
    #renewals-table {
        min-width: 1000px;
    }
}

/* Tablet and Desktop */
@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-section:nth-child(3),
    .form-section:nth-child(4) {
        grid-column: span 2;
    }
}

/* Desktop only */
@media (min-width: 1024px) {
    .form-grid {
        gap: 25px;
    }
    
    .form-section {
        min-height: 280px;
    }
}

/* Fix for date pickers on mobile */
input.datepicker[type="text"] {
    font-size: 16px; /* Prevents zoom on iOS */
}