:root {
    --background: #000000;
    --card-background: #1C1C1E;
    --primary-text: #FFFFFF;
    --secondary-text: #A0A0A0;
    --accent-color-rgb: 10, 132, 255; /* Apple's blue as RGB */
    --border: #333333;
}

[data-theme="light"] {
    --background: #F9F9F9;
    --card-background: #FFFFFF;
    --primary-text: #1D1D1F;
    --secondary-text: #3C3C43;
    --border: #EAEAEA;
}

:root, [data-theme="light"] {
    --accent-color: rgb(var(--accent-color-rgb));
}

html[dir="rtl"] {
    /* RTL specific styles can go here if needed */
    text-align: right;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--primary-text);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-y: scroll; /* Prevents layout shift when loader appears/disappears */
}

.hidden {
    display: none !important;
}

/* --- Loader --- */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 101; /* Higher than modal */
    backdrop-filter: blur(5px);
    color: var(--primary-text);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* --- App Container --- */
#app-container {
    width: 100%;
    max-width: 340px;
    padding: 24px;
    box-sizing: border-box;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.control-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--secondary-text);
    transition: background-color 0.2s ease;
}

.control-button:hover {
    background-color: var(--border);
}

.control-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: fill 0.3s ease, transform 0.3s ease;
}

#theme-toggle.sun svg { transform: scale(1); }
#theme-toggle.moon svg { transform: rotate(40deg) scale(1); }

.language-switcher {
    position: relative;
}

#language-button {
    font-weight: 600;
    width: 44px;
    height: 44px;
    font-size: 0.9rem;
}

.language-menu {
    position: absolute;
    top: 40px;
    right: 0;
    background-color: var(--card-background);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10;
}

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

.language-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--primary-text);
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
}

html[dir="rtl"] .language-menu button {
    text-align: right;
}

.language-menu button:hover {
    background-color: var(--accent-color);
    color: white;
}

.location-header {
    text-align: center;
    margin: 0 0 24px 0;
    color: var(--secondary-text);
    font-size: 0.9rem;
}

.location-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

#refresh-location-button {
    font-size: 0.8rem; /* Make the emoji smaller */
    width: 32px;
    height: 32px;
    color: var(--secondary-text);
    opacity: 0.7;
}

.location-header #location-info {
    /* Allow the text to shrink and wrap if needed, preventing it from pushing the icon */
    flex-shrink: 1;
    min-width: 0; /* Important for flex-shrink to work correctly with long text */
    word-break: break-word; /* Break long city names if necessary */
    margin: 0 !important; /* Override default p margin to ensure alignment */
}

.location-header p {
    margin: 4px 0;
}

/* --- Main Focus Section --- */
.main-focus {
    text-align: center;
    margin-bottom: 32px;
}

.main-focus h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgb(var(--accent-color-rgb));
    margin: 0 0 8px 0;
}

.main-focus h2 {
    font-size: 5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -2px;
}

.main-focus h2.countdown-display {
    font-size: 2.8rem; /* Adjust countdown text size for better balance */
    letter-spacing: -1px;
    line-height: 1.2;
}

.main-focus p {
    font-size: 1rem;
    color: var(--secondary-text);
    font-weight: 600;
    margin-top: 8px;
}

/* --- Asma Card Section --- */
.asma-card {
    position: relative;
    background-color: var(--card-background);
    border-radius: 20px;
    padding: 20px;
    margin-top: 32px;
    text-align: center;
    border: 1px solid var(--border);
    animation: fadeIn 0.5s 0.2s ease-in-out backwards;
    overflow: hidden;
}

.asma-arabic {
    font-family: 'Noto Naskh Arabic', serif; /* A beautiful Arabic font */
    font-size: 4rem;
    color: rgb(var(--accent-color-rgb));
    margin: 0 0 8px 0;
}

.asma-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-text);
    margin: 0 0 4px 0;
}

.asma-meaning {
    font-size: 0.9rem;
    color: var(--secondary-text);
    margin: 0;
}

