/* --- 1. Base Reset & Typography --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-image: url('background.png');
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

h1, h2, h3 { margin-top: 0; color: #2c3e50; }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    /* FIX: Clear the muddy white overlay so the background details are fully visible */
    background-color: transparent !important; 
    min-height: 100vh;
}

/* --- 2. Layouts (Grid & Flex) --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    justify-content: center;
}

.single-card-layout {
    display: flex !important;
    justify-content: center;
}

.single-card-layout .card {
    width: 100%;
    max-width: 700px;
}

.flex-row {
    display: flex;
    gap: 10px;
}

/* --- 3. UI Components --- */

.card {
    /* Bumps text contrast to 90% white so reading remains completely effortless */
    background: rgba(255, 255, 255, 0.9) !important; 
    padding: 20px;
    border-radius: 12px;
    /* Lift the card cleanly off your background artwork with a softer, deeper shadow */
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14); 
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    /* Softens the image details directly behind the text layout */
    backdrop-filter: blur(6px); 
    -webkit-backdrop-filter: blur(6px);
}

input, select, textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary { background-color: #0078d4; color: white; }
.btn-success { background-color: #107c10; color: white; }
.btn-danger { background-color: #d13438; color: white; }

.hidden {
    display: none !important;
}

/* --- 4. Cross-Browser Sticky Alignment Engine --- */
header {
    position: sticky;
    top: 0;
    height: 95px; /* Strict uniform footprint across Safari, Chrome, and Firefox */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1100;
    padding: 10px;
    margin-bottom: 0px !important;
    border-bottom: 1px solid rgba(214, 175, 55, 0.2);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.brand-title {
    color: #d4af37; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2); 
    margin: 0 0 4px 0 !important; /* Controlled layout margins */
    font-size: 1.9rem;
    line-height: 1.1;
}

.public-nav {
    margin: 0 !important;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
}

.public-nav a {
    text-decoration: none;
    color: #2c3e50;
    margin: 0 12px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.public-nav a:hover {
    color: #d4af37;
}

/* Sticky Input bar configuration */
.sticky-controls-wrapper {
    position: sticky;
    top: 95px; /* Lockstep alignment with the header bottom edge */
    z-index: 1000;
    margin-top: 15px;
    margin-bottom: 0px !important;
    border-bottom-left-radius: 0px !important;
    border-bottom-right-radius: 0px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.sticky-controls-wrapper .flex-row input[type="date"] {
    flex: 1;
    min-width: 130px;
}
.sticky-controls-wrapper .flex-row select {
    flex: 2;
}

/* Options frame that snaps seamlessly under sticky elements */
.filter-options-card {
    border-top-left-radius: 0px !important;
    border-top-right-radius: 0px !important;
    border-top: none !important;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.75);
}

/* Mobile responsive scaling zone */
@media screen and (max-width: 480px) {
    header {
        height: 75px; /* Compact boundary layout for mobile devices */
        padding: 6px 5px;
    }
    .brand-title {
        font-size: 1.4rem;
        margin: 0 0 2px 0 !important;
    }
    .public-nav {
        display: flex;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 5px;
        font-size: 0.8rem;
        margin: 0 !important;
    }
    .public-nav a {
        margin: 0 4px;
        white-space: nowrap;
    }
    .sticky-controls-wrapper {
        top: 75px; /* Perfectly realigned to mobile header bounds */
        margin-top: 10px;
        padding: 10px;
    }
}

/* --- 5. Admin Tabs --- */
.tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.tab-btn { background: #e9ecef; color: #495057; }
.tab-btn.active { background: #0078d4; color: white; }

.tab-content { display: none; }
.tab-content.active { display: block !important; animation: fadeIn 0.3s; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- 6. Gurmukhi & Verse Styling --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Gurmukhi:wght@400;700&display=swap');

.gurmukhi {
    font-family: 'Noto Sans Gurmukhi', "Arial Unicode MS", sans-serif;
    font-size: 1.4rem; 
    line-height: 1.8 !important; 
    text-align: center;
    color: #000000;
    padding: 10px 0;
    font-weight: 500;
    border-left: 2px double #d4af37; 
    border-right: 2px double #d4af37;
}

@media (max-width: 480px) {
    .gurmukhi {
        font-size: 1.25rem;
        line-height: 1.6 !important;
    }
}

.gurmukhi.merged span {
    display: inline;
    padding: 0;
    margin: 0;
}

.gurmukhi.merged span:hover {
    background-color: rgba(255, 215, 0, 0.4); 
    cursor: pointer;
}

/* --- Library Table Formatting --- */
.library-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 10px;
}

.library-table th, .library-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

.col-ang { width: 10%; font-weight: bold; }
.col-verse { width: 55%; }
.col-keywords { width: 15%; color: #666; font-size: 0.9rem; }
.col-actions { width: 20%; text-align: right; }

.verse-preview {
    display: block;
    width: 100%; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    box-sizing: border-box;
}

.verse-preview.expanded {
    white-space: normal;
    overflow: visible;
    background-color: #fffdf0;
    border: 1px solid #107c10;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    font-size: 1.2rem;
    line-height: 1.6;
    padding: 15px;
}

.btn-share {
    background-color: #25D366;
    color: white;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 20px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.btn-share:active {
    transform: scale(0.95);
    background-color: #128C7E;
}
.card .meta {
    display: block;
    color: #888;
    font-size: 0.8rem;
}

.highlight {
    background-color: yellow;
    font-weight: bold;
    padding: 0 2px;
    border-radius: 2px;
}

.filter-card {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.transparent-card {
    background: rgba(255, 253, 231, 0.85) !important; 
    border: 1px solid rgba(212, 175, 55, 0.3) !important;
}

.tip-highlight {
    background-color: rgba(255, 215, 0, 0.4);
    font-weight: bold;
    padding: 0 4px;
    border-radius: 3px;
    display: inline-block;
    color: #000;
}
/* --- Single-Line Compact Control Bar --- */
.filter-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center; /* 👈 Center aligns all components horizontally */
    gap: 16px;
    width: 100%;
}

.filter-item {
    display: flex;
    align-items: center;
}

.date-item {
    flex: 0 0 125px;
}

.select-item {
    flex: 0 0 240px; /* Locked size to prevent asymmetric stretching */
}

.checkbox-item {
    flex: 0 0 auto; /* Stopped from hoarding space so row blocks shift to exact center */
}

/* Force tiny input footprints across Safari and Chrome */
.filter-row input[type="date"],
.filter-row select {
    padding: 4px 8px !important;
    font-size: 13px !important;
    height: 28px !important;
}

.larivaar-label {
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    margin: 0;
}

.larivaar-label input[type="checkbox"] {
    width: 14px !important;
    height: 14px !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
}

.inline-tip {
    font-size: 0.7rem;
    color: #555;
    font-weight: normal;
    font-style: italic;
    margin-left: 4px;
}

/* Increased transparency so Sri Harmandir Sahib shines through beautifully */
.filter-card {
    background: rgba(255, 255, 255, 0.35) !important; 
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Responsive wrap to prevent screen clipping on iPhone or narrow screens */
/* Responsive wrap to prevent screen clipping on iPhone or narrow screens */
@media screen and (max-width: 768px) {
    .filter-row {
        flex-wrap: wrap;
        justify-content: center; /* Maintain center packing on stack layout */
        gap: 10px;
    }
    .date-item {
        flex: 0 1 130px;
    }
    .select-item {
        flex: 0 1 210px;
    }
    .checkbox-item {
        flex: 0 0 100%;
        margin-top: 6px;
        display: flex;
        justify-content: center;
    }
    .larivaar-label {
        white-space: normal !important; /* 👈 FIX: Allows text to break nicely instead of shooting off-screen */
        justify-content: center;
        text-align: center;
        width: 100%;
        max-width: 340px; /* Keeps it perfectly contained within phone viewports */
    }
    .inline-tip {
        display: block; /* Drops the English/Punjabi tip onto its own line under the checkbox */
        margin-left: 0;
        text-align: center;
        font-size: 0.72rem;
        margin-top: 2px;
    }
}
