/* ===========================================================================
   WIRD REMINDER - LEGACY STYLES (App & Extension Only)
   =========================================================================== */

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

/* CSS VARIABLES */
:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.5rem;
    --quran-green: 142.1 76.2% 36.3%;
    --container-padding: 1.25rem;
    --section-gap: 1.5rem;
    --card-padding: 1rem;
    --card-gap: 0.75rem;
    --input-gap: 1rem;
    --header-padding: 1rem 1.25rem;
    --tabs-margin: 1rem 1.25rem 0.5rem;
}

/* Dark Mode Variables */
.dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 221.2 83.2% 53.3%;
    --quran-green: 142.1 70.6% 45.3%;
    --overlay: 210 40% 98%;
}

/* Dark Mode Scrollbar */
.dark *::-webkit-scrollbar-track {
    background: hsl(var(--background));
}

.dark *::-webkit-scrollbar-thumb {
    background-color: hsl(217.2 32.6% 25%);
    border: 2px solid hsl(var(--background));
}

.dark *::-webkit-scrollbar-thumb:hover {
    background-color: hsl(217.2 32.6% 35%);
}

/* Base Resets */
/* Extension context resets - scoped to app containers */
.app-container *, 
#reader-view *, 
.modal-overlay * {
    box-sizing: border-box;
    margin: 0;
}

body.is-app {
    height: 100vh;
    height: 100svh;
    width: 100%;
    overflow: hidden; /* Prevent viewport scroll */
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: 'Inter', 'Tajawal', sans-serif;
    direction: rtl;
    line-height: 1.5;
}

body.is-app .app-container,
body.is-app .reader-view {
    height: 100vh;
    height: 100svh;
}

/* ===========================================================================
   EXTENSION APP UI
   =========================================================================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    padding-top: env(safe-area-inset-top, 28px);
    overflow: hidden; /* Ensure flex children control their own scrolling */
}

/* Status bar background fill (edge-to-edge mode) */
.app-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 28px);
    background-color: hsl(var(--background));
    z-index: 9999;
    transition: background-color 0.3s ease;
}

.dark .app-container::before {
    background-color: #ffffff;
}

.app-container header {
    padding: var(--header-padding);
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: hsl(var(--foreground));
}

.app-container .logo-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-container .logo-area img {
    width: 24px;
    height: 24px;
}

/* Tabs - Modern Bottom Navbar */
.tabs-nav {
    display: none; /* We use .bottom-tabs which overrides or replaces this */
}

