/* ============================================================
   TamilTemples.com — Global Stylesheet
   ============================================================ */

/* ── Variables ─────────────────────────────────────────── */
:root {
    --red:       #CC1122;
    --red-dark:  #A30E1B;
    --red-muted: #FDF0F1;
    --black:     #111111;
    --charcoal:  #333333;
    --muted:     #595959;
    --border:    #E5E5E5;
    --bg:        #FFFFFF;
    --white:     #FFFFFF;

    --font-serif: Georgia, "Times New Roman", serif;
    --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --radius-sm:  8px;
    --radius:     14px;
    --radius-lg:  20px;

    --shadow-card:  0 2px 16px rgba(0,0,0,0.07);
    --shadow-hover: 0 8px 28px rgba(204,17,34,0.13);

    --max-w: 1080px;
    --transition: 0.2s ease;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: var(--font-sans);
    background: var(--white);
    color: var(--charcoal);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ── Layout ─────────────────────────────────────────────── */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 16px;
}

.main-card {
    background: var(--white);
    overflow: hidden;
    margin: 0 auto;
}

/* ── Site Header ─────────────────────────────────────────── */
.site-header {
    padding: 22px 28px 0;
}

.site-logo img {
    height: 54px;
    width: auto;
    margin: 0 auto 18px;
    display: block;
}

/* ── Navigation ─────────────────────────────────────────── */
.site-nav {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    /* extend borders to full card width, past site-header padding */
    margin-left: -28px;
    margin-right: -28px;
    padding-left: 28px;
    padding-right: 28px;
}

.site-nav a,
.nav-item > a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 13px 15px;
    font-size: 14px;
    font-weight: 600;
    color: var(--charcoal);
    border-bottom: 3px solid transparent;
    transition: color var(--transition), border-color var(--transition);
    white-space: nowrap;
}

.site-nav a:hover,
.nav-item:hover > a {
    color: var(--red);
    border-bottom-color: var(--red);
}

/* Dropdown */
.nav-item { position: relative; }

.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 210px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    z-index: 200;
    padding: 6px 0;
}

.nav-item:hover .nav-dropdown { display: block; }

.nav-dropdown a {
    display: block;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: none !important;
    color: var(--charcoal);
    transition: background var(--transition), color var(--transition);
}

.nav-dropdown a:hover {
    background: var(--red-muted);
    color: var(--red);
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
    padding: 12px 28px;
    font-size: 13px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: #FAFAFA;
    width: 100%;          /* guarantee full stretch */
    display: block;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb span { margin: 0 6px; }
.breadcrumb .current { color: var(--charcoal); font-weight: 600; }

/* ── Page Hero ───────────────────────────────────────────── */
.page-hero {
    text-align: center;
    padding: 34px 28px 22px;
}

.page-hero h1 {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--black);
    letter-spacing: -0.3px;
}

.page-hero h1 span { color: var(--red); }

.page-hero p {
    font-size: 15px;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.5;
}

/* ── Ad Units ────────────────────────────────────────────── */
.ad-unit { margin: 0 28px; text-align: center; }
.ad-unit--leader { margin-top: 20px; margin-bottom: 30px; }
.ad-unit--rect   { margin-top: 30px; margin-bottom: 30px; }

.ad-placeholder {
    background: #FAFAFA;
    border: 1.5px dashed #D8D8D8;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #BBBBBB;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    gap: 4px;
    margin: 0 auto;
}
.ad-placeholder.leader { width: 728px; height: 90px; max-width: 100%; }
.ad-placeholder.rect   { width: 336px; height: 280px; max-width: 100%; }

/* ── Tool Grid ───────────────────────────────────────────── */
.tools-section {
    padding: 4px 24px 28px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 26px 16px 22px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--red);
}

/* Icon wrap — cherry red rounded square */
.tool-icon-wrap {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.tool-icon-wrap svg {
    width: 26px;
    height: 26px;
    stroke: #FFFFFF;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tool-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--black);
    line-height: 1.3;
    margin-bottom: 6px;
}

.tool-desc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 0 28px; }

