/* =====================
   Adhan System - Main Styles
   ===================== */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    max-width: 100%;
}

/*
 * Legacy :root variables MOVED to design-tokens.css.
 * Every template now loads design-tokens.css BEFORE main.css.
 * This keeps the whole-app palette (light + dark) controlled from one place.
 * The old names (--primary, --gold, --radius, ...) still resolve — they are
 * remapped in the legacy compatibility layer at the bottom of design-tokens.css.
 */
:root {
    --radius-lg: 20px;       /* local override retained — keeps hero card radius */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Direction is controlled by html[dir] attribute set by JavaScript */
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

html[dir="ltr"] body {
    direction: ltr;
    text-align: left;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    min-width: 0;
}

/* Header */
.app-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    font-family: var(--font-sans);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    gap: 12px;
}

.header-leading {
    display: none;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-shrink: 0;
    margin-inline-start: auto;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.logo-icon {
    font-size: 28px;
}

.logo-img {
    height: 36px;
    width: auto;
    object-fit: contain;
}

/* Brand Logo Image */
.brand-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-menu {
    display: flex;
    gap: 5px;
}

.nav-item {
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--radius);
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--gold);
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--content-pad, 20px);
    width: 100%;
    min-width: 0;
    overflow-x: clip;
    box-sizing: border-box;
}

/* Page wrappers that manage their own horizontal inset */
.main-content.home-v2 {
    padding: 0;
}

/* Mosque Bar */
.mosque-bar {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border-radius: var(--radius);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    margin-bottom: 25px;
}

.mosque-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mosque-icon {
    font-size: 24px;
}

.mosque-name {
    font-size: 18px;
    font-weight: 600;
}

.hijri-date {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
}

/* Next Prayer Card */
.next-prayer-section {
    margin-bottom: 30px;
}

.next-prayer-card {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
}

.next-prayer-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.next-prayer-name {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 5px;
}

.next-prayer-time {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 15px;
}

.countdown {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    font-size: 28px;
    font-weight: 600;
    font-family: monospace;
}

.countdown-value {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 15px;
    border-radius: 8px;
    min-width: 60px;
}

.countdown-separator {
    opacity: 0.7;
}

/* Section Title */
.section-title {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Prayer Times Grid */
.prayer-times-section {
    margin-bottom: 30px;
}

.prayer-times-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

.prayer-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    animation: fadeInUp 0.5s ease both;
}

.prayer-card:nth-child(1) {
    animation-delay: 0.05s;
}

.prayer-card:nth-child(2) {
    animation-delay: 0.1s;
}

.prayer-card:nth-child(3) {
    animation-delay: 0.15s;
}

.prayer-card:nth-child(4) {
    animation-delay: 0.2s;
}

.prayer-card:nth-child(5) {
    animation-delay: 0.25s;
}

.prayer-card:nth-child(6) {
    animation-delay: 0.3s;
}

.prayer-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.prayer-card.active {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: white;
}

.prayer-card.passed {
    opacity: 0.6;
}

.prayer-icon {
    font-size: 30px;
    display: block;
    margin-bottom: 10px;
}

.prayer-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.prayer-time {
    display: block;
    font-size: 20px;
    font-weight: 700;
}

/* Events Section */
.events-section {
    margin-bottom: 30px;
}

.events-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.event-item {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
    min-width: 250px;
    flex-shrink: 0;
}

.event-icon {
    font-size: 30px;
}

.event-name {
    font-weight: 600;
    flex: 1;
}

.event-countdown {
    color: var(--primary);
    font-weight: 500;
    font-size: 14px;
}

/* Lucide Icons */
.icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
    vertical-align: middle;
}

.section-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.nav-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-left: 5px;
}

.prayer-icon .icon {
    width: 32px;
    height: 32px;
    color: var(--gold);
}

.prayer-card.active .prayer-icon .icon {
    color: white;
}

.event-icon .icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

/* Events Improved Layout */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.events-more {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-item {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeInUp 0.5s ease both;
}

.event-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Show More Button */
.show-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    margin-top: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.show-more-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.show-more-btn .icon {
    width: 18px;
    height: 18px;
}

/* Speakers Section */
.speakers-section {
    margin-bottom: 30px;
}

.speakers-count {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 14px;
}

.speakers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.speaker-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
}

