@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700&family=Tajawal:wght@400;500;700&display=swap');

a,
button,
[role="button"],
.clickable {
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

:root {
    --primary-color: #137332;
    /* Deep Green */
    --accent-color: #D4AF37;
    /* Gold */
    --bg-color: #F8F9FA;
    --card-bg: #FFFFFF;
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --success-color: #27AE60;
    --warning-color: #F39C12;
    --available-color: #ECF0F1;
    --font-main: 'Tajawal', sans-serif;
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.1);
    --radius-md: 12px;
    --radius-lg: 20px;
    --action-area-bg: #FFF8E1;
    --hizb-card-bg: #FFFFFF;
    --font-quran: 'Noto Naskh Arabic', serif;
    /* Chat */
    --chat-icone: #062d8a;
    --chat-frame: #062d8a;
    --gold: #D4AF37;
    --border-color: #D4AF37;
}

.hidden {
    display: none !important;
}


[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-primary: #ecf0f1;
    --text-secondary: #bdc3c7;
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.4);
    --available-color: #34495e;
    --action-area-bg: #2a2a2a;
    --hizb-card-bg: #333333;
}

/* Theme Toggle styling handled by .action-btn inside header */
.theme-toggle {
    display: none;
}

.theme-toggle:hover {
    background: rgba(199, 115, 6, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 99px;
}




main {
    flex: 1;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Professional Sticky Header */
.main-header {
    background: rgba(28, 79, 64, 0.95);
    /* Glassmorphism fallback */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0 10px;
}

/* 1. Brand */
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    flex-shrink: 1;
    min-width: 0;
}

.header-logo {
    width: 100px;
    height: auto;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    flex-shrink: 0;
}

@media (max-width: 1100px) {
    .header-logo {
        width: 70px;
    }
}


.header-title-group {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.95;
    margin: 0;
    white-space: nowrap;
}

/* 2. Desktop Navigation */
.main-nav {
    display: flex;
    gap: 0.4rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 4px;
    border-radius: 40px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.nav-link.active {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--accent-color);
    color: #FFF;
    font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--accent-color), 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* 3. Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    position: relative;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.hamburger-btn {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

/* Responsive Fixes & Mobile Menu */
@media (max-width: 380px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background: var(--primary-color);
        display: flex;
        flex-direction: column;
        padding: 5rem 1rem 1rem 1rem;
        gap: 0.5rem;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1500;
        border-radius: 0;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
    }

    .nav-open .main-nav {
        right: 0;
    }

    .nav-link {
        width: 100%;
        padding: 1rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.05);
        font-size: 1rem;
    }

    .nav-link.active {
        background: #FFFFFF;
        /*var(--accent-color);*/
        box-shadow: none;
    }

    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(3px);
        z-index: 1400;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }

    .nav-open .mobile-nav-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.nav-open {
        overflow: hidden;
    }
}

/* Ensure hamburger button is visible up to 1100px */
@media (max-width: 1100px) {
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1600;
    }
}

/* Intermediate State: Horizontal Menu on 2 lines (381px to 1100px) */
@media (min-width: 381px) and (max-width: 1240px) {
    .header-content {
        flex-wrap: wrap;
        padding: 10px;
        gap: 10px;
    }

    .header-brand {
        flex: 1;
    }

    .header-actions {
        order: 2;
    }

    .main-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        background: rgba(0, 0, 0, 0.1);
        border-radius: 12px;
        padding: 8px;
        gap: 8px;
    }

    .nav-link {
        font-size: 1rem;
        padding: 0.4rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        gap: 0.3rem;
    }

    .logo {
        font-size: 0.85rem;
    }

    .subtitle {
        font-size: 0.7rem;
    }

    .header-logo {
        width: 47px;
        height: auto;
    }

    .user-avatar-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .action-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .dropdown-menu {
        width: 160px;
    }

    .btn-sm {
        padding: 0.4rem 0.1rem !important;
        font-size: 0.8rem !important;
    }
}

/* Specific Custom Layout (381px to 480px) */
@media (min-width: 381px) and (max-width: 480px) {
    .header-content {
        flex-direction: column !important;
        align-items: center !important;
        padding: 15px 10px !important;
        gap: 12px !important;
        position: relative;
    }

    .hamburger-btn {
        display: flex !important;
        position: absolute;
        top: 15px;
        left: 15px;
        /* RTL left is end */
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .header-brand {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
        gap: 8px !important;
        width: 100%;
        margin: 0 !important;
        padding-top: 5px;
    }

    .header-logo {
        width: 107px !important;
        /* Enlarged */
        height: auto !important;
    }

    .header-title-group {
        align-items: center !important;
    }

    .logo {
        font-size: 1.2rem !important;
        /* Enlarged */
        white-space: normal !important;
    }

    .subtitle {
        font-size: 0.85rem !important;
        /* Enlarged */
        white-space: normal !important;
        opacity: 0.95;
    }

    .header-actions {
        width: 100%;
        justify-content: center !important;
        gap: 1.2rem !important;
        order: 2;
        margin: 5px 0;
    }

    .main-nav {
        order: 3;
        width: 100%;
        justify-content: center !important;
        /* Better for horizontal scroll */
        background: rgba(0, 0, 0, 0.15) !important;
        padding: 8px !important;
        border-radius: 12px !important;

        display: flex !important;
        flex-wrap: wrap !important;

        gap: 7px !important;
    }

    .nav-link {
        font-size: 0.87em !important;
        padding: 0.3rem 0.4rem !important;
        flex-shrink: 0 !important;
    }
}

@media (max-width: 399px) {

    .header-brand .subtitle {
        font-size: 0.5rem;
    }
}


@media (max-width: 375px) {
    .logo {
        font-size: 0.70rem;
    }

    .btn-sm {
        padding: 0.4rem 0.1rem !important;
        font-size: 0.8rem !important;
    }
}

/* Sections */
.view {
    transition: opacity 0.3s ease;
}

.view.hidden {
    display: none;
    opacity: 0;
}

.view.active {
    display: block;
    opacity: 1;
}

.hidden {
    display: none;
}

.section-header {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
}

.current-date-badge {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: bold;
    margin-top: 1rem;
    box-shadow: var(--shadow-sm);
}

/* Buttons */
.btn-icon-lg {
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 12px;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    line-height: 1;
}

.btn-icon-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-color);
    background: #fffdf5;
}

[data-theme="dark"] .btn-icon-lg {
    background: #2a2a2a;
    border-color: #444;
    color: white;
}

.btn-icon-lg:active {
    transform: scale(0.95);
}

.btn {
    border: none;
    padding: 0.8rem 2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-xs {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

#join-btn {
    margin: 1em;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

#send-chat-btn {
    background-color: var(--chat-icone) !important;
}


.btn-primary:hover {
    background-color: #143a2d;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-gold {
    background-color: #fff;
    color: var(--accent-color);
    border: 2px solid #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-gold:hover {
    background-color: transparent;
    color: #a77c07;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-fb:hover {
    color: #f0eeea !important;
}

.current-date-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(212, 175, 55, 0.15);
    /* light accent background */
    color: var(--primary-color);
    border: 1px solid var(--accent-color);
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    /* slight shadow to indicate clickability */
}

