/* ========================================================= */
/* style.css - Updated for Inline Buttons & Colors */
/* ========================================================= */

:root {
    --primary-color: #0369a1; /* Default Blue */
    --secondary-color: #0369a1;
    --text-color: #1e293b;
    --card-bg: rgba(255, 255, 255, 0.25);
    --card-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --bg-gradient: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    --font-scale: 1.0; /* For user adjustment */
}

/* --- Dark Themes (Row 1) --- */
:root.theme-blue {
    --secondary-color: #0369a1;
    --bg-gradient: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
}
:root.theme-orange {
    --secondary-color: #f97316;
    --bg-gradient: linear-gradient(135deg, #ffedd5 0%, #fdba74 100%);
}
:root.theme-cyan {
    --secondary-color: #06b6d4;
    --bg-gradient: linear-gradient(135deg, #cffafe 0%, #67e8f9 100%);
}
:root.theme-teal {
    --secondary-color: #14b8a6;
    --bg-gradient: linear-gradient(135deg, #ccfbf1 0%, #5eead4 100%);
}
:root.theme-green {
    --secondary-color: #22c55e;
    --bg-gradient: linear-gradient(135deg, #dcfce7 0%, #86efac 100%);
}
:root.theme-red {
    --secondary-color: #ef4444;
    --bg-gradient: linear-gradient(135deg, #fee2e2 0%, #fca5a5 100%);
}
:root.theme-purple {
    --secondary-color: #a855f7;
    --bg-gradient: linear-gradient(135deg, #f3e8ff 0%, #d8b4fe 100%);
}
:root.theme-pink {
    --secondary-color: #ec4899;
    --bg-gradient: linear-gradient(135deg, #fce7f3 0%, #f9a8d4 100%);
}
:root.theme-emerald {
    --secondary-color: #10b981;
    --bg-gradient: linear-gradient(135deg, #d1fae5 0%, #6ee7b7 100%);
}
:root.theme-sky {
    --secondary-color: #0ea5e9;
    --bg-gradient: linear-gradient(135deg, #e0f2fe 0%, #7dd3fc 100%);
}
:root.theme-gold {
    --secondary-color: #d97706;
    --bg-gradient: linear-gradient(135deg, #fef3c7 0%, #fcd34d 100%);
}

/* --- Light Themes (Row 2) --- */
:root.theme-white {
    --secondary-color: #64748b;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}
:root.theme-coral {
    --secondary-color: #fb7185;
    --bg-gradient: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%);
}
:root.theme-grey {
    --secondary-color: #94a3b8;
    --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
}
:root.theme-yellow {
    --secondary-color: #facc15;
    --bg-gradient: linear-gradient(135deg, #fefce8 0%, #fef08a 100%);
}
:root.theme-rose {
    --secondary-color: #f43f5e;
    --bg-gradient: linear-gradient(135deg, #fff1f2 0%, #fda4af 100%);
}
:root.theme-azure {
    --secondary-color: #38bdf8;
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #bae6fd 100%);
}
:root.theme-amber {
    --secondary-color: #f59e0b;
    --bg-gradient: linear-gradient(135deg, #fffbeb 0%, #fde68a 100%);
}
:root.theme-peach {
    --secondary-color: #fb923c;
    --bg-gradient: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
}
:root.theme-mint {
    --secondary-color: #2dd4bf;
    --bg-gradient: linear-gradient(135deg, #f0fdfa 0%, #99f6e4 100%);
}
:root.theme-royal {
    --secondary-color: #6366f1;
    --bg-gradient: linear-gradient(135deg, #eef2ff 0%, #c7d2fe 100%);
}

html {
    font-size: calc(16px * var(--font-scale));
    height: 100%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100%;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px;
}

/* Pseudo element for stable background on Android keyboards */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-gradient);
    transition: background 0.5s ease;
    z-index: -1;
}

[lang="ur"] body, [lang="ur"] .amiri-font, [lang="ur"] .urdu-font, [lang="ur"] .btn-option, [lang="ur"] .search-box button, [lang="ur"] .calendar-select, [lang="ur"] .action-btn, [lang="ur"] .today-btn, [lang="ur"] .qibla-btn-wrapper, [lang="ur"] .qibla-info {
    font-family: 'Jameel Noori Nastaleeq', 'Amiri', serif;
    letter-spacing: 0;
    line-height: 1.6;
}

[lang="ar"] body, [lang="ar"] .amiri-font, [lang="ar"] .arabic-font, [lang="ar"] .btn-option, [lang="ar"] .search-box button, [lang="ar"] .calendar-select, [lang="ar"] .action-btn, [lang="ar"] .today-btn, [lang="ar"] .qibla-btn-wrapper, [lang="ar"] .qibla-info {
    font-family: 'Naskh Musaad', 'Amiri', serif;
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 850px;
    margin: auto; /* Handles vertical centering elegantly */
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: var(--glass-shadow);
    position: relative;
    z-index: 1; /* keep above body pseudo background */
}

/* ========================================================= */
/* Header & Fixed Controls (CSS Grid Layout) */
/* ========================================================= */
header {
    text-align: center;
    margin-bottom: 15px;
}

/* Brand Header Layout */
.brand-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap; 
    gap: 15px;
    width: 100%;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-logo {
    width: 110px; 
    height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
    border-radius: 50%;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: start;
}

.brand-text h1 {
    margin: 0;
    font-size: 2.2rem;
    line-height: 1.2;
}

.brand-text p {
    margin: 5px 0 0 0;
    font-size: 1rem;
    opacity: 0.9;
}

.brand-actions {
    display: flex;
    align-items: center;
}

@media (max-width: 600px) {
    .brand-header-row {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        gap: 20px;
    }
    .brand-section {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .brand-text {
        align-items: center;
        text-align: center;
    }
    .brand-logo {
        width: 80px;
        height: 80px;
    }
    .brand-text h1 {
        font-size: 1.8rem;
    }
}

/* ========================================================= */
/* Joined Button Group (Language & Angle Switchers) */
/* ========================================================= */
.btn-group {
    display: inline-flex;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 8px rgba(0,0,0,0.07);
}

.btn-option {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-color);
    border: none;
    border-inline-start: 1px solid var(--card-border);
    padding: 2px 14px !important;
    cursor: pointer;
    font-family: 'Amiri', serif;
    font-size: 0.95rem;
    font-weight: bold;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    min-width: 40px;
    height: fit-content;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: normal !important;
}

.btn-option:first-child {
    border-inline-start: none;
}

.btn-option:hover:not(.active) {
    background: rgba(255, 255, 255, 0.9);
}

.btn-option.active {
    background: var(--secondary-color);
    color: #ffffff;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.25);
}


/* ========================================================= */
/* View Switcher (Icon Only) */
/* ========================================================= */
.view-switcher {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

/* Right Control Group: Audio + Filter Buttons together */
.right-control-group {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

/* --- Font Size Control --- */
.font-size-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.6);
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#fontSizeSlider {
    width: 60px;
    cursor: pointer;
    accent-color: var(--secondary-color);
}

/* ========================================================= */
/* Theme Switcher Styles */
/* ========================================================= */
.theme-switcher {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.25);
    padding: 8px 10px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    margin: 0 auto 20px auto;
    width: fit-content;
    max-width: 100%;
}

.theme-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    border: 1.5px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.theme-circle:hover {
    transform: scale(1.3) translateY(-1px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.25);
}

.theme-circle.active {
    transform: scale(1.2);
    outline: 1.5px solid var(--secondary-color);
    outline-offset: 2.5px;
    box-shadow: 0 0 10px var(--secondary-color);
}

/* Theme Circle Colors - Dark Row */
.theme-circle.blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.theme-circle.orange { background: linear-gradient(135deg, #f97316, #c2410c); }
.theme-circle.cyan   { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.theme-circle.teal   { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.theme-circle.green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.theme-circle.red    { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.theme-circle.purple { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.theme-circle.pink   { background: linear-gradient(135deg, #ec4899, #be185d); }
.theme-circle.emerald { background: linear-gradient(135deg, #10b981, #047857); }
.theme-circle.sky    { background: linear-gradient(135deg, #0ea5e9, #0369a1); }
.theme-circle.gold   { background: linear-gradient(135deg, #fac115, #b45309); }

/* Theme Circle Colors - Light Row */
.theme-circle.white  { background: linear-gradient(135deg, #f8fafc, #cbd5e1); }
.theme-circle.coral  { background: linear-gradient(135deg, #fb7185, #f43f5e); }
.theme-circle.grey   { background: linear-gradient(135deg, #94a3b8, #475569); }
.theme-circle.yellow { background: linear-gradient(135deg, #facc15, #eab308); }
.theme-circle.rose   { background: linear-gradient(135deg, #f43f5e, #be123c); }
.theme-circle.azure  { background: linear-gradient(135deg, #38bdf8, #0284c7); }
.theme-circle.amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.theme-circle.peach  { background: linear-gradient(135deg, #fb923c, #ea580c); }
.theme-circle.mint   { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.theme-circle.royal  { background: linear-gradient(135deg, #6366f1, #4338ca); }

#helpBtn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #0369a1;
}

.view-switcher button, .angle-switch-btn {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-color);
    border: 1px solid var(--card-border);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-switcher button:hover, .angle-switch-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.view-switcher button {
    width: 30px;
    height: 30px;
    padding: 0;
}

/* آواز والا بٹن — فلٹر بٹنز کے ہم قد */
.audio-toggle-btn {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-color);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 2px 12px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    line-height: normal;
}

.audio-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

/* آواز بند ہونے پر بٹن سرخ رنگ میں */
.audio-toggle-btn.muted {
    background: rgba(220, 38, 38, 0.15) !important;
    color: #dc2626 !important;
    border-color: rgba(220, 38, 38, 0.4) !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2) !important;
}

.audio-toggle-btn.muted:hover {
    background: rgba(220, 38, 38, 0.25) !important;
    transform: translateY(-2px);
}


/* ========================================================= */
/* Typography & Other Elements */
/* ========================================================= */
h1 {
    font-size: 2.2rem;
    color: var(--secondary-color);
    margin-bottom: 5px;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
}

header p {
    font-family: inherit;
    color: #334155;
    font-size: 1.1rem;
}

.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}

/* --- City Autocomplete Wrapper --- */
.city-search-wrapper {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 2;
}

[dir="rtl"] .search-icon { right: 16px; }
[dir="ltr"] .search-icon { left: 16px; }

.city-search-wrapper input {
    width: 100%;
    padding: 4px 16px;
    line-height: normal !important;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.75);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

[dir="rtl"] .city-search-wrapper input { padding-right: 44px; }
[dir="ltr"] .city-search-wrapper input { padding-left: 44px; }

.city-search-wrapper input:focus {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.2);
    border-color: rgba(3, 105, 161, 0.4);
}

/* --- Date Input & Today Button --- */
.date-search-wrapper {
    width: 100%;
}

.date-input {
    flex: 1;
    padding: 4px 16px;
    line-height: normal !important;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.75);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    color: var(--text-color);
}

.date-input:focus {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.2);
    border-color: rgba(3, 105, 161, 0.4);
}

.today-btn {
    background: var(--secondary-color);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 4px 20px;
    line-height: normal !important;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.today-btn:hover {
    background: #0284c7;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* --- Live Dropdown --- */
.city-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(31, 38, 135, 0.15);
    z-index: 100;
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
    animation: dropIn 0.18s ease;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.city-dropdown-item {
    padding: 12px 18px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.15s ease;
}

.city-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.source-icon {
    font-size: 0.8rem;
    color: var(--secondary-color);
    opacity: 0.7;
    width: 14px;
    text-align: center;
}

.city-dropdown-item:last-child { border-bottom: none; }

.city-dropdown-item:hover, .city-dropdown-item.active {
    background: rgba(3, 105, 161, 0.08);
}

.city-dropdown-item .city-name {
    font-weight: 600;
    color: #0369a1;
}

.city-dropdown-item .country-name {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 1px;
    margin-inline-start: 24px; /* Align with name under the icon */
}

.city-dropdown-loading, .city-dropdown-empty {
    padding: 14px 18px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #94a3b8;
    text-align: center;
}

.search-box button {
    padding: 4px 16px;
    line-height: normal !important;
    border-radius: 12px;
    border: none;
    background: var(--secondary-color);
    color: white;
    cursor: pointer;
    font-family: 'Amiri', serif;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: #0284c7;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(3, 105, 161, 0.3);
}

.hidden {
    display: none !important;
}

.loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.error {
    color: #dc2626;
    background: rgba(254, 226, 226, 0.8);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
    border: 1px solid #f87171;
}

.location-header {
    text-align: center;
    margin-bottom: 25px;
}

.location-header h2 {
    font-size: 1.35rem; /* Reduced as requested */
    color: var(--secondary-color);
    font-family: inherit;
    margin-bottom: 5px;
    font-weight: 700;
}

.location-header p {
    color: #475569;
    font-weight: 500;
    margin-top: 5px;
}

/* --- ہجری فرق ڈراپ ڈاؤن --- */
.hijri-offset-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.hijri-offset-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 5px 32px 5px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
    cursor: pointer;
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transition: all 0.25s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230369a1' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    min-width: 130px;
    text-align: center;
}

[dir="rtl"] .hijri-offset-select {
    background-position: left 12px center;
    padding: 5px 16px 5px 32px;
}

[dir="ltr"] .hijri-offset-select {
    background-position: right 12px center;
    padding: 5px 32px 5px 16px;
}

.hijri-offset-select:hover {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--secondary-color);
}

.hijri-offset-select:focus {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.2);
    border-color: rgba(3, 105, 161, 0.5);
}


/* Responsive Coordinates Container */
.coordinates-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 1.05rem;
    color: #64748b;
    font-weight: normal;
    margin-top: 5px;
    align-items: center;
}

.coord-sep {
    opacity: 0.5;
}

.header-utility-bar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    flex-direction: row-reverse; /* Reverses order for RTL so Filter is Right, View is Left */
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    position: relative;
    z-index: 10;
}

@media (max-width: 650px) {
    .header-utility-bar {
        flex-direction: column;
    }
}

@media (max-width: 650px) {
    .coordinates-container {
        flex-direction: column;
        gap: 2px;
        align-items: center;
    }
    .coord-sep {
        display: none;
    }
    .location-header h2 {
        font-size: 1.25rem;
    }
}

/* ========================================================= */
/* Cards & Time Styling (Including Custom Colors) */
/* ========================================================= */
.times-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* ========================================================= */
/* Live Prayer Cards (Current & Next)                        */
/* ========================================================= */
.live-prayer-cards-container {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.live-card {
    flex: 1;
    min-width: 200px;
    max-width: 450px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.live-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.05));
    pointer-events: none;
}

.current-prayer-card {
    border-bottom: 4px solid var(--secondary-color);
    text-align: center;
    align-items: center;
}

.next-prayer-card {
    border-bottom: 4px solid color-mix(in srgb, var(--secondary-color), transparent 40%);
    text-align: center;
    align-items: center;
}

.live-card-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 6px;
}

.live-card-header h3 {
    font-size: 1rem;
    color: var(--secondary-color);
    opacity: 0.8;
    font-weight: 600;
    margin: 0;
}

.live-prayer-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--secondary-color);
    text-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.next-prayer-card .live-prayer-name {
    font-size: 1.5rem;
}

.live-main-time {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    align-items: center;
}

/* وقت آغاز (چھوٹے ہندسے) */
.live-time-val {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
    opacity: 0.75;
    letter-spacing: 0.02em;
    direction: ltr;
}

.live-time-val.small-time {
    font-size: 1.3rem;
    opacity: 0.8;
}

/* بقیہ وقت (بڑے ہندسے) */
.large-countdown {
    font-family: 'Inter', sans-serif;
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--secondary-color);
    letter-spacing: 0.04em;
    line-height: 1;
    direction: ltr;
    text-shadow: 0 2px 8px color-mix(in srgb, var(--secondary-color), transparent 60%);
    animation: pulseCountdown 2s ease-in-out infinite;
}

.next-countdown {
    font-size: 3rem;
    color: var(--secondary-color);
}

@keyframes pulseCountdown {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* تفصیلی سطریں (افضل وقت، مکروہ، اختتام) */
.live-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    padding-top: 10px;
    width: 100%;
}

.live-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.live-sub-times {
    display: flex;
    align-items: center;
    gap: 6px;
}

.end-time-rem {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary-color);
    opacity: 0.75;
    direction: ltr;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .live-prayer-cards-container {
        flex-direction: column;
    }
    .large-countdown {
        font-size: 2.1rem;
    }
    .next-countdown {
        font-size: 2.4rem;
    }
    .live-prayer-name {
        font-size: 1.2rem;
    }
}



.time-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-bottom: 4px solid color-mix(in srgb, var(--secondary-color), transparent 60%);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Filter Fardh Prayers Only */
#timesGrid.filter-fardh .time-card:not(.essential-prayer) {
    display: none;
}

/* Hide Extra Details and Qiyam Card in All Times View */
#timesGrid:not(.filter-fardh) .end-time-row,
#timesGrid:not(.filter-fardh) .qiyam-card {
    display: none !important;
}

.time-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.time-card h3 {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}

/* ڈیفالٹ ٹائم کلر (نیلا) */
.time-card .time {
    font-family: 'Inter', 'Amiri', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    direction: ltr;
    letter-spacing: -0.5px;
}

.end-time-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed rgba(255, 255, 255, 0.4);
    color: var(--secondary-color);
    filter: hue-rotate(180deg) saturate(1.5);
    font-weight: 600;
	direction: rtl;
}

[lang="en"] .end-time-row {
    direction: ltr;
}

.end-time-row .end-time {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}

/* Small Seconds and AM/PM specific style */
.time .ss-small, .time .ap-small {
    font-size: 0.65em;
    opacity: 0.8;
    margin-inline-start: 2px;
    font-weight: 500;
}

/* مخصوص رنگوں کی کلاسز (ہندسوں کا رنگ ہمیشہ تھیم والا ہی رہے گا لیکن امتیاز کے لیے گلو دیا جائے گا) */
.time-red, .time-black {
    color: var(--secondary-color) !important;
}

/* Glow Classes replaced with Outline/Borders */
.time-card.red-glow {
    border-bottom: 4px solid rgba(220, 38, 38, 0.8) !important;
    box-shadow: none !important;
}
.time-card.black-glow {
    border-bottom: 4px solid rgba(15, 23, 42, 0.8) !important;
    box-shadow: none !important;
}
.time-card.blue-glow {
    border-bottom: 4px solid #2563eb !important; /* Vibrant Blue */
    box-shadow: none !important;
}

.highlight-card {
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-bottom: 4px solid color-mix(in srgb, var(--secondary-color), transparent 60%);
}

.highlight-card h3 {
    color: var(--secondary-color);
    font-weight: 700;
}

.fardh-card h3 {
    color: var(--secondary-color);
}

/* ========================================================= */
/* List View Styles */
/* ========================================================= */
#prayer-times-container.list-view .times-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#prayer-times-container.list-view .time-card {
    flex-direction: row;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    text-align: right;
}

#prayer-times-container.list-view .time-card h3 {
    margin-bottom: 0;
    font-size: 1.4rem;
}

#prayer-times-container.list-view .time-card .time {
    margin-bottom: 0;
    font-size: 1.5rem;
}

@media (max-width: 650px) {
    .header-controls {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .language-switcher, #filterGroup {
        justify-self: center;
        width: auto;
    }
    .view-switcher {
        justify-self: center;
    }
}

/* ========================================================= */
/* Color Legend */
/* ========================================================= */
.color-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 15px;
    margin-top: 25px;
}

/* Hide legend in Fardh view */
#timesGrid.filter-fardh ~ .color-legend {
    display: none !important;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

.legend-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.legend-red   { background-color: rgba(220, 38, 38, 0.8); }
.legend-blue  { background-color: #2563eb; }
.legend-black { background-color: rgba(15, 23, 42, 0.8); }

/* ========================================================= */
/* Action Buttons (Copy & Print) */
/* ========================================================= */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
}

.action-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 6px 24px;
    line-height: normal !important;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 0 #024e77, 0 8px 15px rgba(0,0,0,0.1);
}

.action-btn:hover {
    transform: translateY(-2px);
    background: #0284c7;
    box-shadow: 0 6px 0 #024e77, 0 10px 20px rgba(0,0,0,0.15);
}

.action-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #024e77, 0 4px 8px rgba(0,0,0,0.1);
}

.action-btn i {
    font-size: 1rem;
}

/* ========================================================= */
/* Toast Notification */
/* ========================================================= */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    font-family: 'Amiri', serif;
    font-size: 1.1rem;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ========================================================= */
/* Calendar & Table View Styles */
/* ========================================================= */
.calendar-section {
    margin-top: 40px;
    border-top: 1px solid var(--card-border);
    padding-top: 30px;
}

.calendar-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
}

.calendar-select {
    padding: 4px 16px;
    line-height: normal !important;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.75);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    color: var(--text-color);
}

.calendar-select:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(3, 105, 161, 0.4);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    user-select: none;
}

.checkbox-container input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.download-btn {
    background: #16a34a !important; /* Green for Excel */
    box-shadow: 0 4px 0 #15803d, 0 8px 15px rgba(0,0,0,0.1) !important;
}

.download-btn:hover {
    background: #15803d !important;
    box-shadow: 0 6px 0 #166534, 0 10px 20px rgba(0,0,0,0.15) !important;
}

.download-btn:active {
    box-shadow: 0 2px 0 #166534, 0 4px 8px rgba(0,0,0,0.1) !important;
}

.table-container {
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    max-height: 600px;
    overflow-y: auto;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.prayer-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px; /* Force scroll on small screens */
    font-family: 'Inter', sans-serif;
    text-align: center;
}

.prayer-table th, .prayer-table td {
    padding: 12px 10px;
    border: 1px solid var(--card-border);
    white-space: nowrap;
}

.prayer-table thead th {
    background: var(--secondary-color);
    color: white;
    font-family: 'Amiri', serif;
    font-size: 1.1rem;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.prayer-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.4);
}

.prayer-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.8);
}

.prayer-table th:first-child, .prayer-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background: rgba(241, 245, 249, 0.95);
    font-weight: bold;
    color: var(--secondary-color);
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

[dir="rtl"] .prayer-table th:first-child, [dir="rtl"] .prayer-table td:first-child {
    left: auto;
    right: 0;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
}

.prayer-table thead th:first-child {
    z-index: 30;
    background: var(--secondary-color);
    color: white;
}

/* ========================================================= */
/* Print Styles */
/* ========================================================= */
@media print {
    body {
        background: white !important;
        padding: 0;
    }
    .container {
        box-shadow: none;
        border: none;
        width: 100%;
        max-width: none;
        padding: 0;
        background: transparent;
    }
    header, .search-section, .header-controls, .action-buttons, #loader, .view-switcher, .calendar-controls {
        display: none !important;
    }
    #prayer-times-container, #calendar-section {
        display: block !important;
    }
    .location-header h2 {
        color: black;
        margin-top: 20px;
    }
    .times-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        page-break-after: always;
    }
    .time-card {
        border: 1px solid #ddd !important;
        background: white !important;
        break-inside: avoid;
    }
    .time-card h3, .time-card .time {
        color: black !important;
    }
    
    .table-container {
        overflow: visible !important;
        max-height: none !important;
        background: white !important;
        border: none !important;
    }
    .prayer-table {
        min-width: 100% !important;
        width: 100% !important;
        font-size: 10pt;
    }
    .prayer-table th, .prayer-table td {
        border: 1px solid #000 !important;
        padding: 4px !important;
        white-space: normal !important;
        text-align: center !important;
        color: black !important;
    }
    .prayer-table thead th {
        background: #f0f0f0 !important;
        color: black !important;
        position: static !important;
    }
    .prayer-table th:first-child, .prayer-table td:first-child {
        position: static !important;
        background: transparent !important;
        box-shadow: none !important;
    }
}

/* ========================================================= */
/* New Notification Buttons & Footer */
/* ========================================================= */

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.btn-notify {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-notify:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.btn-notify.active-rooster {
    background: #f59e0b; /* Amber */
    color: white;
}

.btn-notify.active-adhan {
    background: #059669; /* Emerald */
    color: white;
}

#prayer-times-container.list-view .card-header {
    margin-bottom: 0;
    gap: 15px;
}

.app-footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--card-border);
    text-align: center;
}

.footer-sites {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.footer-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
    display: block;
    background: rgba(255, 255, 255, 0.05); /* Very subtle background for cohesive shape */
    padding: 2px;
}

.footer-logo.main-logo {
    height: 40px; /* Unify height */
}

.footer-logo:hover {
    transform: scale(1.15) translateY(-5px);
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.15));
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 25px;
}

.footer-social a {
    color: var(--text-color);
    font-size: 1.8rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.2s ease;
}

.footer-social a:hover {
    transform: translateY(-5px);
    color: var(--secondary-color);
}

/* ========================================================= */
/* Modals */
/* ========================================================= */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-gradient);
    width: 95%;
    max-width: 900px;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
    border: 1px solid var(--card-border);
}

.help-modal-box {
    padding-top: 50px;
    height: 90vh;
}

.modal-close {
    position: absolute;
    top: 5px;
    right: 15px;
    font-size: 2.2rem;
    cursor: pointer;
    color: var(--secondary-color);
    line-height: 1;
    z-index: 10000;
}

[dir="rtl"] .modal-close {
    right: auto;
    left: 15px;
}

/* ========================================================= */
/* Footer Credits */
/* ========================================================= */
.footer-credits {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    
    /* Full width spanning inside container */
    margin-left: -30px;
    margin-right: -30px;
    margin-bottom: -40px;
    
    background: var(--secondary-color);
    color: white;
    
    padding: 10px 30px;
    
    /* Matches container's radius */
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    
    font-size: 1rem;
}

.credit-right {
    text-align: right;
    font-weight: normal;
}

.credit-left {
    text-align: left;
    font-weight: normal;
}

[dir="rtl"] .credit-right { text-align: right; }
[dir="rtl"] .credit-left { text-align: left; }
[dir="ltr"] .credit-right { text-align: right; }
[dir="ltr"] .credit-left { text-align: left; }

@media (max-width: 600px) {
    .footer-credits {
        flex-direction: column;
        justify-content: center;
        gap: 8px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    .credit-right, .credit-left {
        text-align: center !important;
    }
}

@media (max-width: 480px) {
    .brand-actions {
        flex-direction: column;
        gap: 8px;
    }
}

/* ========================================================= */
/* Qibla Compass Styles */
/* ========================================================= */
.qibla-btn-wrapper {
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.qibla-btn-wrapper:hover {
    background: rgba(255,255,255,0.95);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.qibla-modal-box {
    max-width: 400px;
    padding: 30px 20px;
}

.compass-container {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.1), 0 10px 20px rgba(0,0,0,0.15);
    border: 5px solid white;
    display: flex;
    justify-content: center;
    align-items: center;
}

.compass-ring {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transition: transform 0.1s linear;
}

.compass-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -15px;
    margin-top: -15px;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    color: #475569;
    font-family: Arial, sans-serif;
    font-size: 1.1rem;
    z-index: 2;
}

.compass-center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: var(--secondary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 4;
}

.qibla-needle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    transition: transform 0.3s ease;
}

/* Crosshairs & Compass Rose */
.crosshair {
    position: absolute;
    background-color: var(--card-border);
    opacity: 0.4;
    transition: all 0.3s ease;
    z-index: 10;
}
.line-top {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 35px;
    opacity: 0.8; /* Top line is primary guide */
    border-radius: 4px;
}
.line-bottom {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 25px;
}
.line-left {
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 25px;
    height: 2px;
}
.line-right {
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 25px;
    height: 2px;
}

.compass-rose {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Below markings but above background */
    pointer-events: none;
}


