@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Amiri:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Premium Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 15, 26, 0.5);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #f5b922 0%, #d4a017 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ffcc33;
}

/* Firefox support */
* {
    scrollbar-width: thin;
    scrollbar-color: #f5b922 rgba(10, 15, 26, 0.5);
}


html,
body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #0a0f1a 0%, #1a2234 50%, #0f172a 100%);
}

/* Only lock height on main display page (not admin/customer) */
body.display-page {
    height: 100vh;
    overflow: hidden;
}

.arabic-font {
    font-family: 'Amiri', serif;
}

.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gold-glow {
    box-shadow: 0 0 40px rgba(245, 185, 34, 0.3);
}

.completed-row {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
    border-left: 4px solid #10b981;
}

.pending-row {
    background: linear-gradient(90deg, rgba(245, 185, 34, 0.08), rgba(245, 185, 34, 0.02));
    border-left: 4px solid rgba(245, 185, 34, 0.4);
}

.announcement-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.announcement-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    border-color: rgba(245, 185, 34, 0.2);
}

@keyframes pulse-gold {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 185, 34, 0.4);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(245, 185, 34, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(245, 185, 34, 0);
    }
}

.pulse-dot {
    animation: pulse-gold 2s infinite;
}

.slide-enter {
    animation: slideIn 0.4s ease-out forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.15);
}