.asma-number {
    position: absolute;
    top: 12px;
    left: 20px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--secondary-text);
    opacity: 0.5;
}

/* --- All Times Section --- */
.all-times {
    background-color: var(--card-background);
    border-radius: 20px;
    padding: 8px 20px;
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.time-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    font-size: 1rem;
    transition: opacity 0.5s ease-in-out;
}

.time-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.time-row p {
    margin: 0;
}

.time-row p:first-child {
    color: var(--secondary-text);
}

.time-row p:last-child {
    font-weight: 600;
}

.time-row.past-time {
    opacity: 0.4;
}

.time-row.current-time {
    background-color: rgba(var(--accent-color-rgb), 0.1);
    margin: 0 -20px; /* Extend highlight to edges */
    padding: 16px 20px;
    border-radius: 12px;
}
.time-row.current-time p {
    font-weight: 700 !important; /* Make both name and time bold */
}

.time-row.current-time p:first-child {
    color: var(--primary-text); /* Make the prayer name darker */
}

/* --- Fallback Notice --- */
#fallback-notice {
    text-align: center;
    font-size: 0.8rem;
    color: #ffcc00; /* A warning yellow */
    background-color: rgba(255, 204, 0, 0.1);
    padding: 12px;
    border-radius: 8px;
    margin-top: 24px;
}

/* --- Initial View --- */
.initial-view-container {
    background-color: var(--card-background);
    border: 1px solid var(--border);
    border-radius: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    width: 90%; /* Use percentage for flexibility */
    max-width: 420px; /* Set a max-width for larger screens */
}

.hero-eyebrow {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
    margin: 0 0 12px 0;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: 2.5rem; /* Slightly reduce base font size for a more minimal look */
    font-weight: 700;
    margin: 0 0 16px 0;
    line-height: 1.2;
    letter-spacing: -1px;
    word-break: break-word; /* Prevent overflow on small screens */
}

.hero-subtitle {
    color: var(--secondary-text);
    margin: 0 0 32px 0;
    line-height: 1.5;
    max-width: 380px; /* Slightly reduce max-width */
    font-size: 1.1rem;
    word-break: break-word; /* Prevent overflow on small screens */
}

/* --- Modal Styles --- */
.info-modal-button {
    width: 100%;
    padding: 14px;
    background-color: rgb(var(--accent-color-rgb));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* --- Ad Placeholder --- */
.ad-placeholder {
    width: 100%;
    max-width: 728px; /* Common ad width */
    height: 90px; /* Common ad height */
    margin: 32px auto;
    background-color: var(--border);
    opacity: 0.2;
}

/* --- SEO Content Block (for index.html) --- */
.seo-content {
    max-width: 680px;
    margin: 64px auto 0 auto;
    padding: 0 20px;
    color: var(--secondary-text);
    animation: fadeIn 1s 0.5s ease-in-out backwards;
}

.seo-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 16px;
}

.seo-content p {
    line-height: 1.7;
}

/* --- Responsive Adjustments --- */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2.1rem; /* Further reduce title on small screens */
    }
    .main-focus h2 {
        font-size: 4rem; /* Smaller main time on small screens */
    }
    .asma-arabic {
        font-size: 3.5rem; /* Smaller arabic font on small screens */
    }
}

/* --- Footer --- */
.app-footer {
    text-align: center;
    padding: 24px 0 0 0;
    margin-top: 24px;
    display: flex; /* Use flexbox for perfect centering */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically (for separators) */
    white-space: nowrap; /* Prevent footer links from wrapping to a new line */
}

.footer-link {
    font-size: 0.85rem;
    color: var(--secondary-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--primary-text);
}

.footer-separator {
    margin: 0 8px;
    color: var(--secondary-text);
}

.info-modal-button {
    width: 100%;
    padding: 14px;
    background-color: rgb(var(--accent-color-rgb));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* --- Ad Placeholder --- */
.ad-placeholder {
    width: 100%;
    max-width: 728px; /* Common ad width */
    height: 90px; /* Common ad height */
    margin: 32px auto;
    background-color: var(--border);
    opacity: 0.2;
}
