/* ===== GLOBAL RESET & SCROLL FIX ===== */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

* {
    box-sizing: border-box;
    max-width: 100vw;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== COLOR VARIABLES ===== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #e74c3c;
    --text-color: #ecf0f1;
    --background-color: #f0f2f5;
    --card-background: #ffffff;
    --card-text-color: #333333;
}

/* ===== LAYOUT ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Removed padding-top as it's no longer needed with absolute positioned header title */
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between; /* Keep space-between for logo and right logos */
    position: relative; /* Make header a positioning context */
    z-index: 9999;
    overflow-x: hidden;
}

.header-logo {
    height: 105px;
    width: auto;
    flex-shrink: 0;
    margin-right: 30px;
    background-color: white;
    box-shadow: -2px -2px 5px rgba(231, 76, 60, 0.4), 2px 2px 5px rgba(231, 76, 60, 0.6);
}

.header-logo-link {
    pointer-events: auto;
}

.header-title-container {
    position: absolute; /* Position absolutely within the header */
    left: 50%; /* Move to the horizontal center */
    transform: translateX(-50%); /* Adjust back by half its width */
    text-align: center;
    width: fit-content; /* Ensure it only takes necessary width */
    margin: 0; /* Remove margin to avoid interference */
    z-index: 1; /* Ensure it's above other elements if needed */
}

.right-logos {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.bangalore-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bangalore-logo {
    height: 96px;
    width: 96px;
    flex-shrink: 0;
    object-fit: contain; /* Ensure the image fits within the specified dimensions */
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
}

header h2 {
    margin: 0.5rem 0 0;
    font-size: 1.45rem; /* Increased font size by 4px */
    font-weight: bold; /* Made text bold */
    color: #f0f2f5; /* Lighter color for embossed effect */
    opacity: 1; /* Full opacity for better visibility of effect */
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.5), /* Darker shadow for depth with blur */
        -2px -2px 4px rgba(255, 255, 255, 0.3); /* Lighter shadow for embossed highlight with blur */
    letter-spacing: 1px; /* Keep letter spacing */
}

main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.ashara-logo-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/ashara_logo.png');
    background-repeat: repeat;
    background-size: 5%;
    opacity: 0.15;
    z-index: -1;
}

/* ===== HOME OPTIONS ===== */
.home-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: hidden;
    max-width: 100%;
}

.option-card {
    background-color: var(--secondary-color);
    color: var(--text-color);
    text-decoration: none;
    padding: 1.5rem 1rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, background-color 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.option-card:hover {
    transform: translateY(-5px);
    background-color: var(--accent-color);
}

.option-card i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.option-card span {
    font-size: 1rem;
    font-weight: bold;
}

/* ===== MASJID INFO ===== */
.masjid-info-section {
    background-color: var(--card-background);
    color: var(--card-text-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.masjid-info-section h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.dark-title {
    text-align: center;
    color: var(--primary-color);
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}

.flow-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

.flow-button:hover {
    background-color: #c0392b;
}

.flow-button.selected {
    background-color: #f0392b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border: 2px solid white;
    color: white;
    font-weight: bold;
    font-size: 1.125rem;
}

.masjid-cards-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
}

.masjid-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: 0 auto;
}

.masjid-card h3 {
    color: var(--primary-color);
    margin: 1rem 0 0.5rem;
}

.masjid-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.masjid-card p {
    padding: 0 1rem;
    color: #555;
    flex-grow: 1;
}

.masjid-card .direction-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    margin: 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

.masjid-card .direction-button:hover {
    background-color: #c0392b;
}

/* ===== ANNOUNCEMENTS ===== */
.announcements-section {
    background-color: var(--card-background);
    color: var(--card-text-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin: 2rem auto;
    max-width: 100%;
    text-align: center;
}

.announcements-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.announcements-list {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    position: relative;
}

.announcement-item {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out;
}

.announcement-item p {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: #333;
    white-space: normal;
}

.announcement-item small {
    color: #777;
    font-size: 0.85rem;
    display: block;
    margin-top: 0.5rem;
    text-align: center;
}

.announcement-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.announcement-nav-arrow {
    font-size: 2rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 0.5rem;
}

.announcement-nav-arrow:hover:not([disabled]) {
    color: var(--accent-color);
    transform: scale(1.1);
}

.announcement-nav-arrow[disabled] {
    color: #cccccc;
    cursor: not-allowed;
}

/* ===== WEATHER WIDGET ===== */
#weather-widget {
    background-color: var(--card-background);
    color: var(--card-text-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin: 2rem auto;
    max-width: 800px;
    text-align: center;
}

.forecast-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.forecast-day-card {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1rem;
    flex: 1 1 calc(33% - 2rem);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
    min-width: 150px;
    max-width: 200px;
}

.forecast-day-card img {
    width: 50px;
    height: 50px;
    margin: 0.5rem auto;
}

/* ===== PDF Viewer Styles ===== */
#pdf-scroll-container {
    width: 100%;
    height: 90vh;
    overflow: auto;
    position: relative;
    border: 1px solid #ccc;
    flex-grow: 1;
}

#pdf-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    width: fit-content;
    height: fit-content;
}

canvas {
    display: block;
    /* width: 100%; Removed to allow canvas to render at its actual scaled size */
    height: auto;
}


/* ===== Floating Buttons ===== */
.floating-controls {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 10px);
}

.floating-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.floating-button:hover {
    background-color: #c0392b;
    transform: scale(1.05);
}

/* new “design” style for the retry button */
.enable-location-btn {
  background-color: var(--accent-color); /* Changed to accent-color */
  color: white; /* Changed to white for consistency */
  border: none;
  padding: 0.6rem 1rem; /* Adjusted padding to match direction-button */
  border-radius: 5px; /* Adjusted border-radius to match direction-button */
  cursor: pointer;
  font-size: 0.9rem; /* Adjusted font-size to match direction-button */
  transition: background-color 0.2s ease; /* Simplified transition */
  /* Removed margin-left as it was for inline style replacement and might not be desired for new theme */
}
.enable-location-btn:hover {
  background-color: var(--accent-color);
  transform: translateY(-2px);
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
    body {
        padding-top: 0;
    }

    header {
        padding: 0.5rem 1rem;
        flex-direction: column; /* Stack items vertically */
        align-items: center; /* Center items horizontally */
        position: relative !important;
        z-index: initial;
    }

    .header-logo {
        height: 75px;
        margin-right: 0; /* Remove margin for centering */
    }

    .header-title-container {
        position: static; /* Reset positioning for small screens */
        transform: none; /* Remove transform for small screens */
        margin: 0.5rem 0;
        width: auto; /* Reset width */
    }

    .bangalore-logo {
        height: 96px; /* Adjust height for mobile */
        width: 96px;
        object-fit: contain;
    }

    .right-logos {
        gap: 0.5rem;
        width: 100%;
        justify-content: center;
    }

    .home-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .option-card {
        padding: 1rem 0.5rem;
    }

    .option-card i {
        font-size: 2rem;
    }

    .option-card span {
        font-size: 0.9rem;
    }

    .masjid-cards-container {
        flex-direction: column;
    }

    .announcement-item {
        font-size: 0.9rem;
    }

    #weather-widget {
        padding: 1rem;
        margin: 1rem auto;
    }

    .forecast-day-card {
        flex: 1 1 100%;
        max-width: 300px;
    }
}
