:root {
    --color-background: #F9F8F4;
    --color-primary-action: #2A9D8F;
    --color-secondary-accent: #E76F51;
    --color-text-dark: #435663;
    --color-text-light: #6c757d;
    --color-white: #ffffff;
    --color-gray-50: #f9fafb; /* Added for table even rows */
    --color-gray-100: #f7fafc;
    --color-gray-200: #edf2f7;
    --color-gray-300: #e2e8f0;
    --color-red-500: #ef4444;
    --color-blue-100: #dbeafe;
    --color-blue-400: #60a5fa;
    --color-blue-700: #1d4ed8;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
body {
    font-family: 'Inter', sans-serif;
    overflow: hidden; /* Prevent overall page scroll */
    color: var(--color-text-dark);
    background-color: var(--color-background);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Nunito', sans-serif;
}

/* Tailwind CSS custom fonts */
.font-inter {
    font-family: 'Inter', sans-serif;
}
.font-nunito {
    font-family: 'Nunito', sans-serif;
}

@media (max-width: 768px) {
    .page {
        transition: opacity 0.3s ease-in-out;
        padding-bottom: 80px; /* Add padding to prevent content from being hidden by a fixed bottom navigation bar on mobile */
    }
    #hamburger-menu {
        display: none; /* Hide hamburger menu on mobile devices */
    }

    #sidebar-nav {
        display: none !important; /* Ensure sidebar is hidden on mobile */
    }
}
.page.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute; /* Hide hidden pages completely from layout */
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    visibility: hidden;
}
.page:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
    position: relative; /* Show active page in layout */
    visibility: visible;
}

/* Page transition animations */
.page-enter-active, .page-leave-active {
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.page-enter-from, .page-leave-to {
    opacity: 0;
    transform: translateY(20px);
}
.page-enter-to, .page-leave-from {
    opacity: 1;
    transform: translateY(0);
}

/* Button animation */
.btn-animate {
    transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.btn-animate:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.btn-animate:disabled {
    background-color: var(--color-gray-300); /* Grey out disabled button */
    cursor: not-allowed;
    box-shadow: none;
}

/* Spinner animation */
.animate-spin {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Icon styling */
.logout-icon, .back-icon, .print-icon, .filter-icon {
    width: 1.5em; /* Consistent size for icons */
    height: 1.5em;
    vertical-align: -0.25em; /* Align icon with text if any */
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3); /* Softer overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50; /* Ensure it's above other content */
    backdrop-filter: blur(5px); /* Glassmorphism effect */
    transition: opacity 0.3s ease-in-out;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--color-white);
    padding: 2rem;
    border-radius: 1rem; /* More rounded corners */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); /* Stronger, softer shadow */
    width: 90%;
    max-width: 500px; /* Max width for the form */
    border: 1px solid var(--color-gray-200); /* Subtle border */
    transform: translateY(0);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}
.modal-overlay.hidden .modal-content {
    transform: translateY(-20px);
    opacity: 0;
}

/* Form input styling */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    min-height: 44px; /* Large touch targets */
    border: 1px solid var(--color-gray-200);
    border-radius: 0.5rem; /* Soft borders */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); /* Subtle drop shadow */
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary-action);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.2); /* Focus ring with primary color */
}

/* Member Cards Grid for search results */
.member-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Responsive grid */
    gap: 1.5rem; /* More space between cards */
    margin-top: 1.5rem;
}

.member-card {
    background-color: var(--color-white);
    border-radius: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--color-gray-100);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

/* Miqaat Management Styles */
.container { /* This is the container for miqaat management */
    max-width: 900px;
    margin: 0 auto;
    background-color: var(--color-white);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--color-gray-100);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

#miqaat-search {
    flex-grow: 1;
    min-width: 200px;
}

#add-miqaat-btn {
    background-color: var(--color-primary-action);
    color: var(--color-white);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

#miqaat-table {
    width: 100%;
    border-collapse: separate; /* Use separate for rounded corners */
    border-spacing: 0;
    margin-top: 1.5rem;
    border-radius: 0.75rem;
    overflow: hidden; /* Ensures rounded corners are visible */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#miqaat-table th,
#miqaat-table td {
    border: none; /* Remove individual cell borders */
    padding: 1rem 1.5rem;
    text-align: left;
}

