/* --- Google Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;700&display=swap'); /* Font for Quran text */
@import url('https://fonts.googleapis.com/css2?family=Amiri+Quran&display=swap'); /* Alternative Font for Quran text */


/* --- Base Variables and Reset --- */
:root {
    --primary-color: #2f0000  ;    /* Dark Blue-Gray */
    --secondary-color: #2f0000b7 ; /* Slightly Lighter Blue-Gray */
    --accent-color: #3498DB;     /* Nice Blue for accents like next prayer */
    --text-color: #333333;       /* Dark Gray for general text */
    --light-text-color: #666666; /* Lighter Gray for secondary text */
    --light-bg: #F8F9FA;         /* Very Light Gray Background */
    --white: #FFFFFF;
    --border-color: #e0e0e0;     /* Light border color */
    --next-prayer-bg: #e0f2fe;   /* Tailwind sky-100 */
    --next-prayer-border: #7dd3fc;/* Tailwind sky-300 */
    --next-prayer-text: #0c4a6e; /* Tailwind sky-800 */
    --next-prayer-time: #0369a1; /* Tailwind sky-700 */
    --next-prayer-remaining: #0284c7; /* Tailwind sky-600 */
    --quran-viewer-bg: #fdfdfd;  /* Slightly off-white for Quran viewer */
    --quran-content-bg: #f9fafb; /* Background for Quran text area */
    --quran-font: 'Noto Naskh Arabic', 'Amiri Quran', serif; /* Explicit Quran font variable */
}

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

body {
    font-family: 'Tajawal', Arial, sans-serif; /* Default font */
    background-color: var(--light-bg);
    color: var(--text-color);
    overflow-x: hidden; /* Prevent horizontal scroll */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* --- Navbar Styles --- */
.navbar {
    position: sticky;
    top: 0;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 12px 16px;
    z-index: 1000; /* Ensure navbar is on top */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between logo and name */
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Prevent logo from shrinking */
}

.logo i {
    color: var(--primary-color);
    font-size: 22px; /* Slightly smaller icon */
}

.app-name {
    font-size: 1rem; /* Responsive font size */
    font-weight: 700; /* Bold */
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis if name is too long */
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 5px; /* Add padding for easier tapping */
}

/* --- Sidenav Styles --- */
.sidenav {
    height: 100%;
    width: 0; /* Initially hidden */
    position: fixed;
    z-index: 1100; /* Higher than navbar */
    top: 0;
    right: 0;
    background-color: var(--white);
    overflow-x: hidden; /* Disable horizontal scroll */
    transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smoother transition */
    padding-top: 60px; /* Space for close button */
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidenav a {
    padding: 12px 16px 12px 32px; /* Adjust padding */
    text-decoration: none;
    font-size: 1rem;
    color: var(--text-color);
    display: flex; /* Use flex for icon alignment */
    align-items: center;
    transition: background-color 0.3s, color 0.3s;
    border-bottom: 1px solid var(--border-color); /* Separator */
    white-space: nowrap;
}

.sidenav a:last-child {
    border-bottom: none; /* Remove border for the last item */
}

.sidenav a i {
    margin-left: 15px; /* Space after icon (RTL) */
    width: 24px; /* Fixed width for icons */
    text-align: center;
    color: var(--primary-color);
    font-size: 1.1em;
}

.sidenav a:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

.sidenav .closebtn {
    position: absolute;
    top: 10px; /* Adjust position */
    left: 15px; /* Adjust position (RTL) */
    font-size: 36px;
    margin-left: 0; /* Remove margin-right */
    color: var(--light-text-color);
    border-bottom: none; /* Ensure close button has no border */
    padding: 0 10px; /* Add some padding */
}
.sidenav .closebtn:hover {
    color: var(--text-color);
    background-color: transparent; /* No background hover for close */
}

/* --- General Layout and Cards --- */
.main-container {
    padding: 15px;
    max-width: 768px; /* Limit width on larger screens */
    margin: 0 auto; /* Center container */
    padding-bottom: 80px; /* Ensure space for bottom nav */
}

.card {
    background-color: var(--white);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08); /* Subtle shadow */
}

.section { /* Can be used for non-card sections if needed */
    padding: 16px;
    margin-bottom: 20px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 1.2rem; /* Adjusted size */
    font-weight: 700; /* Bolder title */
    margin-bottom: 16px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px; /* Space between icon and text */
    border-bottom: 2px solid var(--primary-color); /* Underline effect */
    padding-bottom: 8px;
}

.section-title i {
    /* margin-left: 10px; Removed, using gap now */
    font-size: 1.1em; /* Adjust icon size relative to text */
}

/* --- Prayer Times Specific Styles --- */
.prayer-times {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Space between items */
}

.prayer-time-item {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Align items vertically */
    padding: 12px 15px; /* Adjusted padding */
    background-color: #f1f3f5; /* Slightly different light background */
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.prayer-details {
   display: flex;
   flex-direction: column;
   align-items: flex-start; /* Align text to the start (right in RTL) */
}

.prayer-name {
    font-weight: 500; /* Medium weight */
    font-size: 1rem;
    color: var(--text-color);
}

.prayer-time {
    font-weight: 700; /* Bold time */
    font-size: 1.1rem;
    color: var(--primary-color);
}

.time-remaining {
    font-size: 0.75rem;
    color: var(--light-text-color);
    margin-top: 3px; /* Space below prayer name */
    min-height: 1em; /* Reserve space */
    direction: ltr; /* Ensure timer text reads left-to-right */
    text-align: right; /* Align timer text right within its block (looks better in RTL) */
}

/* Highlight style for the next prayer */
.prayer-time-item.next-prayer {
    background-color: var(--next-prayer-bg);
    border-color: var(--next-prayer-border);
    transform: scale(1.02);
    box-shadow: 0 3px 6px rgba(52, 152, 219, 0.1); /* Subtle shadow with accent color hint */
}

.prayer-time-item.next-prayer .prayer-name {
    color: var(--next-prayer-text);
    font-weight: 700; /* Make name bold too */
}

.prayer-time-item.next-prayer .prayer-time {
    color: var(--next-prayer-time);
}

.prayer-time-item.next-prayer .time-remaining {
    color: var(--next-prayer-remaining);
    font-weight: 500; /* Medium weight for timer */
}

/* Style for the summary div below prayer times */
#nextPrayerInfo {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent-color);
    min-height: 1.2em; /* Reserve space */
}

/* --- Social Links --- */
.social-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); /* Responsive grid */
    gap: 15px; /* Increased gap */
    margin-top: 10px;
}

