/*
 * ALKRIE UNIFIED THEME V10.0 - TITHI PRINT STYLES
 * Adds print-specific styling for the Tithi Devi prayer guide.
 * ALKRIE UNIFIED THEME V9.0 - TITHI INTRO CONTENT
 * Adds styling for the Tithi Devi introduction and gallery.
 * ALKRIE UNIFIED THEME V8.0 - COMPACT LEGEND
 * Adds styling for a compact, horizontal calendar legend.
 * ALKRIE UNIFIED THEME V7.0 - VEDIC CALENDAR COMPACT UI
 * Adds styling for the new compact, single-line Dasa display.
*/

/* --- Core Color & Font Variables --- */
:root {
    --bg-color: #0a0f2e; /* Deep Navy Blue */
    --card-bg-image: linear-gradient(145deg, #1f2949, #121832);
    --text-color: #e0e0e0;
    --heading-color: #FFFFFF;
    --highlight-color: #FFD700; /* Gold for accents */
    --border-color: #3b3b58;
    --input-bg-color: #0a0f2e; /* Darker input background for contrast */
    --button-bg-color: #FFD700;
    --button-text-color: #0a0f2e;
    --success-color: #5cb85c;
    --error-color: #d9534f;
    --heading-font: 'Playfair Display', serif;
    --body-font: 'Montserrat', sans-serif;
}

/* --- General Reset & Body --- */
* { margin: 0; padding: 0; box-sizing: border-box; scroll-behavior: smooth; }

body {
    font-family: var(--body-font);
    background-color: var(--bg-color);
    background-image: url('https://www.transparenttextures.com/patterns/stardust.png');
    color: var(--text-color);
    line-height: 1.6;
}

.container { width: 100%; max-width: 900px; margin: 20px auto; padding: 15px; background-color: transparent; border-radius: 10px; }

/* --- Typography & Links --- */
h1, h2, h3, h4 { font-family: var(--heading-font); color: var(--heading-color); margin-bottom: 0.5em; }
h1 { font-size: 2.8em; text-align: center; color: var(--highlight-color); text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
h2 { font-size: 2em; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 20px; color: var(--highlight-color); }
h3 { font-family: var(--heading-font); color: var(--highlight-color); margin-bottom: 15px; }
p.sub-headline { text-align: center; font-size: 1.2em; max-width: 700px; margin: -10px auto 30px auto; opacity: 0.9; font-style: italic; }
a { color: var(--highlight-color); text-decoration: none; }
a:hover { text-decoration: underline; }
.highlight { font-weight: bold; color: var(--highlight-color); }

/* --- Navigation --- */
.top-nav { width: 100%; padding: 10px 0; margin-bottom: 25px; }
.top-nav ul { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 20px; }
.top-nav a { color: var(--text-color); text-decoration: none; padding: 10px 15px; font-weight: 600; transition: color 0.3s ease, background-color 0.3s ease; border-radius: 4px; border-bottom: 2px solid transparent; }
.top-nav a:hover { color: var(--highlight-color); border-bottom-color: var(--highlight-color); }
.top-nav a.active { color: var(--highlight-color); font-weight: bold; border-bottom-color: var(--highlight-color); }

/* --- Sections & Cards --- */
.card { background-image: var(--card-bg-image); padding: 30px; border-radius: 10px; border: 1px solid var(--border-color); margin-bottom: 25px; box-shadow: 0 0 15px rgba(0, 0, 0, 0.3), 0 0 5px rgba(255, 215, 0, 0.1); }
.results-grid { display: grid; grid-template-columns: 1fr; gap: 25px; }

/* --- Forms & Buttons --- */
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 600; }
input[type="text"], input[type="date"], input[type="time"], input[type="number"], input[type="email"], select, input[type="month"] { width: 100%; padding: 12px; background-color: var(--input-bg-color); border: 1px solid var(--border-color); border-radius: 5px; color: var(--text-color); font-size: 1em; font-family: var(--body-font); }
input::placeholder { color: #8a8a9e; }
input::-webkit-calendar-picker-indicator { filter: invert(1); }
button[type="submit"] { display: block; width: auto; min-width: 250px; margin: 20px auto 0; padding: 15px 30px; background-color: var(--button-bg-color); color: var(--button-text-color); border: none; border-radius: 5px; font-size: 1.2em; font-weight: 700; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2); }
button[type="submit"]:hover { transform: scale(1.02); box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3); }