/* ── Site Footer ─────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 20px 28px;
    font-size: 13px;
    color: var(--muted);
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--red); }

/* ── Inner Page: Form Controls ───────────────────────────── */
.form-panel {
    padding: 22px 28px;
    background: #F7F7F7;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    /* ensure it always spans the full card width */
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

.form-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }

.form-group { flex: 1; min-width: 160px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--charcoal);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-select,
.form-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-size: 15px;
    font-family: var(--font-sans);
    color: var(--black);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23595959' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.form-select:focus,
.form-input:focus { border-color: var(--red); }

.btn {
    height: 44px;
    padding: 0 26px;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-sans);
    color: var(--white);
    background: var(--red);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}
.btn:hover { background: var(--red-dark); }

/* ── Inner Page: Result Cards ────────────────────────────── */
.result-section { padding: 26px 28px; }

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 16px;
}

.result-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
}

.result-card h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 12px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.result-row:last-child { border-bottom: none; }
.result-key { color: var(--muted); font-weight: 500; }
.result-val { color: var(--black); font-weight: 600; text-align: right; }
.result-val.highlight { color: var(--red); font-size: 16px; }

/* ── Inner Page: Calendar ────────────────────────────────── */
.cal-section { padding: 0 28px 26px; }

.cal-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.cal-table th {
    padding: 11px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
}

.cal-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    cursor: pointer;
    transition: background var(--transition);
}
.cal-table td:hover { background: var(--red-muted); }

.cal-day-num {
    font-weight: 700;
    font-size: 15px;
    color: var(--black);
    line-height: 1;
    margin-bottom: 3px;
}

.cal-tamil-date { font-size: 11px; color: var(--muted); }

.cal-table td.today .cal-day-num {
    background: var(--red);
    color: var(--white);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 3px;
}

.cal-table td.other-month { opacity: 0.35; }

/* ── Section Title ───────────────────────────────────────── */
.section-title {
    font-family: var(--font-serif);
    font-size: 21px;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {

    .main-card { margin: 10px auto; border-radius: var(--radius); }

    .site-header { padding: 16px 16px 0; }
    .site-logo img { height: 46px; }

    .site-nav a,
    .nav-item > a { padding: 11px 10px; font-size: 13px; }

    .page-hero { padding: 24px 16px 16px; }
    .page-hero h1 { font-size: 26px; }
    .page-hero p  { font-size: 14px; }

    .tools-section { padding: 4px 14px 22px; }
    .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .tool-card { padding: 20px 12px 18px; }
    .tool-icon-wrap { width: 48px; height: 48px; border-radius: 12px; }
    .tool-icon-wrap svg { width: 22px; height: 22px; }
    .tool-label { font-size: 14px; }
    .tool-desc  { font-size: 12px; }

    .ad-unit { margin: 0 14px; }

    .form-panel { padding: 16px; }
    .form-row { flex-direction: column; gap: 12px; }
    .form-group { min-width: 100%; }
    .btn { width: 100%; }

    .result-section { padding: 16px; }
    .result-grid { grid-template-columns: 1fr; }

    .cal-section { padding: 0 14px 18px; }
    .cal-table td { padding: 8px 4px; }
    .cal-day-num { font-size: 13px; }

    .divider { margin: 0 16px; }
    .site-footer { padding: 16px; }
    .breadcrumb { padding: 12px 16px; }
}

/* ============================================================
   Panchangam Tool Pages
   ============================================================ */

/* ── Select2 Override (matches global form style) ─────────── */
.select2-container { width: 100% !important; }

.select2-container--default .select2-selection--single {
    height: 44px !important;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    outline: none;
    transition: border-color var(--transition);
}

.select2-container--default.select2-container--open
.select2-selection--single,
.select2-container--default .select2-selection--single:focus {
    border-color: var(--red) !important;
}

.select2-container--default
.select2-selection--single .select2-selection__rendered {
    line-height: 44px !important;
    padding-left: 14px;
    font-size: 15px;
    color: var(--black);
}

.select2-container--default
.select2-selection--single .select2-selection__arrow {
    height: 42px !important;
    right: 10px;
}

.select2-dropdown {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}

.select2-container--default
.select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: var(--font-sans);
    outline: none;
}