#miqaat-table th {
    background-color: var(--color-gray-100);
    color: var(--color-text-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
}

#miqaat-table tbody tr {
    background-color: var(--color-white);
    transition: background-color 0.2s ease;
}

#miqaat-table tbody tr:nth-child(even) {
    background-color: var(--color-gray-50); /* Lighter shade for even rows */
}

#miqaat-table tbody tr:hover {
    background-color: var(--color-gray-100);
}

/* Responsive adjustments for miqaat page */
@media (max-width: 600px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    #miqaat-search,
    #add-miqaat-btn {
        width: 100%;
        box-sizing: border-box;
    }

    #miqaat-table th,
    #miqaat-table td {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* Styles for the add miqaat form modal (reusing .modal-overlay and .modal-content) */
.modal h2 {
    font-family: 'Nunito', sans-serif;
    color: var(--color-primary-action);
}

.modal label {
    color: var(--color-text-dark);
}

#submit-miqaat-btn {
    background-color: var(--color-primary-action);
    color: var(--color-white);
}

#cancel-add-miqaat-btn {
    background-color: var(--color-gray-200);
    color: var(--color-text-dark);
}
#cancel-add-miqaat-btn:hover {
    background-color: var(--color-gray-300);
}

/* Styles for View QH by Miqaat results */
.qh-entry-card {
    background-color: var(--color-white);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--color-gray-100);
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.qh-entry-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

.qh-entry-card p {
    margin-bottom: 0.5rem;
    color: var(--color-text-dark);
}

.qh-entry-card .amount-highlight {
    font-size: 1.75rem; /* Larger amount */
    font-weight: bold;
    color: var(--color-primary-action); /* Primary action color for amounts */
    margin-top: 1rem;
    display: block;
}

.qh-entry-card .text-sm {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.qh-entry-card .text-lg {
    font-size: 1.125rem;
    font-weight: 600;
}

.qh-entry-card .text-md {
    font-size: 1rem;
}

/* New styles for View QH by Date result cards */
.qh-entry-card-by-date {
    background-color: var(--color-white);
    padding: 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-gray-100);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.qh-entry-card-by-date:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.qh-entry-card-by-date .qh-card-header {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 0.25rem;
}

.qh-entry-card-by-date .qh-card-date {
    font-weight: 500;
    color: var(--color-text-dark);
    display: block;
}

.qh-entry-card-by-date .qh-card-miqaat-container {
    margin-bottom: 0.5rem;
}

.qh-entry-card-by-date .qh-card-miqaat {
    font-weight: bold;
    color: var(--color-primary-action);
    font-size: 1rem;
    display: block;
}

.qh-entry-card-by-date .qh-card-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-secondary-accent); /* Secondary accent for amounts in date view */
    text-align: center;
    padding: 0.75rem 0;
    border-top: 1px dashed var(--color-gray-200);
    border-bottom: 1px dashed var(--color-gray-200);
}

.qh-entry-card-by-date .qh-card-details {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.qh-entry-card-by-date .qh-card-details p {
    margin: 0;
    line-height: 1.4;
}

/* Styles for the search-member-page to enable scrolling for member list */
#search-member-page main {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 1rem;
}

/* Filter icon styling */
.filter-icon {
    width: 1.5em;
    height: 1.5em;
    vertical-align: -0.25em;
}

/* Filter active indicator (red dot) */
#filter-active-indicator {
    display: block;
}

/* Specific styles for dashboard buttons */
.dashboard-button {
    background-color: var(--color-primary-action); /* Default to primary action */
    color: var(--color-white);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--color-gray-100);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.dashboard-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}
.dashboard-button svg {
    width: 3rem; /* Larger icons for dashboard */
    height: 3rem;
    margin-bottom: 0.75rem;
}
.dashboard-button span {
    font-size: 1.25rem; /* Larger text for dashboard buttons */
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
}

/* Override specific dashboard button colors with secondary accent */
#view-qh-by-date-button, #add-qh-by-miqaat-sub-button {
    background-color: var(--color-secondary-accent);
}

/* Hamburger menu for mobile */
#hamburger-menu {
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}
#hamburger-menu:hover {
    background-color: var(--color-gray-100);
}

/* Mobile navigation active state */
.bottom-nav .nav-link.active {
    color: var(--color-primary-action);
    font-weight: 600;
}
.bottom-nav .nav-link {
    padding: 0.5rem;
    border-radius: 0.5rem;
}
.bottom-nav .nav-link:hover {
    background-color: var(--color-gray-100);
}