.current-date-badge:hover {
    background: var(--accent-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

/* Calendar Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

@media (max-width: 425px) {
    .calendar-grid {

        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));

    }
}


.day-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;

    /* Animation defaults */
    opacity: 0;
    transform: translateY(20px);
}

.day-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.day-card:hover:not(.locked) {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}

.day-card.today {
    border: 3px solid var(--accent-color);
    background: #fffdf0;
    /*background: #FFFBF0;*/
}

.day-card.locked {
    background: #f0f0f0;
    color: #ccc;
    cursor: not-allowed;
    border-color: #eee;
    filter: grayscale(100%);
}

.day-card.locked .day-header,
.day-card.locked .day-number {
    color: #ccc;
}

.day-card.locked .day-stats {
    display: none;
}

.day-card.archived {
    background: #F4F4F4;
    color: #555;
}

.day-card.no-sessions {
    opacity: 0.7;
    cursor: default;
}

.day-header {
    font-size: 1.2rem;
    font-weight: bold;
    color: #888;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.day-header .session-count {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.8;
}

@media (max-width: 375px) {
    .day-header {
        font-size: 1rem;
    }
}

@media (max-width: 320px) {
    .day-header {
        font-size: 1.2rem;
    }
}

.day-card:not(.locked) .day-header {
    color: var(--accent-color);
}

.day-number {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}


.day-card.locked .day-number {
    color: #AAA;
}

.day-stats {
    font-size: 0.8rem;
    color: #094247;
    font-weight: bold;
}

.day-stats div {
    margin-bottom: 0.2rem;
}

.day-quote {
    margin-top: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
    padding: 0 0px;
    opacity: 0.8;
    transition: all 0.3s;
}

@media (max-width: 425px) {
    .day-quote {
        font-size: 0.75rem;
    }
}

.day-card:hover:not(.locked) .day-quote {
    color: var(--primary-color);
    opacity: 1;
}

[data-theme="dark"] .day-quote {
    color: #aaa;
}

/* Session List Styles */
.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.session-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 0.7rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.session-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.session-card.session-completed {
    background-color: #d0e9e2;
}

.btn-back {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: bold;
    font-family: var(--font-main);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-back:hover {
    background: var(--primary-color);
    color: white;
}

[data-theme="dark"] .btn-back {
    background: #333;
    border-color: var(--accent-color);
    color: var(--accent-color);
}

[data-theme="dark"] .btn-back:hover {
    background: var(--accent-color);
    color: #333;
}

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

/* Hide Profile button when on profile page */
body.on-profile .btn-profile {
    display: none;
}

/* Form Select Styling */
select {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: white;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.3s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    background-size: 1em;
}

select:focus {
    border-color: var(--primary-color);
    outline: none;
}

[data-theme="dark"] select {
    background-color: #333;
    color: white;
    border-color: #444;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

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

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
}

.badge.active {
    background-color: #E8F5E9;
    color: var(--success-color);
}

.badge.completed {
    background-color: var(--success-color);
    color: white;
}

.badge.carried-over {
    background-color: #FFF3E0;
    color: #EF6C00;
    border: 1px solid #FFE0B2;
    font-size: 0.75rem;
    padding: 2px 8px;
}

.session-title-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.session-title-group h3 {
    margin: 0;
}

.session-badges {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.session-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Session Detail Styles */
.back-btn {
    font-family: var(--font-main);
    /*position: absolute;*/
    right: 0;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 999px;
    background: #fff;
    /* Solid white background for better relief */
    border: 1px solid rgba(212, 175, 55, 0.4);
    /* Accent color border */
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin: 1em 0em;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
    /* Subtle shadow for depth */
}

.back-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.back-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.progress-container {
    max-width: 600px;
    margin: 1rem auto;
    text-align: center;
}

.progress-bar-bg {
    background-color: #E0E0E0;
    border-radius: 50px;
    height: 10px;
    width: 100%;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--accent-color);
    transition: width 0.5s ease-out;
}

/* Action Area */
.user-action-area {
    background: var(--action-area-bg);
    /* Light gold tint */
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    margin-bottom: 2rem;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.participation-stats {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: inherit;
    background: rgba(27, 77, 62, 0.05);
    padding: 0.4rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--primary-color);
}

.stat-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    font-weight: 600;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.participation-stats .value {
    font-weight: 800;
    color: var(--accent-color);
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    display: inline-block;
    line-height: 1.4;
}

[data-theme="dark"] .participation-stats .value {
    background: #252525;
}

@media (max-width: 630px) {
    .stat-group {
        flex-direction: row;
        align-items: center;
        text-align: center;
        gap: 12px;
        font-weight: 600;
    }

    .stat-item {
        flex-direction: column;
        gap: 5px;
    }
}

.my-hizbs-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.my-hizb-card {
    background: var(--hizb-card-bg);
    padding: 1.2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    /* Push buttons to bottom */
    gap: 0.3rem;
    min-width: 160px;
    height: 220px;
    /* Increased to fit the restored button comfortably */
    border: 2px solid var(--primary-color);
    transition: transform 0.2s;
}

.my-hizb-card:hover {
    transform: translateY(-5px);
}

/* The Grid */
.quran-grid-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.legend {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-right: 0.7rem;
    justify-content: center;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.available {
    background: var(--available-color);
    border: 1px solid #CCC;
}

.dot.in-progress {
    background: var(--warning-color);
}

.dot.completed {
    background: var(--success-color);
}

.dot.assigned {
    background: var(--available-color);
    border: 2px solid var(--warning-color);
    ;
}

.hizb-grid {
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    gap: 0.2rem;
    direction: rtl;
    /* Ensure RTL flow */
}

.hizb-tile {
    aspect-ratio: 1;
    background: var(--available-color);
    border-radius: 8px;
    /* Rounded Square */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: default;
    transition: all 0.3s;
    position: relative;
    border: 2px solid transparent;
    padding: 2px;
}

.hizb-number {
    font-weight: 800;
    font-size: 1rem;
    line-height: 1;
}

.hizb-page {
    font-size: 0.65rem;
    font-weight: 300;
    margin-top: 0;
    margin-bottom: 2px;
    opacity: 0.8;
}

.hizb-badge-user {
    font-size: 0.6rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 1px 6px;
    border-radius: 4px;
    max-width: 95%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    margin-top: auto;
}

[data-theme="dark"] .hizb-badge-user {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
}

.hizb-tile.completed {
    background: var(--success-color);
    color: white;
}

.hizb-tile.in-progress {
    background: var(--warning-color);
    color: white;
}

.hizb-tile.assigned {
    background: white;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: scale(1.01);
    z-index: 10;
    box-shadow: 0 0 10px rgba(27, 77, 62, 0.2);
}

.hizb-tile:hover {
    transform: scale(1.05);
    /* Slightly larger hover for small tiles */
    z-index: 20;
}

/* Ad Banner */
.ad-banner {
    background: linear-gradient(135deg, var(--accent-color), #B8860B);
    color: white;
    padding: 2rem;
    border-radius: var(--radius-md);
    margin-top: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 1rem;
}


.ad-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

/* Footer */
.main-footer {
    background-color: #f1f3f5;
    color: #34495e;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.95rem;
}

[data-theme="dark"] .main-footer {
    background-color: #252525;
    border-top: 1px solid #333;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 2px;
}

.footer-section p {
    color: #4b5a69;
    line-height: 1.8;
    max-width: 300px;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #4b5a69;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footer-links a:hover {
    color: var(--primary-color);
    transform: translateX(-5px);
}

.footer-links a::before {
    content: "•";
    color: var(--accent-color);
    font-size: 1.2rem;
    line-height: 0;
}

.footer-stats-list {
    list-style: none;
    padding: 0em 1em 0em 7em;
}

.footer-stats-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
    color: #4b5a69;
}

.footer-stats-list span.value {
    color: var(--primary-color);
    font-weight: 700;
}

[data-theme="dark"] .footer-stats-list span.value {
    color: var(--accent-color);
}

.footer-bottom {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 1.5rem;
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: #34495e;
}

[data-theme="dark"] .footer-bottom {
    border-top-color: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
}

[data-theme="dark"] .footer-section p,
[data-theme="dark"] .footer-links a,
[data-theme="dark"] .footer-stats-list li {
    color: #ecf0f1;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.contact-link:hover {
    color: var(--accent-color);
}

@media (max-width: 910px) {
    .hizb-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 0.5rem;
    }
}


/* Footer Responsive */
@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }

    .footer-section h3::after {
        right: 50%;
        transform: translateX(50%);
    }

    .footer-section p {
        margin: 0 auto;
    }

    .footer-links a:hover {
        transform: none;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .hizb-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .hizb-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.3rem;
    }
}

@media (max-width: 360px) {
    .hizb-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.2rem;
    }

    .session-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-logo {
        width: 77px;
        height: auto;
    }

    .logo {
        font-size: 0.0rem;
    }

    .header-brand .subtitle {
        font-size: 0.0rem;
    }

    .ad-banner {
        flex-direction: column;
        text-align: center;
    }

    .back-btn {
        position: relative;
        top: auto;
        right: auto;
        display: block;
        margin-bottom: 1rem;
        width: 100%;
        text-align: right;
    }
}

/* Auth Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 0.8rem 2em;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    position: relative;
    transition: all 0.3s ease;
    /* Prevent overflow on small screens */
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 10px;
    left: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.auth-form h2 {
    margin-bottom: 0rem;
    text-align: center;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.1rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-main);
    text-align: right;
    /* Fix un-centered/wonky text */
}

/* Add select specific styles to prevent arrow cutoff */
.form-group select {
    width: 100%;
    /* Extra padding on the left to avoid text being hidden behind RTL select arrow */
    padding: 0.8rem 0.8rem 0.8rem 2.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-main);
    background-color: var(--card-bg);
    color: var(--text-primary);
    text-align: right;
    direction: rtl;
}

.password-toggle-shared {
    position: absolute;
    left: 0px;
    top: 50%;
    transform: translateY(-5%);
    cursor: pointer;
    font-size: 1rem;
    color: #888;
    z-index: 10;
    padding: 2px 2px;
}

.password-toggle-shared:hover {
    color: var(--primary-color);
}

.auth-switch {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
}

/* User Menu in Header */
.user-menu {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    z-index: 100;
}

/* User Avatar Pastille */
.user-avatar-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.user-avatar-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.user-dropdown-container {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: auto;
    background: var(--card-bg);
    color: var(--text-primary);
    width: 200px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 1001;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1.2rem;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
}

.dropdown-header strong {
    display: block;
    color: var(--primary-color);
    font-size: 1rem;
}