/* Bottom Navbar Styles */
.bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: calc(4.5rem + env(safe-area-inset-bottom));
  display: flex !important;
  align-items: center;
  justify-content: space-around;
  background-color: hsla(var(--background), 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid hsl(var(--border));
  padding-bottom: env(safe-area-inset-bottom);
  margin: 0;
  z-index: 100;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.tab-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
    padding: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    background: transparent;
    color: hsl(var(--muted-foreground));
    flex: 1;
    font-family: inherit;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.tab-trigger svg,
.tab-trigger i {
    width: 22px;
    height: 22px;
    padding: 2px;
    border-radius: 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-trigger.active {
    color: hsl(var(--quran-green));
    font-weight: 700;
}

.tab-trigger.active svg,
.tab-trigger.active i {
    background-color: hsla(var(--quran-green), 0.15);
    color: hsl(var(--quran-green));
    stroke: hsl(var(--quran-green));
    padding: 4px 12px;
    width: 48px; /* Pill width */
    height: 28px;
    font-size: 1.1rem;
}

.tab-trigger span {
    transition: transform 0.2s ease;
}

.tab-trigger.active span {
    transform: scale(1.05);
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: var(--container-padding);
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 16px));
    min-height: 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===========================================================================
   REMINDER CARD - EXACT copy from extension
   =========================================================================== */
.reminder-card {
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    padding: var(--card-padding);
    margin-bottom: var(--card-gap);
    display: flex;
    flex-direction: column;
    gap: var(--card-gap);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
}

.card-description {
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid hsl(var(--border));
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* ===========================================================================
   BUTTONS - EXACT copy from extension
   =========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
    height: 2rem;
    padding: 0 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid transparent;
    font-family: inherit;
}

.btn-primary {
    background-color: hsl(var(--quran-green));
    color: white;
}

.btn-primary:hover {
    background-color: hsl(var(--quran-green) / 0.9);
}

.btn-outline {
    border-color: hsl(var(--border));
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-ghost {
    background-color: transparent;
    color: hsl(var(--muted-foreground));
}

.btn-ghost:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-destructive {
    color: hsl(var(--destructive));
}

.btn-destructive:hover {
    background-color: hsl(var(--destructive) / 0.1);
}

.btn-xl {
    width: 100%;
    height: 2.5rem;
    font-size: 0.875rem;
}

.btn-lg {
    height: 2.5rem;
    padding: 0 1rem;
    font-size: 0.875rem;
}

/* ===========================================================================
   TOGGLE SWITCH - EXACT copy from extension
   =========================================================================== */
.switch {
    position: relative;
    display: inline-flex;
    height: 1.25rem;
    width: 2.25rem;
    flex-shrink: 0;
    cursor: pointer;
    align-items: center;
    border-radius: 9999px;
    border: 2px solid transparent;
    transition: background-color 0.2s;
    background-color: hsl(var(--input));
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.switch[aria-checked="true"] {
    background-color: hsl(var(--quran-green));
}

.switch-thumb {
    pointer-events: none;
    display: block;
    height: 1rem;
    width: 1rem;
    border-radius: 9999px;
    background-color: hsl(var(--background));
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
    transform: translateX(0);
}

.switch[aria-checked="true"] .switch-thumb {
    transform: translateX(1rem);
}

[dir="rtl"] .switch[aria-checked="true"] .switch-thumb {
    transform: translateX(-1rem);
}

/* ===========================================================================
   FORMS - EXACT copy from extension
   =========================================================================== */
.form-item {
    margin-bottom: var(--input-gap);
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: hsl(var(--foreground));
}

.input {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    color-scheme: light dark;
}

.input::placeholder {
    color: hsl(var(--muted-foreground));
    opacity: 1;
}

/* Select option styling for dark mode */
.dark .input option {
    background-color: hsl(222.2 84% 4.9%);
    color: hsl(210 40% 98%);
}

.input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.1);
}

.submit-area {
    margin-top: var(--section-gap);
}

/* ===========================================================================
   MISC COMPONENTS - EXACT copy from extension
   =========================================================================== */
.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
    margin: var(--section-gap) 0 var(--card-gap);
    letter-spacing: 0.05em;
}

.section-title:first-child {
    margin-top: 0;
}

.divider {
    height: 1px;
    background-color: hsl(var(--border));
    margin: var(--section-gap) 0;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.2;
}

.empty-state-text {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-description {
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.5rem;
}

.danger-zone .section-title {
    color: hsl(var(--destructive));
}

/* ===========================================================================
   CHECKBOX - EXACT copy from extension
   =========================================================================== */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    border-radius: calc(var(--radius) - 2px);
    border: 2px solid hsl(var(--input));
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox:hover {
    border-color: hsl(var(--quran-green));
}

.checkbox[aria-checked="true"] {
    background-color: hsl(var(--quran-green));
    border-color: hsl(var(--quran-green));
}

.checkbox-indicator {
    display: none;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1;
}

.checkbox[aria-checked="true"] .checkbox-indicator {
    display: block;
}

.checkbox-label {
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    transition: color 0.2s;
}

.checkbox-wrapper:hover .checkbox-label {
    color: hsl(var(--foreground));
}

.checkbox[aria-checked="true"]+.checkbox-label {
    color: hsl(var(--quran-green));
    font-weight: 500;
}

/* ===========================================================================
   MODAL - EXACT copy from extension
   =========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--container-padding);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
}

.modal-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }

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

/* ===========================================================================
   CALENDAR MODAL - EXACT copy from extension
   =========================================================================== */
.calendar-modal {
    max-width: 360px;
}

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

.calendar-header .modal-title {
    margin: 0;
    font-size: 1rem;
    text-align: center;
}

.calendar-nav {
    padding: 0.25rem;
    height: auto;
}

.calendar-reminder-name {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.5rem;
}

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

.calendar-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: var(--radius);
    font-size: 0.75rem;
    position: relative;
    background-color: hsl(var(--background));
}