/* General header styling for pages */
.page header {
    background-color: var(--color-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--color-gray-100);
    padding: 1rem;
    border-radius: 0.75rem;
}
.page header h1 {
    color: var(--color-primary-action);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
}

/* Footer for total amount */
.page footer {
    background-color: var(--color-primary-action);
    color: var(--color-white);
    padding: 1rem;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
    border-top: 1px solid var(--color-gray-100);
    border-radius: 0.75rem 0.75rem 0 0; /* Rounded top corners */
}

/* Choices.js overrides for better aesthetic */
.choices {
    font-family: 'Inter', sans-serif;
    min-height: 44px;
    margin-bottom: 0; /* Handled by parent div mb-4 */
}

.choices__inner {
    min-height: 44px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-gray-200);
    border-radius: 0.5rem;
    background-color: var(--color-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.choices__inner:hover {
    border-color: var(--color-gray-300);
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
    border-color: var(--color-primary-action);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.2);
}

.choices__list--single {
    padding: 0.5rem 1rem;
}

.choices__list--multiple .choices__item {
    background-color: var(--color-primary-action);
    border: 1px solid var(--color-primary-action);
    color: var(--color-white);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.choices__list--multiple .choices__item.is-highlighted {
    background-color: var(--color-secondary-accent);
    border-color: var(--color-secondary-accent);
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--color-gray-100);
    color: var(--color-text-dark);
}

.choices__list--dropdown .choices__item {
    padding: 0.75rem 1rem;
}

.choices__placeholder {
    opacity: 0.7;
}

/* Success Checkmark Animation (for form saves) */
@keyframes drawCheck {
    0% {
        stroke-dashoffset: 100;
        opacity: 0;
    }
    50% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}

.success-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 4;
    stroke: var(--color-primary-action);
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px var(--color-primary-action);
    animation: fill 0.5s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
    position: relative;
    margin: 0 auto;
}

.success-checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 4;
    stroke-miterlimit: 10;
    stroke: var(--color-primary-action);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}
@keyframes scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}
@keyframes fill {
    100% {
        box-shadow: inset 0px 0px 0px 50px var(--color-primary-action);
    }
}

/* Empty State Illustrations */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--color-text-light);
}
.empty-state img {
    max-width: 200px;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}
.empty-state p {
    font-size: 1.125rem;
    font-family: 'Nunito', sans-serif;
}

/* Calendar styles for Miqaat Management */
.calendar-container {
    background-color: var(--color-white);
    border-radius: 1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--color-gray-100);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-header button {
    background-color: var(--color-primary-action);
    color: var(--color-white);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
}
.calendar-header button:hover {
    background-color: #228b7e; /* Slightly darker sage */
}

.calendar-header h2 {
    font-size: 1.5rem;
    color: var(--color-primary-action);
    font-family: 'Nunito', sans-serif;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day-header {
    font-weight: 600;
    color: var(--color-text-light);
    text-align: center;
    padding: 0.5rem 0;
}

.calendar-day {
    background-color: var(--color-gray-50);
    border-radius: 0.5rem;
    padding: 0.75rem;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    font-size: 0.875rem;
    color: var(--color-text-dark);
    position: relative;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.calendar-day:hover {
    background-color: var(--color-gray-100);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.calendar-day.current-month {
    background-color: var(--color-white);
}

.calendar-day.today {
    border: 2px solid var(--color-secondary-accent);
    box-shadow: 0 0 0 2px rgba(231, 111, 81, 0.3);
}

.calendar-day.has-event {
    cursor: pointer;
}

.event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-secondary-accent); /* Use accent color for event dots */
    margin-top: 0.25rem;
}

/* Progress bar for Qardan Services */
.progress-bar-container {
    width: 100%;
    background-color: var(--color-gray-200);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-bar-fill {
    height: 20px;
    background-color: var(--color-primary-action);
    border-radius: 0.5rem;
    text-align: center;
    color: var(--color-white);
    font-weight: 600;
    line-height: 20px;
    transition: width 0.5s ease-in-out;
}

/* Glassmorphism modal for member details */
.glassmorphism-modal {
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border-radius: 1rem;
    padding: 2rem;
    color: var(--color-text-dark);
}