.dropdown-header span {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.9rem 1.2rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    cursor: pointer;
}

body.pwa-installable #menu-install-pwa,
body.pwa-installable #sidebar-install-pwa {
    display: flex !important;
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--primary-color);
    padding-right: 1.5rem;
}

.dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.05);
    margin: 0.3rem 0;
}

@media (max-width: 768px) {
    .main-header {
        padding: 0.3rem 0.3rem 0.3rem 0.2rem;
    }

    .user-menu {
        top: 10px;
        right: 10px;
        left: 10px;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .theme-toggle {
        top: 60px;
        right: 5%;
    }

    .container {
        margin: 0;
        padding: 0 5px;
    }
}


/* Profile View */
.profile-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    margin-top: 1rem;
}

@media (max-width: 900px) {
    .profile-container {
        grid-template-columns: 1fr;
    }
}

.profile-card,
.history-card {
    padding: 1rem;
}

.profile-section-title {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

[data-theme="dark"] .profile-section-title {
    color: var(--accent-color);
}

.btn-ghost {
    background: #f0f0f0;
    color: var(--text-primary);
}

[data-theme="dark"] .btn-ghost {
    background: #444;
    color: #fff;
}

.btn-ghost:hover {
    background: #e0e0e0;
}

[data-theme="dark"] .btn-ghost:hover {
    background: #555;
}

.profile-form .form-group {
    margin-bottom: 1.2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 480px) {
    .modal-content {
        padding: 1.2rem 1rem;
        max-height: 85vh;
        overflow-y: auto;
        width: 95%;
    }

    .auth-form h2 {
        font-size: 1rem;
        margin-bottom: 0rem;
    }

    .form-group {
        margin-bottom: 0.7rem;
    }

    .form-group label {
        margin-bottom: 0.0rem;
        font-size: 0.85rem;
    }

    .form-group input {
        padding: 0.6rem 0.75rem 0.3rem 2rem;
        font-size: 0.9rem;
        line-height: 1.6;
        min-height: 42px;
        box-sizing: border-box;
    }

    .form-group select {
        padding: 0.6rem 0.75rem 0.3rem 2rem;
        font-size: 0.9rem;
        line-height: 1.6;
        min-height: 42px;
        box-sizing: border-box;
    }

    .btn {
        padding: 0.7rem 1.5rem;
    }
}

.btn-block {
    width: 100%;
}

.history-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 550px;
    margin-top: 1rem;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.history-table th,
.history-table td {
    padding: 0.4rem;
    text-align: right;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .history-table th,
[data-theme="dark"] .history-table td {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.history-table th {
    color: var(--text-secondary);
    font-weight: bold;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 5;
}


.user-name {
    font-weight: bold;
    color: white;
}



/* Douaa & Hadith Scroller Banners */
.global-banners-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 950;
    display: flex;
    flex-direction: column;
}

.douaa-banner,
.hadith-banner {
    width: 100%;
    padding: 6px 0;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    font-family: var(--font-quran);
    font-size: 1.4rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.douaa-banner {
    background: var(--primary-color);
    color: var(--accent-color);
    border-top: 1px solid rgba(212, 175, 55, 0.3);
}

.hadith-banner {
    background: #064E3B;
    /* Emerald Green */
    color: #A7F3D0;
    /* Light Emerald text */
    border-top: 1px solid rgba(167, 243, 208, 0.2);
}

.douaa-wrapper,
.hadith-wrapper {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    direction: ltr;
}

.douaa-content,
.hadith-content {
    display: inline-block;
    animation: scroll-right 190s linear infinite;
    direction: rtl;
    padding-left: 50px;
    /* Added to help safari render massive widths correctly */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

@keyframes scroll-right {
    0% {
        transform: translateX(-50%);
    }

    100% {
        transform: translateX(0);
    }
}

/* Interaction: Pause on hover */
.douaa-banner:hover .douaa-content,
.hadith-banner:hover .hadith-content {
    animation-play-state: paused;
}

.douaa-controls,
.hadith-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    flex-shrink: 0;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    z-index: 10;
}

.douaa-controls {
    background: var(--primary-color);
    border-left: 1px solid rgba(212, 175, 55, 0.2);
}

.hadith-controls {
    background: #064E3B;
    border-left: 1px solid rgba(167, 243, 208, 0.1);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
}

.douaa-banner .btn-icon {
    color: var(--accent-color);
}

.hadith-banner .btn-icon {
    color: #A7F3D0;
}

.btn-icon:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.05);
}

/* Dark Mode Adjustment */
[data-theme="dark"] .douaa-banner,
[data-theme="dark"] .douaa-controls {
    background: #0d261f;
}

[data-theme="dark"] .hadith-banner,
[data-theme="dark"] .hadith-controls {
    background: #042f24;
    color: #6ee7b7;
}

[data-theme="dark"] .hadith-banner .btn-icon {
    color: #6ee7b7;
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    .douaa-content,
    .hadith-content {
        animation: none;
        white-space: normal;
        text-align: center;
        padding-left: 0;
    }
}

/* --- Attribution & Engagement --- */
.engaged-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: #000;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    margin-right: 10px;
}

.closing-mode-banner {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
}



.btn-extend {
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    color: green;
    /*var(--primary-color);*/
    font-weight: bold;
}

.btn-extend:hover:not(:disabled) {
    background: var(--primary-color);
    color: #fff;
}

/* Completion Celebration Styles */
.completion-card {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
    border: none;
    animation: slideInUp 0.5s ease-out;
}

.completion-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    color: white;
}

.completion-card p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

.completion-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Olive Branch Banner for Completed Sessions */
.olive-banner {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(139, 195, 74, 0.15) 20%,
            rgba(139, 195, 74, 0.25) 50%,
            rgba(139, 195, 74, 0.15) 80%,
            transparent 100%);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin: 20px 0;
}

.olive-banner::before,
.olive-banner::after {
    content: '🌿';
    position: absolute;
    font-size: 2rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
}

.olive-banner::before {
    left: 1rem;
}

/* Gamification Dual Tracks */
.gamification-tracks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
    width: 100%;
}

.gamification-track {
    background: rgba(var(--primary-rgb), 0.03);
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    border-radius: 12px;
    padding: 0.8rem;
    text-align: right;
    transition: all 0.3s ease;
}

.gamification-track:hover {
    background: rgba(var(--primary-rgb), 0.05);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

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

.track-title {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--text-primary);
}