.speaker-icon {
    font-size: 36px;
}

.speaker-info {
    flex: 1;
}

.speaker-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.speaker-status {
    font-size: 12px;
    color: var(--text-light);
}

.speaker-status.connected {
    color: var(--success);
}

/* ==================
   Home Speaker Cards (Gold/Brown Premium Theme)
   ================== */
.home-speaker-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.home-speaker-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.home-speaker-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}

.home-speaker-card:hover::before {
    opacity: 1;
}

.home-speaker-card.online {
    border-color: var(--primary-light);
}

.home-speaker-card.online::before {
    opacity: 1;
    background: linear-gradient(180deg, var(--gold), var(--success));
}

.home-speaker-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.home-speaker-icon i {
    width: 22px;
    height: 22px;
    color: var(--gold);
}

.home-speaker-details {
    flex: 1;
    min-width: 0;
}

.home-speaker-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-speaker-status {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 5px;
}

.home-speaker-card.online .home-speaker-status {
    color: var(--success);
}

.home-speaker-card.online .home-speaker-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.no-speakers {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    color: var(--text-light);
}

.no-speakers .placeholder-icon {
    font-size: 50px;
    display: block;
    margin-bottom: 15px;
}

.add-speaker-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 25px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.add-speaker-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ==================
   Modern Buttons
   ================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--brand-teal);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--brand-teal-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-surface-alt);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--color-surface-sunken);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

.btn-danger:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-success:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn:active {
    transform: translateY(0);
}

/* ==================
   Modern Modals
   ================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 32px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    opacity: 0;
    animation: modalIn 0.3s forwards;
}

@keyframes modalIn {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content h3 {
    font-size: 22px;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.modal-content h3 .icon {
    width: 28px;
    height: 28px;
}

.modal-content h3 .icon.warning {
    color: var(--warning);
}

.modal-content h3 .icon.success {
    color: var(--success);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-primary);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s ease;
    min-width: 280px;
}

.toast.success {
    border-inline-start: 4px solid var(--success);
}

.toast.error {
    border-inline-start: 4px solid var(--error);
}

.toast.info {
    border-inline-start: 4px solid var(--primary);
}

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

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

.toast .icon {
    width: 24px;
    height: 24px;
}

.toast.success .icon {
    color: var(--success);
}

.toast.error .icon {
    color: var(--error);
}

/* Footer */
.app-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.25rem 1.25rem;
    color: var(--text-light);
    font-size: 0.8125rem;
    margin-top: auto;
}

.app-footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.app-footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.5rem;
}

.app-footer-links a {
    color: var(--text-secondary, var(--text-light));
    text-decoration: none;
    transition: color 0.15s ease;
}

.app-footer-links a:hover {
    color: var(--gold, var(--brand-teal));
    text-decoration: underline;
}

.app-footer-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.5rem;
    margin: 0;
    color: var(--text-light);
    font-size: 0.75rem;
}

.app-footer-dot {
    opacity: 0.45;
    user-select: none;
}

.app-footer-brand {
    font-weight: 500;
    color: var(--text-secondary, var(--text-light));
}

/* Legal pages */
.legal-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg, var(--bg-primary));
    color: var(--color-text, inherit);
    font-family: var(--font-sans, 'IBM Plex Sans Arabic', sans-serif);
}

.legal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-primary);
}

.legal-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    font-weight: 600;
}

.legal-logo {
    height: 28px;
    width: auto;
}

.legal-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legal-main {
    flex: 1;
    padding: 2rem 1.25rem 3rem;
}

.legal-doc {
    max-width: 720px;
    margin: 0 auto;
}

.legal-doc-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.legal-doc-header h1 {
    font-size: 1.75rem;
    margin: 0 0 0.5rem;
    color: var(--text-primary, inherit);
}

.legal-updated {
    margin: 0;
    color: var(--text-light);
    font-size: 0.875rem;
}

.legal-section {
    margin-bottom: 1.5rem;
}

.legal-section h2 {
    font-size: 1.05rem;
    margin: 0 0 0.5rem;
    color: var(--text-primary, inherit);
}

.legal-section p {
    margin: 0;
    line-height: 1.75;
    color: var(--text-secondary, inherit);
    white-space: pre-line;
}