.calendar-cell.empty {
    background: transparent;
}

.calendar-cell .day-number {
    font-weight: 500;
    line-height: 1;
}

.calendar-cell .status-icon {
    margin-top: 2px;
    font-size: 0.6rem;
    line-height: 1;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-cell.today {
    background-color: hsl(var(--accent));
    border: 2px solid hsl(var(--quran-green));
}

.calendar-cell.completed {
    background-color: hsl(var(--quran-green) / 0.1);
}

.calendar-cell.completed .status-icon {
    color: hsl(var(--quran-green));
    font-size: 0.7rem;
    font-weight: bold;
}

.calendar-cell.missed {
    background-color: hsl(var(--muted) / 0.3);
}

.calendar-cell.missed .circle {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: hsl(var(--muted-foreground) / 0.4);
}

.calendar-cell.not-scheduled {
    opacity: 0.5;
}

.calendar-cell.future {
    opacity: 0.3;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1rem 0;
    padding-top: 0.75rem;
    border-top: 1px solid hsl(var(--border));
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.legend-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: calc(var(--radius) - 2px);
}

.legend-icon.completed {
    background-color: hsl(var(--quran-green) / 0.1);
    color: hsl(var(--quran-green));
    font-size: 0.7rem;
    font-weight: bold;
}

.legend-icon.missed {
    background-color: hsl(var(--muted) / 0.3);
}

.legend-icon.missed::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: hsl(var(--muted-foreground) / 0.4);
}

/* ===========================================================================
   READER VIEW
   =========================================================================== */
.reader-view {
    position: absolute;
    inset: 0;
    height: 100%;
    background: hsl(var(--background));
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 28px);
    z-index: 20;
    overflow: hidden;
}

.reader-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: hsla(var(--card), 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid hsl(var(--border) / 0.5);
    flex-shrink: 0;
    z-index: 10;
}

.back-btn {
    background: none;
    border: none;
    color: hsl(var(--quran-green));
    font-family: 'Tajawal', inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.back-btn:active {
    background-color: hsl(var(--quran-green) / 0.1);
}

#reader-title {
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: hsl(var(--foreground));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: center;
    padding-inline-end: 2rem; /* balance the back button width */
}

.reader-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.25rem;
    padding-bottom: 6rem; /* space for FAB */
    direction: rtl;
    -webkit-overflow-scrolling: touch;
}