.track-target {
    font-size: 0.8rem;
    color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.track-bar-container {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.track-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 1s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.track-footer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Mobile Responsiveness for Tracks */
@media (max-width: 600px) {
    .gamification-tracks {
        grid-template-columns: 1fr;
    }
}

.olive-banner::after {
    right: 1rem;
    transform: translateY(-50%) scaleX(-1);
}

.olive-leaves {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.olive-leaves span {
    font-size: 1.5rem;
    animation: leafSway 2s ease-in-out infinite;
}

.olive-leaves span:nth-child(odd) {
    animation-delay: 0.5s;
}

@keyframes leafSway {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

/* --- Dashboard Styles --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .stat-card {
        padding: 1rem 0.5rem !important;
    }

    .stat-value {
        font-size: 1.4rem !important;
    }

    .stat-label {
        font-size: 0.8rem !important;
    }

    .stat-icon {
        font-size: 1.5rem !important;
    }

    .fami-stats-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    text-align: center;
    border-bottom: 3px solid var(--accent-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.95rem;
    color: #666;
    margin-top: 0.5rem;
}

.charts-grid {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.chart-card.wide {
    flex: 2;
    min-width: 250px;
    height: auto;
}

.chart-card.narrow {
    flex: 1;
    min-width: 250px;
    height: auto;
}

/* --- Fami Bishawq Styles --- */
.fb-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.fb-step-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* --- Fami Bishawq Countdown Styles --- */
.fb-deadline-banner {
    background: linear-gradient(135deg, #1B4D3E, #0d2e24);
    color: #f0d78c;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border: 1px solid rgba(201, 168, 76, 0.3);
    margin-bottom: 1rem;
}

[data-theme="dark"] .fb-deadline-banner {
    background: linear-gradient(135deg, #1a3a2e, #0f1f1a);
}

.fb-countdown {
    font-family: 'Tajawal', monospace;
    font-weight: 700;
}

.fb-timer {
    font-family: 'Tajawal', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: #27ae60;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.fb-timer.warning {
    color: #f39c12;
}

.fb-timer.urgent {
    color: #e74c3c;
    animation: fb-pulse 1s ease-in-out infinite;
}

@keyframes fb-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.fb-step-countdown {
    margin: 0.3rem 0;
    font-size: 0.9rem;
}


/* --- Niyat Modal Styles --- */
.niyat-modal-content {
    max-width: 500px;
    width: 90%;
    padding: 2rem;
}

.niyat-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
    padding: 5px;
}

.niyat-item {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: all 0.2s;
    cursor: pointer;
}

[data-theme="dark"] .niyat-item {
    background: #252525;
    border-color: #333;
}

.niyat-item:hover {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .niyat-item:hover {
    background: #333;
}

.niyat-checkbox {
    width: 18px;
    height: 18px;
    margin-left: 10px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.niyat-item label {
    cursor: pointer;
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Scrollbar for niyat list */
.niyat-list::-webkit-scrollbar {
    width: 6px;
}

.niyat-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.niyat-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}


[data-theme="dark"] .fb-step-card.active {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
    border-color: var(--accent-color);
}

.fb-step-card.completed {
    background: rgba(39, 174, 96, 0.1);
    border-color: #27ae60;
}

.fb-step-card.locked {
    background: var(--bg-color);
    opacity: 0.6;
    filter: grayscale(1);
    cursor: not-allowed;
    border: 1px dashed rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .fb-step-card.locked {
    border: 1px dashed rgba(255, 255, 255, 0.1);
    background: #222;
}

.fb-letter {
    font-family: var(--font-quran);
    font-size: 3rem;
    color: var(--primary-color);
    background: rgba(27, 77, 62, 0.1);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .fb-letter {
    color: var(--accent-color);
    background: rgba(212, 175, 55, 0.1);
}

.fb-step-card.active .fb-letter {
    color: var(--accent-color);
    background: var(--primary-color);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
    animation: pulseLetter 2s infinite;
}

.fb-step-card.completed .fb-letter {
    background: #27ae60;
    color: white;
}

.fb-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.fb-range {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
}

.fb-status,
.fb-step-card .btn-sm {
    width: auto;
    min-width: 120px;
    justify-content: center;
}

.fb-status {
    font-size: 0.9rem;
    font-weight: bold;
    padding: 0.4rem 1rem;
    border-radius: 20px;
}

.fb-status.success {
    background: rgba(39, 174, 96, 0.2);
    color: #2ecc71;
}

.fb-status.locked {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
}

[data-theme="dark"] .fb-status.locked {
    background: rgba(255, 255, 255, 0.05);
}

.fb-start-card {
    text-align: center;
    padding: 3rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 2px dashed var(--accent-color);
}

.fb-start-card h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

@keyframes pulseLetter {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(212, 175, 55, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

.fb-history-section {
    margin-top: 3rem;
    border-top: 2px solid var(--available-color);
    padding-top: 2rem;
}

.hizb-tile.assigned {
    border: 2px solid #e67e22;
    background: rgba(230, 126, 34, 0.1);
    color: #e67e22 !important;
}

.hizb-tile.expired {
    background: linear-gradient(135deg, #1c83e5, #363cff) !important;
    border-color: #090b97 !important;
    color: #fff !important;
}

.fb-finish-screen {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.fb-title {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

[data-theme="dark"] .fb-title {
    color: var(--accent-color);
}

.fb-info-box {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: bold;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .fb-info-box {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.fb-info-title {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
    color: var(--primary-color);
}

[data-theme="dark"] .fb-info-title {
    color: var(--accent-color);
}

.fb-history-section h3 {
    color: var(--primary-color);
}

[data-theme="dark"] .fb-history-section h3 {
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .charts-grid {
        flex-direction: column;
    }

    .fb-steps-grid {
        grid-template-columns: 1fr;
    }
}

.fb-read-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fb-read-btn:hover {
    transform: scale(1.1);
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-color);
}

[data-theme="dark"] .fb-read-btn {
    background: #444;
    border-color: #555;
    color: white;
}

[data-theme="dark"] .fb-read-btn:hover {
    background: #555;
    border-color: var(--accent-color);
}

/* Chat Reactions & Flying Crown → see css/chat.css */



.scroll-top-btn {
    position: fixed;
    bottom: 99px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--chat-icone);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.65;
}

.scroll-top-btn.hidden {
    transform: translateY(20px) scale(0);
    opacity: 0;
    pointer-events: none;
}

.scroll-top-btn:hover {
    background: #002b8a;
    transform: translateY(-3px);
    opacity: 1;
}

.fab-sibha-btn {
    position: fixed;
    bottom: 100px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1B4D3E, #2ecc71);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transition: all 0.3s ease;
    opacity: 0.87;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-sibha-btn:hover {
    transform: translateY(-3px);
    opacity: 1;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}


/* Duplicated blocks removed to clean up the file */


.hizb-tile-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

/* --- HIZB TILE STYLES --- */
.hizb-tile-wrapper {
    perspective: 1000px;
    width: 100%;
    min-width: 0; /* Prevents overflow expansion */
    aspect-ratio: 1;
    display: block;
    margin: 0;
}



.hizb-tile-inner.flipped {
    transform: rotateY(180deg);
}

.hizb-tile-front,
.hizb-tile-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hizb-tile-back {
    background: var(--primary-color);
    color: white;
    transform: rotateY(180deg);
    gap: 4px;
    padding: 2px;
}

.hizb-tile-back button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    width: 90%;
    min-width: auto !important;
    /* Fix for btn-sm conflict */
    transition: background 0.2s;
}

.hizb-tile-back button:hover {
    background: rgba(255, 255, 255, 0.4);
}

.hizb-tile {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 4px 2px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
}




/* --- PDF MODAL --- */
.pdf-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    z-index: 10000;
    flex-direction: column;
}

.pdf-modal:not(.hidden) {
    display: flex;
}

.pdf-modal .modal-header {
    background: #2c3e50;
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.pdf-modal-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #333;
    display: flex;
    flex-direction: column;
}

.pdf-render-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    -webkit-overflow-scrolling: touch;
    z-index: 1;
    direction: ltr;
}

.pdf-render-container canvas,
.pdf-render-container img {
    max-width: 100%;
    width: 100%;
    height: auto;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    transition: filter 0.3s ease;
    flex-shrink: 0;
}

.pdf-render-container.night-mode-active canvas,
.pdf-render-container.night-mode-active img {
    filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.95);
    background: #000;
}

.pdf-render-container.night-mode-active .pdf-page-placeholder {
    background: #2a2a2a;
    border-color: #444;
}

/* ── Wrapper image + badge numéro de page ─────────────────────────────────── */
.img-page-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2px auto;
    flex-shrink: 0;
}

.img-page-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    /* styles visuels hérités de .pdf-render-container img */
}

.img-page-badge {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.72rem;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 2px 9px;
    border-radius: 10px;
    pointer-events: none;
    user-select: none;
    line-height: 1.4;
    backdrop-filter: blur(2px);
    transition: opacity 0.2s;
}

/* En mode nuit, le badge reste lisible (non-inverti car position:absolute) */
.pdf-render-container.night-mode-active .img-page-badge {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
}

/* Desktop 2-pages : le wrapper remplace canvas/img */
@media (min-width: 1024px) {
    .img-page-wrapper {
        width: 100% !important;
        max-width: 600px !important;
        margin: 0 !important;
    }

    /* Première page (couverture) prend toute la largeur */
    .pdf-render-container>.img-page-wrapper:first-child {
        grid-column: 1 / span 2;
        max-width: 700px !important;
    }

    .img-page-wrapper:hover img {
        transform: scale(1.01);
    }
}


.pdf-page-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 3px 0;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pdf-page-bar.hidden {
    display: none !important;
}

@media (max-width: 480px) {
    .pdf-page-label {
        display: none;
    }

    #pdf-page-nav {
        margin-right: 5px !important;
        padding: 5px 8px !important;
    }
}

.pdf-loading {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2rem;
    text-align: center;
    z-index: 5;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 8px;
    pointer-events: none;
}

/* --- PK QUICK ACTIONS --- */
.pk-quick-actions {
    display: flex;
    gap: 8px;
    margin-left: 10px;
    align-items: center;
}

.pk-quick-actions .btn-icon {
    background: white;
    border: 1px solid var(--border-color);
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.pk-quick-actions .btn-icon:hover {
    background: #fdfdfd;
    transform: scale(1.1);
    border-color: var(--primary-color);
}

/* --- PDF ZOOM CONTROLS --- */
.pdf-zoom-controls {
    display: none;
    /* Hidden on mobile by default */
    gap: 15px;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 15px;
    border-radius: 50px;
}

@media (min-width: 1024px) {
    .pdf-zoom-controls {
        display: flex;
    }
}

.pdf-zoom-controls button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-zoom-controls button:hover {
    transform: scale(1.2);
}

#pdf-zoom-level {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 5px;
}

/* Desktop optimization for PDF: 2-page side-by-side view */
@media (min-width: 1024px) {
    .pdf-render-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        direction: rtl;
        /* Page 1 will be on the right, perfect for Quran */
        padding: 10px !important;
        gap: 10px;
        align-items: start;
        justify-items: center;
    }

    /* canvas (compat ancien rendu PDF.js) */
    .pdf-render-container canvas,
    .pdf-render-container .pdf-page-placeholder {
        width: 100% !important;
        max-width: 600px !important;
        margin: 0 !important;
        box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.4);
        transition: transform 0.2s ease-out;
    }

    .pdf-render-container>canvas:first-child,
    .pdf-render-container>.pdf-page-placeholder:first-child {
        grid-column: 1 / span 2;
        max-width: 700px !important;
    }

    .pdf-render-container canvas:hover {
        transform: scale(1.01);
    }
}

.pdf-modal-actions {
    display: flex;
    align-items: center;
    margin: 0 15px;
}

.pdf-modal-actions .btn-success {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.pdf-modal-actions .btn-success:hover {
    background-color: #219150;
}

/* --- PDF Audio Player --- */
.pdf-audio-player {
    background: #f8f9fa;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: center;
    width: 100%;
}

.pdf-audio-player audio {
    width: 100%;
    max-width: 500px;
    height: 40px;
}

/* --- MY ASSIGNED HIZBS LIST --- */
.my-hizbs-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 15px;
    align-items: start;
    /* Prevent cards from stretching vertically */
}

.my-hizb-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100px;
    /* Base height for consistency */
}

.my-hizb-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.hizb-duration {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 8px;
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border-radius: 4px;
    font-weight: bold;
}

[data-theme="dark"] .hizb-duration {
    background: rgba(39, 174, 96, 0.2);
    color: #2ecc71;
}

@media (max-width: 480px) {
    .my-hizbs-list {
        grid-template-columns: 1fr 1fr;
    }

    .douaa-banner,
    .hadith-banner {

        font-size: 1.1rem;

    }
}

/* --- Niyat Modal Styles --- */
.niyat-modal-content {
    max-width: 500px;
    width: 90%;
    padding: 2rem;
}

.niyat-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
    padding: 5px;
}

.niyat-item {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: all 0.2s;
    cursor: pointer;
}

[data-theme="dark"] .niyat-item {
    background: #252525;
    border-color: #333;
}

.niyat-item:hover {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .niyat-item:hover {
    background: #333;
}

.niyat-checkbox {
    width: 18px;
    height: 18px;
    margin-left: 10px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.niyat-item label {
    cursor: pointer;
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Scrollbar for niyat list */
.niyat-list::-webkit-scrollbar {
    width: 6px;
}

.niyat-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.niyat-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* --- Personal Khatma Toggle Button --- */
#pk-toggle-history-btn {
    background: #f0f0f0;
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    border: 1px solid #ddd;
}

#pk-toggle-history-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

[data-theme="dark"] #pk-toggle-history-btn {
    background: #333 !important;
    color: var(--text-primary) !important;
    border: 1px solid #444 !important;
}

/* Hizb Countdown Timer & Tooltips */
.hizb-countdown-wrapper {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.hizb-countdown {
    font-weight: bold;
    color: var(--accent-color);
    font-family: monospace;
}

.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--text-secondary);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    cursor: help;
    font-weight: bold;
}

.info-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    width: 200px;
    font-size: 0.75rem;
    text-align: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
    pointer-events: none;
    line-height: 1.4;
    font-weight: normal;
}

.info-tooltip:hover::after {
    visibility: visible;
    opacity: 1;
}

[data-theme="dark"] .info-tooltip::after {
    background: #555;
}


[data-theme="dark"] #pk-toggle-history-btn:hover {
    background: #444 !important;
    border-color: #555 !important;
}

/* ====================================
   WIRD AL-BAQARA & YASIN STYLES
   ==================================== */

/* Counter Card */
.wird-counter-card {
    background: linear-gradient(135deg, var(--wird-from, #1a6b3c), var(--wird-to, #2ecc71));
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    color: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.wird-counter-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* Progress Ring */
.wird-counter-ring {
    position: relative;
    display: inline-block;
    width: 160px;
    height: 160px;
    margin-bottom: 1.5rem;
}

.wird-ring-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.4));
    transition: filter 1s ease;
}

/* Completion Animation Overlay */
.spiritual-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.85) 70%);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    animation: spiritual-fade-in 1s ease-out forwards;
}