.social-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s ease;
}
.social-link:hover {
    transform: translateY(-3px); /* Slight lift on hover */
}

.social-icon {
    width: 45px; /* Slightly larger icon */
    height: 45px;
    border-radius: 50%;
    background-color: var(--light-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
    border: 1px solid var(--border-color);
}

.social-icon i {
    font-size: 20px;
    color: var(--primary-color);
    transition: color 0.3s ease;
}
.social-link:hover .social-icon i {
    color: var(--accent-color); /* Change icon color on hover */
}

.social-name {
    font-size: 12px;
}

/* --- Action Buttons --- */
.action-button {
    display: inline-block; /* Allow multiple buttons side-by-side */
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    margin-top: 10px;
    transition: background-color 0.3s, box-shadow 0.3s;
    border: none;
    font-family: 'Tajawal', Arial, sans-serif;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-button:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.action-button:disabled { /* Style for disabled button during form submission */
    background-color: var(--light-text-color);
    cursor: not-allowed;
    box-shadow: none;
}


/* --- Gallery --- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Responsive columns */
    gap: 10px;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1 / 1; /* Make items square */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: var(--border-color); /* Placeholder bg */
}
.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area without distortion */
    display: block; /* Remove extra space below image */
}

/* --- Forms --- */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Tajawal', Arial, sans-serif;
    background-color: var(--white);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.2);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* --- Contact Info --- */
.contact-info {
    margin-top: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px; /* Increased spacing */
    gap: 10px; /* Space between icon and text */
}

.contact-item i {
    width: 25px; /* Fixed width */
    color: var(--primary-color);
    font-size: 18px;
    text-align: center;
}
.contact-item a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s;
    word-break: break-all; /* Prevent long links from overflowing */
}
.contact-item a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}
.ltr-text { direction: ltr; text-align: left; } /* For phone numbers */

/* --- Feature Cards (Home Screen) --- */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Always 2 columns */
    gap: 15px;
    margin-top: 15px;
}

.feature-card {
    background-color: var(--white); /* Use white background */
    border-radius: 10px;
    padding: 20px 15px; /* More padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.feature-card i {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.feature-card-title {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1rem;
}
.feature-card-desc {
    font-size: 0.85rem;
    color: var(--light-text-color);
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 8px 0; /* Adjusted padding */
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    z-index: 900; /* Below navbar and sidenav */
    border-top: 1px solid var(--border-color);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center content vertically */
    text-decoration: none;
    color: var(--light-text-color); /* Default color */
    flex: 1; /* Make items share space equally */
    padding: 5px 0; /* Add some vertical padding */
    transition: color 0.3s;
    cursor: pointer;
}

.bottom-nav-item i {
    font-size: 20px;
    margin-bottom: 4px; /* Space between icon and text */
}