/* --- Specific Components --- */
.loading { text-align: center; padding: 20px; }
.spinner { border: 4px solid rgba(255, 255, 255, 0.3); border-left-color: var(--highlight-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.error-section { margin-top: 20px; padding: 15px; background-color: rgba(217, 83, 79, 0.1); border: 1px solid var(--error-color); color: var(--error-color); border-radius: 5px; text-align: center; }
#pobError { color: var(--error-color); font-size: 0.875rem; margin-top: 5px; display: none; }
.table-wrapper { overflow-x: auto; }
table.planetary-details { width: 100%; border-collapse: collapse; margin-top: 20px; }
table.planetary-details th, table.planetary-details td { border: 1px solid var(--border-color); padding: 12px; text-align: left; }
table.planetary-details th { background-color: var(--input-bg-color); color: var(--highlight-color); }
footer { text-align: center; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border-color); font-size: 0.9em; color: #b0b0c0; }
footer a { color: #c0c0d0; }
footer .disclaimer { margin-top: 8px; font-size: 0.8em; }

/* --- Tithi Prayer Guide Formatting --- */
#tithiResult { line-height: 1.7; }
#tithiResult h3 { text-align: center; font-size: 2em; margin-bottom: 0.25em; }
#tithiResult p { margin-bottom: 1.25em; }
#tithiResult h4 { font-family: var(--heading-font); color: var(--highlight-color); margin-top: 2em; margin-bottom: 0.75em; border-bottom: 1px solid var(--border-color); padding-bottom: 5px; }
#tithiResult ul, #tithiResult ol { margin-bottom: 1.25em; padding-left: 25px; }
#tithiResult li { margin-bottom: 0.75em; }
#tithiResult ol > li > strong { color: var(--heading-color); font-weight: 700; display: block; margin-bottom: 5px; }

/* --- Monthly Calendar (Numerology) --- */
.calendar-container { padding: 15px; border-radius: 8px; background-image: var(--card-bg-image); border: 1px solid var(--border-color); box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 10px; }
.calendar-header, .calendar-day { padding: 10px; text-align: center; border-radius: 5px; font-weight: bold; }
.calendar-header { background-color: var(--input-bg-color); color: var(--highlight-color); }
.calendar-day { position: relative; min-height: 80px; display: flex; align-items: center; justify-content: center; font-size: 1.2em; transition: transform 0.2s; background-color: var(--bg-color); border: 1px solid var(--border-color); }
.day-number { font-size: 1.5rem; font-weight: 600; }
.most-favourable { background-color: var(--highlight-color); color: var(--bg-color); border-color: var(--highlight-color); }
.favourable { background-color: rgba(255, 215, 0, 0.2); color: var(--highlight-color); border-color: var(--border-color); }
.most-favourable::after, .favourable::after { content: '★'; position: absolute; bottom: 5px; right: 8px; font-size: 0.8rem; }
.most-favourable::after { color: var(--bg-color); }
.favourable::after { color: var(--highlight-color); }
.empty-day { background-color: transparent; border: 1px solid var(--border-color); opacity: 0.5; }
#reportResult h2, #reportResult h3 { text-align: center; }
#reportResult h3 { font-style: italic; font-weight: 400; margin-top: -15px; margin-bottom: 20px; }
.print-button { display: block; width: 250px; margin: 20px auto; padding: 12px; background-color: var(--input-bg-color); color: white; border: 1px solid var(--border-color); border-radius: 5px; font-size: 1em; font-weight: 600; cursor: pointer; transition: background-color 0.3s; }
.print-button:hover { background-color: var(--bg-color); }
.print-title, .print-date-info, .powered-by-print { display: none; }

/* --- Calendar Legend Styling (CORRECTED & COMPACT) --- */
.calendar-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px 25px; /* Row and Column gap */
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.8em; /* Smaller text */
    font-weight: 600;
}
.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 4px; /* Slightly rounded square */
    margin-right: 6px;
    border: 1px solid var(--border-color);
}
.legend-color.neutral-day {
    background-color: var(--bg-color);
}

/* --- Vedic Calendar Final Fixes --- */
#calendarBody .day { padding: 5px; flex-direction: column; align-items: stretch; justify-content: flex-start; min-height: 120px; }
.day-number-small { font-size: 1em; font-weight: 700; text-align: left; color: var(--text-color); opacity: 0.7; margin-bottom: 5px; }
.dasa-info-container { display: flex; flex-direction: column; flex-grow: 1; gap: 2px; }
.dasa-period { flex-grow: 1; border-radius: 3px; padding: 5px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; font-size: 0.8em; }
.dasa-lord { font-weight: 600; }
.dasa-time { font-size: 0.9em; opacity: 0.8; }

/* --- Vedic Calendar Final Fixes --- */
#calendarBody .day { padding: 5px; flex-direction: column; align-items: stretch; justify-content: flex-start; min-height: 120px; }
.day-number-small { font-size: 0.9em; font-weight: 700; text-align: left; color: var(--text-color); opacity: 0.7; margin-bottom: 5px; padding-left: 2px; }
.dasa-info-container { display: flex; flex-direction: column; flex-grow: 1; gap: 3px; }

/* --- NEW: Vedic Calendar Compact UI --- */
.dasa-period-compact {
    flex-grow: 1;
    border-radius: 3px;
    padding: 2px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    min-height: 18px; /* Ensures even very short periods are visible */
}
.dasa-lord-abbr {
    font-weight: 700;
}
.dasa-time {
    font-size: 0.9em;
    opacity: 0.8;
}

/* --- NEW: Tithi Devi Gallery --- */
.devi-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.devi-card {
    background-color: var(--input-bg-color);
    padding: 20px;
    border-radius: 8px;
    border-left: 3px solid var(--highlight-color);
}
.devi-card h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
}
.devi-card p {
    font-size: 0.9em;
    opacity: 0.9;
}