.spiritual-light-burst {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 223, 128, 0.3) 0%, transparent 60%);
    animation: spiritual-pulse 3s infinite ease-in-out;
    pointer-events: none;
}

.spiritual-msg-container {
    text-align: center;
    color: #fff;
    z-index: 2;
    transform: translateY(20px);
    opacity: 0;
    animation: spiritual-msg-rise 1s 0.5s ease-out forwards;
}

.spiritual-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    display: block;
    animation: spiritual-float 4s infinite ease-in-out;
}

.spiritual-main-text {
    font-family: 'Noto Naskh Arabic', serif;
    font-size: 2.5rem;
    color: #FFD700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
}

.spiritual-sub-text {
    font-size: 1.2rem;
    opacity: 0.9;
    color: #fff;
}

@keyframes spiritual-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes spiritual-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

@keyframes spiritual-msg-rise {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spiritual-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.spiritual-overlay.fading-out {
    opacity: 0 !important;
    visibility: hidden;
    transition: opacity 2.5s ease-out, visibility 2.5s linear !important;
    animation: none !important;
    /* Stop the fade-in animation so transition takes over */
    pointer-events: none;
}

.wird-counter-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    line-height: 1;
}

.wird-counter-number {
    font-size: 2.8rem;
    font-weight: 800;
    display: block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.wird-counter-sep {
    font-size: 1.2rem;
    opacity: 0.7;
    margin: 0 2px;
}

.wird-counter-target {
    font-size: 1.2rem;
    opacity: 0.8;
    font-weight: 600;
}

/* Meta Info */
.wird-counter-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.wird-cycle-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    backdrop-filter: blur(5px);
}

.wird-total-reads {
    font-size: 0.9rem;
    opacity: 0.9;
}

.wird-active-readers {
    font-size: 0.85rem;
    opacity: 0.85;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        opacity: 0.85;
    }

    50% {
        opacity: 1;
    }
}

/* Action Area */
.wird-action-area {
    text-align: center;
    margin-top: 1rem;
}

.wird-action-btn {
    font-size: 1.1rem;
    padding: 12px 30px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.wird-reserve-btn {
    animation: gentle-bounce 2s infinite;
}

@keyframes gentle-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

.wird-reserve-btn:hover {
    animation: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.wird-reservation-info {
    background: var(--card-bg);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0 auto;
    max-width: 400px;
}

/* Confetti Container */
.wird-confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
}

.wird-confetti-particle {
    position: absolute;
    top: -10px;
    left: var(--x, 50vw);
    width: 10px;
    height: 10px;
    background: var(--color, #f39c12);
    border-radius: 2px;
    animation: confetti-fall var(--duration, 2s) var(--delay, 0s) ease-in forwards;
}

.wird-confetti-particle:nth-child(odd) {
    width: 8px;
    height: 12px;
    border-radius: 50%;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(var(--rotation, 720deg));
        opacity: 0;
    }
}

.wird-cycle-complete-msg {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 1.5rem 3rem;
    border-radius: 16px;
    font-size: 1.4rem;
    font-weight: bold;
    z-index: 100000;
    animation: msg-pop 0.5s ease-out;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@keyframes msg-pop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Audio Player */
.wird-audio-player {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 0.75rem;
    text-align: center;
}

[data-theme="dark"] .wird-audio-player {
    background: rgba(255, 255, 255, 0.05);
}

/* Dark Mode Overrides */
[data-theme="dark"] .wird-reservation-info {
    background: #2a2a2a;
    border-color: var(--accent-color);
}

[data-theme="dark"] .wird-cycle-complete-msg {
    background: rgba(30, 30, 30, 0.95);
}

/* Responsive */
@media (max-width: 480px) {
    .wird-counter-ring {
        width: 130px;
        height: 130px;
    }

    .wird-counter-number {
        font-size: 2.2rem;
    }

    .wird-counter-card {
        padding: 1.5rem 1rem;
    }

    .wird-cycle-complete-msg {
        font-size: 1.1rem;
        padding: 1rem 2rem;
    }
}

/* Notification Bell & Panel */
.notif-wrapper {
    position: relative;
}

.notif-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: all 0.3s ease;
}

.notif-btn:hover {
    transform: scale(1.05);
    background: var(--action-area-bg);
}

.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
}

.notif-panel {
    position: absolute;
    top: 60px;
    left: 0;
    width: 300px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform-origin: top left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

.notif-panel.hidden {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
    pointer-events: none;
}

.notif-header {
    background: var(--action-area-bg);
    padding: 12px 15px;
    font-weight: bold;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--accent-color);
}

.notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.notif-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--action-area-bg);
}

.notif-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    /* Use theme-aware primary color */
}