.bottom-nav-item.active {
    color: var(--primary-color); /* Active color */
}
.bottom-nav-item.active i {
    color: var(--primary-color); /* Ensure icon color matches */
}

.bottom-nav-text {
    font-size: 11px; /* Slightly smaller text */
    font-weight: 500;
}

/* --- Tab Content --- */
.tab-content {
    /* display: none; Replaced by utility class 'hidden' */
    padding-bottom: 10px; /* Add some padding at the bottom within tabs */
}

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

/* --- Specific Section Styles --- */
.mosque-info p,
.activities-list li,
.card p {
    line-height: 1.7; /* Improved readability */
    color: var(--text-color); /* Ensure consistent text color */
}

.activities-list {
    padding-right: 20px; /* Keep indentation for list */
    list-style: none; /* Remove default list bullets */
}

.activities-list li {
    margin-bottom: 10px;
    position: relative;
}

.activities-list li::before {
    content: "•"; /* Use bullet character */
    color: var(--primary-color);
    position: absolute;
    right: -20px; /* Position bullet to the right (RTL) */
    font-size: 1.2em;
    line-height: 1;
}

.surah-item {
    /* Styles are mostly handled by Tailwind in JS now, keep basic structure for fallback */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px; /* Adjust padding */
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    cursor: pointer;
}
.surah-item:last-child {
    border-bottom: none;
}
.surah-item:hover {
    background-color: var(--light-bg);
}

.surah-details {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between number and name */
}

.surah-number {
    width: 30px;
    height: 30px;
    flex-shrink: 0; /* Prevent shrinking */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #e9ecef; /* Lighter background */
    border-radius: 50%;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 0.9rem;
}

/* --- Quran Viewer Styles --- */
#quranViewer {
    background-color: var(--quran-viewer-bg);
}

.quran-viewer-content {
    font-family: var(--quran-font);
    line-height: 2.5; /* Generous line height for Arabic */
    text-align: justify;
    margin-top: 1rem;
    max-height: 65vh; /* Limit height and enable scroll */
    overflow-y: auto;
    padding: 15px; /* Add padding inside */
    background-color: var(--quran-content-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.quran-viewer-content p {
    margin-bottom: 15px; /* Space between paragraphs (ayahs) */
}

/* Style for inline Ayah text span */
.quran-viewer-content span.inline {
   font-size: 1.3rem; /* Adjust as needed */
    color: var(--text-color);
    /* Apply specific Quran font via Tailwind or here */
    font-family: var(--quran-font);
    line-height: 2.5; /* Ensure consistent line height */
}

.ayah-number {
    display: inline-block;
    margin: 0 5px; /* Space around number */
    font-family: sans-serif; /* Use standard font for numbers */
    font-size: 0.9rem;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 50%;
    width: 26px; /* Slightly larger */
    height: 26px;
    line-height: 24px; /* Center number vertically */
    text-align: center;
    background-color: var(--white);
    vertical-align: middle; /* Align number vertically with text */
}

/* Close button for Quran viewer */
.quran-viewer-close-btn {
    display: block;
    width: auto;
    padding: 8px 16px;
    margin: 15px auto 0;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.3s;
    border: none;
    font-family: 'Tajawal', Arial, sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
}
.quran-viewer-close-btn:hover {
    background-color: var(--secondary-color);
}

/* Loading Spinner */
.loading-spinner {
    border: 4px solid #f3f3f3; /* Light grey */
    border-top: 4px solid var(--primary-color); /* Accent color */
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto; /* Center spinner */
}

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

#imageViewer .close-btn { /* Style the close button if not using Tailwind */
    position: absolute;
    top: 15px;
    right: 20px;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
}

#imageViewer img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 5px; /* Optional: rounded corners for viewed image */
}

/* --- Utility Classes --- */
.hidden { display: none !important; } /* Basic hidden class with high specificity */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; } /* Example margin */


/* --- Responsive Adjustments (Optional Example) --- */
@media (min-width: 640px) { /* Example: adjustments for larger screens */
    .app-name {
        font-size: 1.2rem;
    }
    .main-container {
        padding: 20px;
    }
    .feature-cards {
        grid-template-columns: repeat(4, 1fr); /* Show 4 features per row */
    }
    .gallery {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    /* Increase font size for Quran text on larger screens */
    .quran-viewer-content span.inline {
       font-size: 1.5rem; /* Larger font size */
    }
     .ayah-number {
        width: 28px;
        height: 28px;
        line-height: 26px;
        font-size: 1rem;
    }
}

/* Additional Styles for Notification Toggle (Tailwind handles most of it) */
#notificationStatus {
    min-height: 1em; /* Reserve space */
}