/* --- Responsive & Print --- */
@media (max-width: 520px) {
    h1 { font-size: 2.2em; }
    p.sub-headline { font-size: 1em; }
    .card, .container { padding: 15px; }
    .top-nav ul { flex-direction: column; align-items: center; }
    .calendar-header { padding: 8px 2px; font-size: 0.75rem; }
    .calendar-day { min-height: 60px; }
    .day-number { font-size: 1.1rem; }
    #calendarBody .day { min-height: 100px; font-size: 0.9em; }
    .dasa-period { font-size: 0.7em; padding: 2px; }
}

@media print {
    body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body * { visibility: hidden; }
    #reportResult, #reportResult * { visibility: visible; }
    /* Make the results section and everything inside it visible */
    #resultsSection, #resultsSection * {
        visibility: visible;
    }
    /* Reposition the results to take up the whole page */
    #resultsSection {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 20px;
        border: none;
        box-shadow: none;
        background-image: none;
        background-color: #ffffff; /* White background for print */
    }
    /* Ensure text is black and readable for print */
    #resultsSection, #resultsSection * {
        color: #000000 !important;
    }
    .print-button { display: none; }
    .screen-title { display: none; }
    .print-title { display: block; }
    .print-date-info { display: block; text-align: left; font-family: 'Montserrat', sans-serif; font-size: 1rem; font-weight: 600; margin-bottom: 15px; }
    #reportResult h3 { margin-top: -10px; }
    .powered-by-print { display: block; text-align: center; margin-top: 15px; font-size: 9pt; color: #aaaaaa; }
    /* Hide elements that should not be on the final printout */
    .no-print, .no-print * {
        display: none !important;
        visibility: hidden !important;
    }
}