.notif-item-timer {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.notif-item-timer .hizb-countdown {
    font-size: 0.85rem;
    color: var(--accent-color);
}

.notif-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.notif-tag.tag-hizb {
    background: #e3f2fd;
    color: #1976d2;
}

.notif-tag.tag-wird {
    background: #f1f8e9;
    color: #388e3c;
}

.notif-tag.tag-personal {
    background: #e1f5fe;
    color: #0288d1;
}

.notif-tag.tag-fami {
    background: #f3e5f5;
    color: #7b1fa2;
}

.notif-tag.tag-expired {
    background: #ffebee;
    color: #c62828;
}

[data-theme="dark"] .notif-btn {
    background: #2a2a2a;
    border-color: #444;
}

[data-theme="dark"] .notif-badge {
    border-color: #2a2a2a;
}

[data-theme="dark"] .notif-panel {
    background: #1e1e1e;
    border-color: #444;
}

[data-theme="dark"] .notif-header {
    background: #252525;
    border-bottom-color: #444;
    color: var(--accent-color);
}

[data-theme="dark"] .notif-item {
    border-bottom-color: #333;
}

[data-theme="dark"] .notif-item-title {
    color: #ffffff;
}

[data-theme="dark"] .notif-item-timer {
    color: #aaaaaa;
}

[data-theme="dark"] .notif-tag.tag-hizb {
    background: #1a3c40;
    color: #4db6ac;
}

[data-theme="dark"] .notif-tag.tag-wird {
    background: #1b3022;
    color: #81c784;
}

[data-theme="dark"] .notif-tag.tag-personal {
    background: #01579b;
    color: #81d4fa;
}

[data-theme="dark"] .notif-tag.tag-fami {
    background: #4a148c;
    color: #e1bee7;
}

[data-theme="dark"] .notif-tag.tag-expired {
    background: #311b1b;
    color: #ef9a9a;
}

@media (max-width: 600px) {
    .notif-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        width: auto;
        top: 70px;
    }
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.3s ease-out forwards;
    transition: all 0.5s ease;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-success {
    border-left: 4px solid #2ecc71;
}

.toast-error {
    border-left: 4px solid #e74c3c;
}

@keyframes toast-in {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.toast-out {
    animation: toast-out 0.5s ease-in forwards;
}

@keyframes toast-out {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(20px);
        opacity: 0;
    }
}

[data-theme="dark"] .toast {
    background: #2c2c2c;
    border-color: #444;
}

/* Sticky Refresh Button SVG Styles */
.sticky-refresh-btn {
    position: fixed;
    bottom: 169px;
    left: auto;
    right: 27px;
    width: 50px;
    height: 50px;
    background: var(--warning-color);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.sticky-refresh-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.sticky-refresh-btn:active {
    transform: scale(0.9);
}

.refresh-icon-svg {
    width: 32px;
    height: 32px;
    color: white;
    /* Icon Color */
}

.refresh-icon-svg.rotating {
    animation: spin 1s linear infinite;
}

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

/* --- Mobile Sidebar Drawer --- */
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    /* Hidden off-screen right */
    width: 280px;
    height: 100vh;
    background: #fff;
    z-index: 10000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.nav-open .mobile-sidebar {
    right: 0;
    /* Slide in */
}

/* Enhanced Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

body.nav-open .mobile-nav-overlay {
    opacity: 1;
    visibility: visible;
}

/* Header */
.sidebar-header {
    background: #1b4d3e;
    /* Dark Green */
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 0.8;
    padding: 0 5px;
}

/* Content Body */
.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Improved Standalone Tabs */
.standalone-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 5px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 15px;
}

[data-theme="dark"] .standalone-tabs {
    background: rgba(255, 255, 255, 0.05);
}

.standalone-tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
}

[data-theme="dark"] .standalone-tab-btn {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.standalone-tab-btn i {
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.standalone-tab-btn:hover {
    border-color: var(--primary-color);
    background: white;
    color: var(--primary-color);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.standalone-tab-btn.active {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
    border-width: 2px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.standalone-tab-btn.active i {
    transform: scale(1.1);
}

[data-theme="dark"] .standalone-tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Global Tasbih Header Styles */
.tasbih-global-header {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid rgba(27, 77, 62, 0.1);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tgh-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 15px;
    cursor: pointer;
    user-select: none;
}

.tgh-top:hover h4 {
    color: var(--accent-color);
}

.tgh-chevron {
    transition: transform 0.3s ease;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tasbih-global-header.is-collapsed {
    gap: 0;
    padding-bottom: 15px;
}

.tasbih-global-header.is-collapsed .tgh-top {
    border-bottom: none;
    padding-bottom: 0;
}

.tasbih-global-header.is-collapsed .tgh-settings {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.tasbih-global-header.is-collapsed .tgh-chevron {
    transform: rotate(180deg);
}

.tgh-top h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 800;
}

.btn-test-vib-mini {
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-test-vib-mini:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: white;
}

.tgh-settings {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    overflow: hidden;
    max-height: 500px;
    opacity: 1;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top;
}

.tgh-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tgh-group>span {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.compact-sound-grid,
.compact-vol-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Custom styling for compact vol grid icons */
.compact-vol-grid .compact-sound-item span {
    font-size: 1.1rem;
    padding: 8px 15px;
}

@media (max-width: 600px) {
    .tasbih-global-header {
        padding: 15px;
    }

    .tgh-settings {
        flex-direction: column;
        gap: 15px;
    }

    .standalone-tabs {
        padding: 4px;
    }

    .standalone-tab-btn {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* Links */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
    border-right: 4px solid transparent;
}

.sidebar-link:hover {
    background: #f8f9fa;
    transform: translateX(-2px);
}

.sidebar-link.active {
    background: #fffdf5;
    /* Light Beige */
    color: #1b4d3e;
    border-right-color: #d4af37;
    /* Gold */
    font-weight: 700;
}

.sidebar-link span {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-divider {
    height: 1px;
    background: #eee;
    margin: 1rem 0;
}

/* User Section */
.mobile-user-section {
    margin-top: 1rem;
}

.mobile-user-card {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.mobile-user-card h4 {
    margin: 0.5rem 0;
    color: var(--primary-color);
}

.mobile-user-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.mobile-user-actions .btn {
    justify-content: center;
}

/* Footer */
.sidebar-footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

/* Dark Mode Adjustments */
[data-theme='dark'] .mobile-sidebar {
    background: #1e1e1e;
}

[data-theme='dark'] .sidebar-header {
    background: #143a2d;
}

[data-theme='dark'] .sidebar-link {
    color: #eee;
}

[data-theme='dark'] .sidebar-link:hover {
    background: #2a2a2a;
}

[data-theme='dark'] .sidebar-link.active {
    background: #252525;
    color: #d4af37;
}

[data-theme='dark'] .sidebar-footer {
    background: #1a1a1a;
    border-top-color: #333;
}

/* PDF Lazy Loading Styles */
.pdf-page-placeholder {
    background: #e0e0e0;
    margin: 15px auto;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    display: table;
    text-align: center;
    min-height: 200px;
    max-width: 100%;
}

.pdf-page-placeholder.rendered {
    display: contents;
}

[data-theme="dark"] .pdf-page-placeholder {
    background: #2a2a2a;
}

/* display:contents ignores all box styles, so no dark override needed */

.pdf-page-placeholder::before {
    content: "جاري التحميل...";
    color: #999;
    font-size: 0.9rem;
    display: block;
    padding-top: 80px;
}

.pdf-page-placeholder.rendered::before {
    display: none;
}

.pdf-page-placeholder.shimmer::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: pdf-shimmer 2s infinite;
}

[data-theme="dark"] .pdf-page-placeholder.shimmer::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
}

@keyframes pdf-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.pdf-render-container canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* ===== GROUP READING GUIDE ===== */

/* Help Button (?) */
.guide-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    font-size: 1.45rem;
    font-weight: 700;
    cursor: pointer;
    vertical-align: middle;
    margin-right: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(26, 60, 64, 0.3);
    animation: guideHelpPulse 2s ease-in-out infinite;
}

.guide-help-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 14px rgba(26, 60, 64, 0.4);
    animation: none;
}

@keyframes guideHelpPulse {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(26, 60, 64, 0.3);
    }

    50% {
        box-shadow: 0 2px 16px rgba(205, 164, 94, 0.6);
    }
}

/* Guide Modal Content */
.guide-modal-content {
    max-width: 620px !important;
    padding: 1.5rem 1.8rem !important;
}

.guide-modal-title {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    font-size: 1.3rem;
}

.guide-modal-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Guide Sections */
.guide-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.guide-section {
    background: rgba(0, 0, 0, 0.015);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    border-right: 4px solid var(--primary-color);
    transition: all 0.2s ease;
}

.guide-section:hover {
    background: rgba(0, 0, 0, 0.03);
    transform: translateX(-2px);
}

.guide-section-highlight {
    background: linear-gradient(135deg, rgba(205, 164, 94, 0.08), rgba(212, 175, 55, 0.05));
    border-right-color: var(--accent-color);
}

.guide-section-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}

.guide-section-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary-color);
}

.guide-section-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.guide-section-body {
    padding-right: 0.3rem;
}

.guide-section-body p {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-primary);
}