.progress-bar-fill {
    background: linear-gradient(90deg, #f5b922, #fce588);
}

.progress-bar-complete {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.crescent-moon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 10px -10px 0 0 #f5b922;
}

.page-dot {
    transition: all 0.3s ease;
}

.page-dot.active {
    background: #f5b922;
    width: 30px;
}

/* =============================================
   MOBILE MENU & SIDEBAR OVERLAY
   ============================================= */

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(245, 185, 34, 0.15);
    border: 1px solid rgba(245, 185, 34, 0.3);
    color: #f5b922;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: rgba(245, 185, 34, 0.25);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 25;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* =============================================
   DESKTOP TABLE / MOBILE CARDS TOGGLE
   ============================================= */

/* Default: show table, hide cards */
.mobile-cards {
    display: none;
}

.desktop-table {
    display: block;
}

/* =============================================
   INDEX.PHP / INDEX.HTML - DISPLAY PAGE RESPONSIVE
   ============================================= */

/* --- Stats row on mobile: 3 cards side by side --- */
.stats-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 1024px) {
    /* ---- DISPLAY PAGE: Stack panels ---- */
    body.display-page {
        height: auto;
        overflow: auto;
    }

    #displayWrapper {
        height: auto !important;
        min-height: 100vh;
    }

    #displayGrid {
        grid-template-columns: 1fr !important;
    }

    #statsPanel {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 8px !important;
    }

    #totalCard {
        flex: 1 1 100%;
        max-height: none;
    }

    .stat-mini-card {
        flex: 1 1 calc(33.33% - 8px);
        min-width: 110px;
    }

    #totalCard img[alt="Logo"] {
        height: 56px !important;
    }

    #totalAmount {
        font-size: 2.25rem !important;
    }

    /* ---- ADMIN/CUSTOMER: Sidebar off-canvas ---- */
    .mobile-menu-btn {
        display: flex;
    }

    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    #sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0 !important;
        padding-top: 64px !important;
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .sidebar-overlay.active {
        pointer-events: auto;
    }

    /* Section headers already - stack title + button */
    .section-header {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    .section-header button,
    .section-header a {
        text-align: center;
    }

    /* Dashboard stats grid: 2 columns on tablets */
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Tables: horizontal scroll */
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Lectures grid */
    .lectures-grid {
        grid-template-columns: 1fr !important;
    }

    /* Lectures container: remove fixed height on mobile */
    .lectures-container {
        height: auto !important;
        min-height: 0 !important;
    }

    /* Settings full width */
    .settings-form {
        max-width: 100% !important;
    }

    /* Modals - full screen on tablet */
    .modal-overlay > div {
        max-width: 95vw !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

/* --- Mobile ≤768px --- */
@media (max-width: 768px) {
    /* =========== DISPLAY PAGE =========== */
    #displayWrapper {
        padding: 8px !important;
    }

    /* Stats panel: stack vertically, 3 mini cards in a row */
    #statsPanel {
        flex-direction: column !important;
        gap: 8px !important;
    }

    #totalCard {
        flex: none;
    }

    .stat-mini-cards-row {
        display: flex;
        gap: 8px;
    }

    .stat-mini-card {
        flex: 1;
        min-width: 0;
    }

    .stat-mini-card .stat-icon {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px;
    }

    .stat-mini-card .stat-icon svg {
        width: 16px !important;
        height: 16px !important;
    }

    .stat-mini-card .stat-value {
        font-size: 1.3rem !important;
    }

    .stat-mini-card .stat-label {
        font-size: 0.6rem !important;
    }

    #totalCard img[alt="Logo"] {
        height: 44px !important;
    }

    #totalAmount {
        font-size: 1.8rem !important;
    }

    #overallPercent {
        font-size: 1.1rem !important;
    }

    .gold-glow .p-5 {
        padding: 12px !important;
    }

    /* Donors Panel */
    #donorsPanel {
        padding: 8px !important;
    }

    /* Header row */
    #headerRow {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 4px;
        margin-bottom: 6px !important;
    }

    #headerRow h2 {
        font-size: 1rem !important;
    }

    #headerRow .legend {
        font-size: 0.65rem !important;
        margin-left: 0 !important;
    }

    /* Table header: compact for mobile */
    #tableHeader {
        font-size: 0.65rem !important;
    }

    #tableHeader .th-num {
        display: none !important;
    }

    #tableHeader .th-name {
        grid-column: span 6 !important;
    }

    #tableHeader .th-goal {
        display: none !important;
    }

    #tableHeader .th-paid {
        grid-column: span 3 !important;
    }

    #tableHeader .th-left {
        grid-column: span 3 !important;
    }

    /* Donor rows - hide # and Goal columns */
    .donor-row .dr-num {
        display: none !important;
    }

    .donor-row .dr-name {
        grid-column: span 6 !important;
    }

    .donor-row .dr-goal {
        display: none !important;
    }

    .donor-row .dr-paid {
        grid-column: span 3 !important;
    }

    .donor-row .dr-left {
        grid-column: span 3 !important;
    }

    .donor-row .text-lg {
        font-size: 0.75rem !important;
    }

    .donor-row {
        padding: 4px 6px !important;
        margin-bottom: 2px !important;
    }

    /* Friday collection slide */
    .friday-amount {
        font-size: 3rem !important;
    }

    .friday-label {
        font-size: 1rem !important;
        margin-bottom: 16px !important;
    }

    .friday-line {
        width: 120px !important;
        margin-top: 16px !important;
    }

    /* Lecture slide */
    .lecture-card {
        min-height: 200px !important;
        flex-direction: column !important;
        border-width: 4px !important;
        border-radius: 20px !important;
    }

    .lecture-card-img {
        width: 100% !important;
        min-height: 180px;
    }

    .lecture-card-img img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .lecture-info {
        padding: 16px !important;
    }

    .lecture-info h3 {
        font-size: 1.3rem !important;
    }

    .lecture-info .lecture-datetime {
        font-size: 1rem !important;
        margin-bottom: 12px !important;
    }

    .lecture-info .lecture-title-text {
        font-size: 0.9rem !important;
    }

    .slide h2.slide-enter {
        font-size: 1.2rem !important;
        margin-bottom: 12px !important;
    }

    /* Page dots */
    .page-dot {
        width: 6px !important;
        height: 6px !important;
    }

    .page-dot.active {
        width: 20px !important;
    }

    /* Progress bar */
    .progress-bar-bg {
        height: 10px !important;
    }

    /* =========== ADMIN/CUSTOMER DASHBOARD =========== */

    /* Swap tables for cards on mobile */
    .desktop-table {
        display: none !important;
    }

    .mobile-cards {
        display: block !important;
    }

    .admin-main {
        padding: 12px !important;
        padding-top: 64px !important;
    }

    .admin-main h1 {
        font-size: 1.4rem !important;
    }

    /* Dashboard stats: 2 cols */
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .admin-stats-grid .stat-card {
        padding: 14px !important;
    }

    .admin-stats-grid .stat-card .text-2xl {
        font-size: 1.2rem !important;
    }

    .admin-stats-grid .stat-card .text-xs {
        font-size: 0.65rem !important;
    }

    /* Recent payments: stack name + amount */
    .recent-payment-item {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start !important;
    }

    .recent-payment-item .text-emerald-400.font-bold {
        align-self: flex-end;
    }

    /* Tables: ensure scroll */
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px !important;
    }

    .table-wrapper table {
        min-width: 550px;
    }

    .table-wrapper table th,
    .table-wrapper table td {
        padding: 8px 10px !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
    }

    /* Lectures section: fix inline height on mobile */
    .lectures-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Settings form full width */
    .settings-form {
        max-width: 100% !important;
        padding: 16px !important;
    }

    /* Modal forms: grid-cols-2 -> single column on mobile */
    .modal-overlay .grid.grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    /* Modals - nearly full width on phones */
    .modal-overlay > div {
        max-width: 95vw !important;
        margin: 8px !important;
        padding: 16px !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
    }

    .modal-overlay h3 {
        font-size: 1.1rem !important;
    }

    .modal-overlay .input-field {
        padding: 10px 12px !important;
        font-size: 0.875rem !important;
    }

    .modal-overlay button[type="submit"],
    .modal-overlay button[type="button"] {
        padding: 10px !important;
        font-size: 0.8rem !important;
    }
}