.select2-container--default
.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--red);
}

.select2-results__option {
    padding: 10px 14px;
    font-size: 14px;
}

.select2-container--default
.select2-results__option--highlighted[aria-selected] {
    background-color: var(--red);
}

/* ── Panchangam Layout ───────────────────────────────────── */
.panch-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    padding: 24px 28px 32px;   /* top gap + align with form-panel's 28px sides */
}

/* ── Panchangam Cards ────────────────────────────────────── */
.panch-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 14px;
}

.panch-card:last-child { margin-bottom: 0; }

/* Hero card — light grey background */
.panch-card--grey {
    background: #F4F5F6;
    border-color: #E0E0E0;
}

.panch-inline {
    padding: 4px 0;
    font-size: 14px;
    line-height: 1.6;
}
.panch-inline .k { color: var(--muted); margin-right: 4px; }
.panch-inline .v { color: var(--black); font-weight: 600; }

.panch-card-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.panch-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    gap: 10px;
}

.panch-row:last-child { border-bottom: none; }
.panch-key  { color: var(--muted); font-weight: 500; white-space: nowrap; }
.panch-val  { color: var(--black); font-weight: 600; text-align: right; }

/* ── Tamil Date Hero ─────────────────────────────────────── */
.panch-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.panch-hero-left { flex: 1; }

.panch-hero-date {
    font-size: 44px;
    font-weight: 700;
    color: var(--red);
    line-height: 1;
    margin-bottom: 10px;
    font-family: var(--font-serif);
}

.panch-hero-sub {
    font-size: 15px;
    color: var(--charcoal);
    margin-bottom: 14px;
}

.panch-hero-year {
    font-size: 18px;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 5px;
}

.panch-hero-meta {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.7;
}

.panch-hero-right {
    text-align: center;
    min-width: 130px;
}

.panch-eng-day {
    font-size: 52px;
    font-weight: 700;
    color: var(--black);
    font-family: var(--font-serif);
    line-height: 1;
}

.panch-eng-month {
    font-size: 16px;
    color: var(--charcoal);
    margin-top: 8px;
}

.panch-eng-weekday {
    font-size: 15px;
    color: var(--muted);
    margin-top: 6px;
}

/* ── Monthly Calendar ────────────────────────────────────── */
.panch-cal-title {
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 14px;
}

.panch-cal-table {
    width: 100%;
    border-collapse: collapse;
}

.panch-cal-table th {
    padding: 10px 6px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    background: #FAFAFA;
}

.panch-cal-table td {
    padding: 0;
    border: 1px solid var(--border);
    height: 140px;
    vertical-align: top;
    width: calc(100% / 7);
}

.panch-cal-link {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 10px 12px 28px;   /* bottom padding reserves space for Tamil date */
    text-decoration: none;
    color: var(--charcoal);
    transition: background var(--transition);
    overflow: hidden;
}

.panch-cal-link:hover { background: var(--red-muted); }

/* Gregorian day — large and prominent */
.panch-cal-day {
    font-size: 30px;
    font-weight: 700;
    color: var(--black);
    line-height: 1;
    margin-bottom: 6px;
}

/* Event symbols row */
.panch-cal-events {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 2px;
}

.cal-evt {
    font-size: 15px;
    line-height: 1;
    display: inline-block;
    cursor: default;
    color: #111111;    /* always black — symbols are B&W only */
    font-style: normal;
}

/* Tamil date — absolute bottom-right of cell */
.panch-cal-tamil {
    position: absolute;
    bottom: 7px;
    right: 9px;
    font-size: 12px;
    color: var(--red);
    font-weight: 700;
    text-align: right;
    line-height: 1.3;
}