/* Ordered Steps */
.guide-steps {
    margin: 0.5rem 0;
    padding-right: 1.2rem;
    padding-left: 0;
}

.guide-steps li {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Feature List */
.guide-features {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

.guide-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.guide-feature-icon {
    flex-shrink: 0;
    min-width: 22px;
    text-align: center;
}

/* Tip Box */
.guide-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: rgba(46, 204, 113, 0.08);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin-top: 0.7rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #1a5a2e;
}

/* Warning Box */
.guide-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: rgba(243, 156, 18, 0.08);
    border: 1px solid rgba(243, 156, 18, 0.25);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin-top: 0.7rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #7a5100;
}

/* Legend Grid */
.guide-legend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}

.guide-legend-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.guide-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}

.guide-legend-item strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 1px;
}

.guide-legend-item small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Limits Grid */
.guide-limits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.guide-limit-card {
    text-align: center;
    padding: 1rem 0.8rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(26, 60, 64, 0.04), rgba(205, 164, 94, 0.06));
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.guide-limit-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.4rem;
}

.guide-limit-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 0.2rem;
}

.guide-titles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.guide-title-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    flex: 1;
    min-width: 140px;
    gap: 0.3rem;
}

[data-theme="dark"] .guide-title-item {
    background: rgba(255, 255, 255, 0.05);
}

.guide-title-item small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.guide-limit-card small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Golden Tips */
.guide-golden-tips {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guide-golden-tips li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
    border-bottom: 1px solid rgba(205, 164, 94, 0.15);
}

.guide-golden-tips li:last-child {
    border-bottom: none;
}

/* Dark mode */
[data-theme="dark"] .guide-section {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .guide-section:hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .guide-section-highlight {
    background: linear-gradient(135deg, rgba(205, 164, 94, 0.1), rgba(212, 175, 55, 0.06));
}

[data-theme="dark"] .guide-tip {
    background: rgba(46, 204, 113, 0.1);
    border-color: rgba(46, 204, 113, 0.25);
    color: #7ddfb0;
}

[data-theme="dark"] .guide-warning {
    background: rgba(243, 156, 18, 0.1);
    border-color: rgba(243, 156, 18, 0.25);
    color: #f5c76e;
}

[data-theme="dark"] .guide-legend-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .guide-limit-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(205, 164, 94, 0.08));
    border-color: rgba(255, 255, 255, 0.08);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .guide-modal-content {
        padding: 1rem 1.2rem !important;
    }

    .guide-legend-grid {
        grid-template-columns: 1fr;
    }

    .guide-limits-grid {
        grid-template-columns: 1fr 1fr;
    }

    .guide-section {
        padding: 0.8rem;
    }
}

/* --- PWA BANNER --- */
.pwa-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    /* Hidden downwards */
    width: calc(100% - 40px);
    max-width: 450px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    visibility: hidden;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.pwa-banner.show {
    transform: translateX(-50%) translateY(0);
    visibility: visible;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 15px;
}

.pwa-icon img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pwa-text {
    flex: 1;
    text-align: right;
    /* RTL adapted */
    direction: rtl;
}

.pwa-text strong {
    display: block;
    font-size: 1rem;
    color: #222;
    margin-bottom: 4px;
}

.pwa-text p {
    font-size: 0.8rem;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.pwa-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 80px;
}

.pwa-btn {
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 12px;
    transition: all 0.2s;
    text-align: center;
}

.pwa-btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.pwa-btn-primary:hover {
    background-color: #143a2d;
    transform: translateY(-2px);
}

.pwa-btn-close {
    background-color: #f0f0f0;
    color: #666;
}

.pwa-btn-close:hover {
    background-color: #e4e4e4;
    color: #333;
}

/* =========================================================================
   14. STANDALONE WIRD (SURAHS) MODULE
========================================================================= */

.sw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.sw-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .sw-card {
    background: linear-gradient(135deg, #2a2a2a, #222);
    border-color: rgba(255, 255, 255, 0.05);
}

.sw-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--sw-from, var(--primary-color)), var(--sw-to, var(--accent-color)));
    opacity: 0.8;
}

.sw-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.sw-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.sw-card-emoji {
    font-size: 2rem;
    background: rgba(var(--primary-rgb), 0.05);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .sw-card-emoji {
    background: rgba(255, 255, 255, 0.05);
}

.sw-card-title-group {
    flex: 1;
}

.sw-card-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 2px 0;
}

.sw-card-number {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(var(--primary-rgb), 0.05);
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}

[data-theme="dark"] .sw-card-number {
    background: rgba(255, 255, 255, 0.1);
}

.sw-card-virtue {
    font-size: 1.5rem;
    opacity: 0.8;
}

.sw-card-desc {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.sw-card-stats {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .sw-card-stats {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.03);
}

.sw-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.sw-stat:first-child {
    border-left: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .sw-stat:first-child {
    border-left-color: rgba(255, 255, 255, 0.05);
}

.sw-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent-color);
}

.sw-stat-value.sw-stat-date {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.sw-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.sw-card-actions {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 8px;
}

.sw-btn {
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.sw-btn-read {
    background: var(--primary-color);
    color: white;
}

.sw-btn-read:hover {
    background: #143a2f;
    transform: translateY(-2px);
}

.sw-btn-listen {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary-color);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

[data-theme="dark"] .sw-btn-listen {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
}

.sw-btn-listen:hover {
    background: rgba(var(--primary-rgb), 0.15);
    transform: translateY(-2px);
}

[data-theme="dark"] .sw-btn-listen:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
/* ==========================================================================
   Tasbih Feature Styles (Consolidated)
   ========================================================================== */

/* Panel */
.standalone-panel {
    animation: fadeIn 0.4s ease;
}

/* Grid */
.tasbih-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-bottom: 2rem;
}

.tasbih-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 30px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.tasbih-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--tasbih-color) 0%, transparent 70%);
    opacity: 0.05;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tasbih-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.tasbih-card:hover::before {
    opacity: 0.1;
}

[data-theme="dark"] .tasbih-card {
    border-color: rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.03);
}

.tasbih-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--tasbih-color) !important;
    margin-bottom: 25px;
    text-align: center;
    min-height: 45px;
    display: flex;
    align-items: center;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .tasbih-title {
    color: var(--tasbih-secondary) !important;
}

/* Button & Ring */
.tasbih-button-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    cursor: pointer;
    margin-bottom: 20px;
    border-radius: 50%;
}

.tasbih-progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.tasbih-progress-ring-bg {
    fill: transparent;
    stroke: rgba(var(--tasbih-color), 0.1);
    stroke-width: 6;
}

.tasbih-progress-ring-value {
    fill: transparent;
    stroke: var(--tasbih-color);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease-out;
    filter: drop-shadow(0 0 2px var(--tasbih-secondary));
}

.tasbih-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    border-radius: 50%;
    border: none;
    color: white;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.tasbih-count {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
}

.tasbih-target {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 5px;
}

.tasbih-btn:active,
.tasbih-btn.pressed {
    transform: scale(0.92);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2), inset 0 4px 8px rgba(0, 0, 0, 0.3);
    background: linear-gradient(145deg, var(--tasbih-secondary), var(--tasbih-color)) !important;
}

/* Action Buttons */
.tasbih-reset-btn {
    position: relative;
}

.tasbih-reset-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tasbih-reset-btn:hover::before {
    opacity: 1;
    bottom: 135%;
}

.tasbih-reset-btn {
    background: rgba(0, 0, 0, 0.05);
    /* Avoid rgba with var in CSS for simplicity here */
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

[data-theme="dark"] .tasbih-reset-btn {
    background: rgba(255, 255, 255, 0.08);
}

.tasbih-reset-btn:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.tasbih-reset-btn i {
    z-index: 2;
    transition: transform 0.2s;
}

/* Long press progress ring */
.tasbih-reset-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid #e74c3c;
    border-radius: 50%;
    clip-path: circle(0% at 50% 50%);
    opacity: 0;
    transition: clip-path 0.8s linear, opacity 0.2s;
    z-index: 1;
}

.tasbih-reset-btn.is-holding::after {
    clip-path: circle(100% at 50% 50%);
    opacity: 1;
}

.tasbih-reset-btn.is-holding i {
    transform: rotate(-180deg) scale(0.8);
    color: #e74c3c;
}

.tasbih-reset-btn.is-completed {
    background: #e74c3c !important;
    color: white !important;
    transform: scale(1.1);
}

/* Discovery Pulse Animation */
.tasbih-reset-btn.pulse-discovery {
    animation: reset-pulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
}

@keyframes reset-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

/* Hint Banner */
.tasbih-hint-banner {
    background: rgba(var(--accent-rgb, 52, 152, 219), 0.1);
    border-radius: 10px;
    padding: 10px 15px;
    margin: 10px 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-right: 3px solid var(--accent-color);
}