/* --- Small Phone ≤480px --- */
@media (max-width: 480px) {
    /* Display page */
    #displayWrapper {
        padding: 4px !important;
    }

    #totalAmount {
        font-size: 1.5rem !important;
    }

    #overallPercent {
        font-size: 1rem !important;
    }

    #totalCard img[alt="Logo"] {
        height: 36px !important;
    }

    .stat-mini-card .stat-value {
        font-size: 1.1rem !important;
    }

    .donor-row .text-lg {
        font-size: 0.65rem !important;
    }

    .friday-amount {
        font-size: 2rem !important;
    }

    .friday-label {
        font-size: 0.85rem !important;
    }

    .lecture-card {
        border-width: 3px !important;
    }

    .lecture-info h3 {
        font-size: 1.1rem !important;
    }

    /* Admin dashboard */
    .admin-main {
        padding: 6px !important;
        padding-top: 56px !important;
    }

    .admin-main h1 {
        font-size: 1.15rem !important;
        margin-bottom: 12px !important;
    }

    /* Stats: single column */
    .admin-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }

    .admin-stats-grid .stat-card {
        padding: 10px !important;
    }

    .admin-stats-grid .stat-card .text-2xl {
        font-size: 1.1rem !important;
    }

    .admin-stats-grid .stat-card .w-10 {
        width: 32px !important;
        height: 32px !important;
    }

    /* Section headers tighter */
    .section-header {
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    .section-header h1 {
        font-size: 1.15rem !important;
    }

    .section-header button {
        padding: 8px 12px !important;
        font-size: 0.75rem !important;
    }

    /* Recent payments */
    .recent-payment-item {
        padding: 8px !important;
    }

    .recent-payment-item .w-9 {
        width: 28px !important;
        height: 28px !important;
    }

    .recent-payment-item .text-sm {
        font-size: 0.75rem !important;
    }

    /* Tables even more compact */
    .table-wrapper table {
        min-width: 480px;
    }

    .table-wrapper table th,
    .table-wrapper table td {
        padding: 6px 8px !important;
        font-size: 0.7rem !important;
    }

    /* Lecture cards in admin */
    .lectures-grid .glass-card {
        padding: 12px !important;
    }

    .lectures-grid .glass-card img {
        width: 48px !important;
        height: 48px !important;
    }

    .lectures-grid .glass-card h3 {
        font-size: 0.9rem !important;
    }

    .lectures-grid .glass-card .text-sm {
        font-size: 0.7rem !important;
    }

    /* Settings form */
    .settings-form {
        padding: 12px !important;
    }

    .settings-form label {
        font-size: 0.75rem !important;
    }

    .settings-form .input-field {
        padding: 8px 10px !important;
        font-size: 0.8rem !important;
    }

    .settings-form button[type="submit"] {
        padding: 10px 16px !important;
        font-size: 0.8rem !important;
    }

    /* Modals - full width on tiny screens */
    .modal-overlay > div {
        max-width: 100vw !important;
        margin: 4px !important;
        padding: 12px !important;
        border-radius: 12px !important;
        max-height: 90vh !important;
    }

    .modal-overlay h3 {
        font-size: 1rem !important;
        margin-bottom: 12px !important;
    }
}