/* Tamil month name — only on Tamil month day 1 */
.panch-cal-month {
    display: block;
    font-size: 10px;
    color: var(--red-dark);
    font-weight: 700;
    white-space: nowrap;
}

.panch-cal-selected {
    background: var(--red-muted) !important;
    border: 2px solid var(--red) !important;
}

.panch-cal-selected .panch-cal-day {
    color: var(--white);
    background: var(--red);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.panch-cal-empty { background: #FAFAFA; }

/* ── Responsive: Panchangam ──────────────────────────────── */
@media (max-width: 768px) {

    .panch-grid {
        grid-template-columns: 1fr;
        padding: 16px 14px 24px;
    }

    .panch-hero {
        flex-direction: column;
        gap: 12px;
    }

    .panch-hero-right {
        display: flex;
        align-items: baseline;
        gap: 14px;
        text-align: left;
        min-width: 0;
    }

    .panch-hero-date { font-size: 36px; }
    .panch-eng-day   { font-size: 40px; }
    .panch-eng-month { margin-top: 0; }
    .panch-eng-weekday { margin-top: 0; }

    .panch-cal-table td { height: 110px; }
    .panch-cal-day { font-size: 22px; }
    .panch-cal-tamil { font-size: 10px; bottom: 6px; right: 7px; }
    .cal-evt { font-size: 13px; }
}

/* ============================================================
   Monthly Panchangam Page
   ============================================================ */

.monthly-grid {
    padding: 24px 20px 32px;
    max-width: 100%;
}

/* Nav: always 3 items in one row */
.monthly-nav {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.monthly-nav-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--black);
    font-family: var(--font-serif);
}

.monthly-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--red);
    text-decoration: none;
    padding: 7px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background var(--transition), border-color var(--transition);
    white-space: nowrap;
}

.monthly-nav-btn:hover {
    background: var(--red-muted);
    border-color: var(--red);
}

.monthly-cal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.monthly-cal-table th {
    padding: 12px 6px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    background: #F7F7F7;
}

.monthly-cal-table td {
    border: 1px solid var(--border);
    height: 130px;
    vertical-align: top;
    padding: 0;
}

.monthly-cal-link {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 130px;
    padding: 10px 12px 28px;
    text-decoration: none;
    color: var(--charcoal);
    transition: background var(--transition);
    position: relative;
    overflow: hidden;
}

.monthly-cal-link:hover { background: var(--red-muted); }

.monthly-cal-day {
    font-size: 26px;
    font-weight: 700;
    color: var(--black);
    line-height: 1;
    margin-bottom: 6px;
}

.monthly-cal-nakshatra {
    font-size: 12px;
    color: var(--charcoal);
    font-weight: 500;
    line-height: 1.4;
}

.monthly-cal-events {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 4px;
}

.monthly-cal-events .cal-evt { font-size: 14px; }

.monthly-cal-tamil {
    position: absolute;
    bottom: 7px;
    right: 9px;
    font-size: 12px;
    color: var(--red);
    font-weight: 700;
    text-align: right;
    line-height: 1.3;
}

.monthly-cal-empty { background: #FAFAFA; }

.monthly-cal-selected {
    background: var(--red-muted) !important;
    border: 2px solid var(--red) !important;
}

.monthly-cal-selected .monthly-cal-day {
    color: var(--white);
    background: var(--red);
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
}

@media (max-width: 768px) {
    .monthly-grid { padding: 12px 10px 20px; }
    .monthly-nav { gap: 6px; }
    .monthly-nav-title { font-size: 16px; }
    .monthly-nav-btn { padding: 6px 10px; font-size: 12px; }
    .monthly-cal-table td { height: 90px; }
    .monthly-cal-table th { font-size: 11px; padding: 8px 4px; }
    .monthly-cal-link { min-height: 90px; padding: 8px 8px 22px; }
    .monthly-cal-day { font-size: 18px; }
    .monthly-cal-nakshatra { font-size: 10px; }
    .monthly-cal-tamil { font-size: 10px; }
}