/* Floating Action Button - Mark as Read */
.mark-read-fab {
    position: fixed;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    padding: 0.8rem 1.75rem;
    border-radius: 2rem;
    border: none;
    background-color: hsl(var(--quran-green));
    color: white;
    font-family: 'Tajawal', 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 6px 20px hsl(var(--quran-green) / 0.35),
               0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.mark-read-fab:active {
    transform: translateX(-50%) scale(0.93);
    box-shadow: 0 2px 8px hsl(var(--quran-green) / 0.3);
}

.mark-read-fab.marked {
    background-color: hsl(var(--muted));
    color: hsl(var(--foreground));
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

/* ===========================================================================
   MUSHAF STYLES (Reader)
   =========================================================================== */

@font-face {
    font-family: 'UthmanicHafs';
    src: url('core/assets/fonts/UthmanicHafs.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'SurahNames';
    src: url('core/assets/fonts/SurahNames.woff2') format('woff2');
    font-display: swap;
}

:root {
    --mushaf-font-size: clamp(19px, 5.8vw, 32px);
    --mushaf-line-height: clamp(42px, 12vw, 62px);
    --mushaf-surah-font-size: clamp(36px, 10vw, 60px);
    --mushaf-basmala-font-size: clamp(18px, 5.2vw, 28px);
    --mushaf-ayah-symbol-size: clamp(16px, 4.8vw, 28px);
}

.mushaf-page {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0.5rem !important;
    padding: 0.25rem 0.5rem !important;
    background: transparent;
    border: none;
    border-radius: 0;
    direction: rtl;
}

.mushaf-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--mushaf-line-height);
    font-size: var(--mushaf-font-size);
    white-space: nowrap;
    font-family: 'UthmanicHafs', serif;
    color: hsl(var(--foreground));
}

.mushaf-line.centered {
    justify-content: center;
    gap: clamp(8px, 2.5vw, 15px);
}

/* Partial lines — wird starts/ends mid-Mushaf-line */
/* Dynamic padding is set inline via JS based on word position ratios */

/* Gap on right (RTL start) — wird starts mid-line */
.mushaf-line.partial-start {
    justify-content: space-between;
    /* padding-right set dynamically in JS */
}

/* Gap on left (RTL end) — wird ends mid-line */
.mushaf-line.partial-end {
    justify-content: space-between;
    /* padding-left set dynamically in JS */
}

/* Gap on both sides */
.mushaf-line.partial-both {
    justify-content: space-between;
    /* padding-right and padding-left set dynamically in JS */
}

/* When partial line has only 1 word, center it in the remaining space */
.mushaf-line.partial-start.single-word,
.mushaf-line.partial-end.single-word,
.mushaf-line.partial-both.single-word {
    justify-content: center;
}

.mushaf-word {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.2s;
    user-select: text;
    flex-shrink: 0;
}

.mushaf-word:hover {
    color: hsl(var(--quran-green));
}

.mushaf-word.bookmarked {
    background: hsl(var(--quran-green) / 0.15);
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    box-shadow: 0 0 0 2px hsl(var(--quran-green) / 0.3);
}

.ayah-symbol {
    color: hsl(var(--quran-green));
    font-family: 'UthmanicHafs', serif;
    font-size: var(--mushaf-ayah-symbol-size);
    margin: 0 2px;
    user-select: text;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.surah-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.surah-header {
    font-family: 'SurahNames', serif;
    font-size: var(--mushaf-surah-font-size);
    height: var(--mushaf-line-height);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 3vw, 20px);
    margin: 0;
    color: hsl(var(--foreground));
}

.basmala {
    font-family: 'Amiri', serif;
    font-size: var(--mushaf-basmala-font-size);
    text-align: center;
    margin: 0;
    color: hsl(var(--foreground));
}

.page-footer {
    text-align: center;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground) / 0.6);
    padding: 0.75rem 0;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    border-top: none;
}

/* ===========================================================================
   DOWNLOAD SECTION
   =========================================================================== */
.download {
    padding: 3rem var(--container-padding);
    background-color: hsl(var(--muted));
    text-align: center;
}

.download h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}

.download-subtitle {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.download-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.download-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1rem 2rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    text-decoration: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.download-btn:hover {
    border-color: hsl(var(--quran-green));
    box-shadow: 0 0 0 2px hsl(var(--quran-green) / 0.1);
}

.browser-icon {
    font-size: 1.5rem;
}

.browser-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.download-extra {
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
}

.download-extra a {
    color: hsl(var(--quran-green));
    text-decoration: none;
    margin-right: 0.25rem;
}

/* ===========================================================================
   FOOTER
   =========================================================================== */
.footer {
    padding: 1.5rem var(--container-padding);
    border-top: 1px solid hsl(var(--border));
    text-align: center;
}

.footer p {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.footer a {
    color: hsl(var(--quran-green));
    text-decoration: none;
}

/* ===========================================================================
   LOADING STATE
   =========================================================================== */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid hsl(var(--border));
    border-top-color: hsl(var(--quran-green));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===========================================================================
   RESPONSIVE
   =========================================================================== */
@media (max-width: 480px) {
    .phone-frame {
        width: 100%;
        max-width: 360px;
        height: 580px;
        border-radius: 20px;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .nav-links {
        display: none;
    }

    .download-buttons {
        flex-direction: column;
        align-items: center;
    }

    .download-btn {
        width: 200px;
    }
}


.lang-switcher {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.lang-btn {
  padding: 0.35rem 0.6rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(0,0,0,0.12);
  background: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
  transition: all 0.2s;
}

.lang-btn:hover {
  border-color: hsl(var(--quran-green));
  color: hsl(var(--foreground));
}

.lang-btn.active {
  background-color: hsl(var(--quran-green));
  border-color: hsl(var(--quran-green));
  color: white;
}