.tasbih-hint-banner i.fa-lightbulb {
    color: #f1c40f;
    font-size: 1.1rem;
}

.tasbih-hint-banner i.fa-undo {
    font-size: 0.8rem;
    margin: 0 4px;
    opacity: 0.8;
}

/* Top actions row (settings + fullscreen) */
.tasbih-card-top-actions {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2;
}

.tasbih-settings-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.6;
    padding: 4px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tasbih-settings-btn:hover {
    color: var(--tasbih-color);
    opacity: 1;
    transform: rotate(90deg);
}

.tasbih-fullscreen-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.5;
    padding: 4px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tasbih-fullscreen-btn:hover,
.tasbih-fullscreen-btn:active {
    opacity: 1;
    color: var(--tasbih-secondary, #2ecc71);
    transform: scale(1.2);
}

/* ── Tasbih Fullscreen Overlay ── */
#tasbih-fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0d1117;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

#tasbih-fullscreen-overlay.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

.tfs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tfs-title {
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    color: #e8e8e8;
    text-align: center;
    flex: 1;
}

.tfs-close-btn,
.tfs-reset-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #ccc;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    flex-shrink: 0;
}

.tfs-close-btn:hover,
.tfs-reset-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.tfs-reset-btn.is-holding {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    animation: pulse-hold 0.8s linear forwards;
}

.tfs-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Garder le bouton centré */
    position: relative;
    padding: 20px;
}

.tfs-hadith {
    position: absolute;
    top: 30px;
    /* Fixé en haut du corps */
    font-family: var(--font-main);
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
    max-width: 85%;
    line-height: 1.6;
    font-size: 1.25rem;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    user-select: none;
    direction: rtl;
    z-index: 10;
}

@media (max-height: 600px) {
    .tfs-hadith {
        font-size: 1rem;
        max-width: 100%;
        margin-bottom: 5px;
    }

    .tfs-body {
        gap: 10px;
    }
}

/* Giant tap button for fullscreen mode */
.tfs-tap-btn {
    position: relative;
    z-index: 2;
    width: min(75vw, 75vh, 340px);
    height: min(75vw, 75vh, 340px);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(255, 255, 255, 0.08);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

.tfs-tap-btn:active,
.tfs-tap-btn.tfs-pressed {
    transform: scale(0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 6px rgba(255, 255, 255, 0.15);
}

.tfs-count {
    font-size: clamp(3rem, 15vw, 6rem);
    font-weight: 800;
    color: white;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.tfs-target {
    font-size: clamp(1rem, 5vw, 1.6rem);
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

/* Progress ring behind the button */
.tfs-ring {
    position: absolute;
    width: calc(min(75vw, 75vh, 340px) + 24px);
    height: calc(min(75vw, 75vh, 340px) + 24px);
    z-index: 1;
}

.tfs-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.07);
    stroke-width: 6;
}

.tfs-ring-val {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 100px 100px;
    transition: stroke-dashoffset 0.3s ease;
}

@keyframes pulse-hold {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Footer Actions (Reset + Vib + Sound) */
.tasbih-footer-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    margin-top: 10px;
}

.tasbih-mini-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #9ca3af;
    font-size: 0.9rem;
}

[data-theme="dark"] .tasbih-mini-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.tasbih-mini-btn:hover {
    background: rgba(var(--tasbih-color), 0.1);
    transform: scale(1.1);
}

.tasbih-mini-btn.active {
    background: var(--tasbih-color);
    color: white;
    border-color: var(--tasbih-color);
    box-shadow: 0 2px 8px rgba(var(--tasbih-color), 0.3);
}

.tasbih-mini-btn i {
    pointer-events: none;
}

/* Compact Sound Selector */
.compact-sound-item {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.compact-sound-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.compact-sound-item span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.2s;
    color: #444;
}

.compact-sound-item input:checked+span {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.compact-sound-item span i {
    font-size: 0.7rem;
    opacity: 0.7;
}

[data-theme="dark"] .compact-sound-item span {
    background: #333;
    border-color: #444;
    color: #eee;
}


/* Mobile Focus Mode (One per line) */
@media (max-width: 600px) {
    .tasbih-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 0 10px;
    }

    .tasbih-card {
        padding: 40px 20px;
    }

    .tasbih-button-wrapper {
        width: 180px;
        /* Bigger for better focus */
        height: 180px;
    }

    .tasbih-count {
        font-size: 3rem;
    }

    .tasbih-title {
        font-size: 1.4rem;
    }
}

/* Tasbih Color Picker */
.tasbih-color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 5px;
}

.color-option {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px white inset;
}

.tasbih-subtabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    padding-bottom: 10px;
    justify-content: center;
    flex-wrap: wrap;
}


@media (max-width: 600px) {
    .tasbih-subtabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        justify-content: stretch;
        padding: 0 2px;
    }

    .tasbih-subtab-btn {
        padding: 12px 5px !important;
        font-size: 0.95rem !important;
        width: 100% !important;
        margin: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }
}

.tasbih-subtab-btn {
    border: 2px solid rgba(0, 0, 0, 0.15) !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    transition: all 0.3s ease;
}

.tasbih-subtab-btn.btn-primary {
    border-color: var(--primary-color) !important;
    box-shadow: 0 4px 10px rgba(27, 77, 62, 0.2);
}

.tasbih-subtab-btn.btn-secondary {
    background: white !important;
    color: var(--text-primary) !important;
    border-color: #ddd !important;
}

.tasbih-subtab-btn.btn-secondary:hover {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

/* =========================================================================
   ADHKAR CARDS STYLES
========================================================================= */

.adhkar-card {
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .adhkar-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.adhkar-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.adhkar-card:active {
    transform: scale(0.98);
}

.adhkar-card.done {
    opacity: 0.6;
    background: rgba(46, 204, 113, 0.05);
    border-color: rgba(46, 204, 113, 0.2);
}

.adhkar-text {
    font-size: 1.4rem;
    line-height: 1.9;
    color: var(--text-primary);
    margin-bottom: 25px;
    font-family: 'Amiri', serif;
    text-align: center;
    font-weight: 500;
}

.adhkar-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 15px;
}

[data-theme="dark"] .adhkar-footer {
    border-top-color: rgba(255, 255, 255, 0.05);
}

.adhkar-count-badge {
    background: var(--primary-color);
    color: white;
    padding: 6px 18px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1rem;
    min-width: 85px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.adhkar-card.done .adhkar-count-badge {
    background: #2ecc71;
}

.adhkar-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .adhkar-progress-bar {
    background: rgba(255, 255, 255, 0.05);
}

.adhkar-progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.adhkar-card.done .adhkar-progress-fill {
    background: #2ecc71;
}

/* Fasting Tracker → see css/fasting.css */
/* Chat Widget -> see css/chat.css */
/* Chat Reactions -> see css/chat.css */
/* Fasting Tracker -> see css/fasting.css */

/* --- Personal Khatma Responsive Header --- */
.pk-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

[data-theme="dark"] .pk-card-header {
    border-bottom-color: #333;
}

@media (max-width: 576px) {
    .pk-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .pk-card-header .progress-container {
        width: 100% !important;
        max-width: none !important;
    }
}

/* --- Personal Khatma Tabs Navigation --- */
.pk-nav-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 75px;
    z-index: 100;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 14px;
    border-radius: 14px;
}

[data-theme="dark"] .pk-nav-bar {
    background: rgba(26, 31, 54, 0.9);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.pk-nav-btn {
    font-family: var(--font-main);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.9rem;
    border: 1px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pk-nav-btn:hover {
    background: var(--primary-color);
    color: white;
}

[data-theme="dark"] .pk-nav-btn {
    background: var(--bg-color);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

[data-theme="dark"] .pk-nav-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pk-nav-btn.active {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.pk-nav-progress {
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
    transition: all 0.3s ease;
    display: inline-block;
    min-width: 38px;
    text-align: center;
}

[data-theme="dark"] .pk-nav-progress {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* When btn is active or hovered, invert the progress colors for maximum visibility */
.pk-nav-btn.active .pk-nav-progress,
.pk-nav-btn:hover .pk-nav-progress {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .pk-nav-btn.active .pk-nav-progress,
[data-theme="dark"] .pk-nav-btn:hover .pk-nav-progress {
    background: var(--bg-color);
    color: white;
}

.pk-panel {
    transition: opacity 0.3s ease, margin-top 0.3s ease;
}

.pk-panel-hidden {
    display: none !important;
}

@keyframes pk-panel-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Adhkar Info Button */
.adhkar-info-btn {
    position: absolute;
    bottom: 77px;
    left: 15px;
    background: rgba(27, 77, 62, 0.1);
    color: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
    font-size: 1.1rem;
}

.adhkar-info-btn:hover {
    background: var(--primary-color);
    color: white;
}

[data-theme="dark"] .adhkar-info-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
}

[data-theme="dark"] .adhkar-info-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}