.legal-footer {
    margin-top: auto;
}

.auth-legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
}

.auth-legal-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.auth-legal-links a:hover {
    color: var(--gold, var(--brand-teal));
    text-decoration: underline;
}

/* ==================
   Page-Load Animations
   ================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.mosque-bar {
    animation: fadeInUp 0.4s ease;
}

.section-title {
    animation: fadeIn 0.5s ease;
}

.speakers-grid {
    animation: fadeIn 0.6s ease 0.3s both;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Countdown pulse */
.countdown-value {
    transition: transform 0.3s ease;
}

.countdown-value.tick {
    animation: countdownTick 0.3s ease;
}

@keyframes countdownTick {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 900px) {
    .prayer-times-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==================
   Hamburger Menu Button (hidden on desktop)
   ================== */
.hamburger-btn {
    display: flex;
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.hamburger-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.hamburger-btn i {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .app-header {
        padding: 10px 0;
    }

    .header-content {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        grid-template-areas:
            "leading logo actions"
            "nav nav nav";
        column-gap: 8px;
        row-gap: 0;
        align-items: center;
        padding: 0 12px;
    }

    .header-leading {
        display: flex;
        grid-area: leading;
        justify-self: start;
        align-items: center;
    }

    .logo {
        grid-area: logo;
        flex: unset;
        min-width: 0;
        justify-self: center;
        justify-content: center;
    }

    .logo-img {
        height: 32px;
        max-width: min(140px, 42vw);
    }

    .logo-text {
        font-size: 17px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .logo-icon i {
        width: 22px !important;
        height: 22px !important;
    }

    .brand-logo {
        height: 24px;
    }

    .hamburger-btn {
        position: relative;
        z-index: 101;
    }

    .header-actions {
        grid-area: actions;
        justify-self: end;
        margin-inline-start: 0;
        gap: 6px;
    }

    .user-menu {
        flex: 0 0 auto;
    }

    .app-header .theme-toggle {
        margin-inline-start: 0;
    }

    .nav-menu {
        display: none;
        grid-area: nav;
        width: 100%;
        flex-direction: column;
        gap: 4px;
        padding-top: 12px;
        border-top: 1px solid var(--border-light);
        margin-top: 12px;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-item {
        padding: 12px 16px;
        font-size: 15px;
        border-radius: 10px;
        width: 100%;
        min-height: 48px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .main-content {
        --content-pad: 12px;
        padding: var(--content-pad);
    }

    .main-content.home-v2 {
        padding: 0;
    }

    .mosque-bar {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 12px 16px;
    }

    .mosque-name {
        font-size: 15px;
    }

    .hijri-date {
        font-size: 13px;
    }

    .prayer-times-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .next-prayer-card {
        padding: 20px;
    }

    .next-prayer-name {
        font-size: 24px;
    }

    .next-prayer-time {
        font-size: 32px;
    }

    .countdown {
        gap: 4px;
    }

    .countdown-value {
        font-size: 18px;
        min-width: 36px;
    }

    .section-title {
        font-size: 16px;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .page-title {
        font-size: 18px;
    }

    /* Speaker grid on home */
    .speakers-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        padding: 24px 20px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

/* User Profile in Header */
/* ==================
   User Menu (Icon + Dropdown)
   ================== */
.user-menu {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    min-width: 0;
}

@media (max-width: 768px) {
    .user-avatar-btn,
    .user-login-btn {
        width: 44px;
        height: 44px;
    }

    .user-dropdown {
        z-index: 1100;
    }
}

.user-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.user-avatar-btn:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-md);
}

.user-avatar-initial {
    line-height: 1;
}

.user-login-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
}

.user-login-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.user-login-btn i {
    width: 18px;
    height: 18px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 220px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.2s ease;
    z-index: var(--z-dropdown);
    overflow: hidden;
}

html[dir="rtl"] .user-dropdown {
    left: auto;
    right: 0;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--color-surface-alt);
}

.user-dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-dropdown-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-email {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.88rem;
    font-family: inherit;
    transition: all 0.15s;
    text-align: left;
}

html[dir="rtl"] .user-dropdown-item {
    text-align: right;
}

.user-dropdown-item:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.user-dropdown-item i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.user-dropdown-logout:hover {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}