/* CSP helpers: replace inline style="..." so style-src can drop 'unsafe-inline' */
.overflow-visible {
    overflow: visible;
}
.border-0 {
    border: 0;
}

body {
    font-family: 'Inter', sans-serif;
}

.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-shadow {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.input-focus:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.table-row:hover {
    background-color: #f8fafc;
}

/* Answer-first result treatment (roadmap 1.3) */
.next-amavasya-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd6fe;
    background: linear-gradient(135deg, #faf5ff 0%, #eef2ff 100%);
}

.next-amavasya-hero::before,
.next-amavasya-hero::after {
    content: '';
    position: absolute;
    border-radius: 9999px;
    pointer-events: none;
}

.next-amavasya-hero::before {
    width: 10rem;
    height: 10rem;
    top: -5rem;
    right: -3rem;
    background: rgba(196, 181, 253, 0.32);
    filter: blur(18px);
}

.next-amavasya-hero::after {
    width: 7rem;
    height: 7rem;
    bottom: -4rem;
    left: 28%;
    background: rgba(191, 219, 254, 0.45);
    filter: blur(16px);
}

.next-amavasya-hero__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.next-amavasya-hero__icon {
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    color: #ffffff;
    background: linear-gradient(135deg, #9333ea 0%, #4f46e5 100%);
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.25);
}

.next-amavasya-hero__eyebrow {
    margin: 0 0 0.2rem;
    color: #6d28d9;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.next-amavasya-hero__title {
    margin: 0;
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
}

.next-amavasya-hero__detail {
    margin: 0.25rem 0 0;
    color: #4b5563;
    font-size: 0.95rem;
}

.next-amavasya-hero__date {
    color: #374151;
    font-weight: 600;
}

.next-amavasya-hero__relative {
    color: #6d28d9;
    font-weight: 700;
}

.result-row--past {
    opacity: 0.52;
}

.result-row--next {
    background: linear-gradient(90deg, #faf5ff 0%, #eef2ff 100%);
    box-shadow: inset 4px 0 0 #8b5cf6;
}

.result-row--next:hover {
    background: linear-gradient(90deg, #f3e8ff 0%, #e0e7ff 100%);
}

@media (max-width: 640px) {
    .next-amavasya-hero__content {
        align-items: flex-start;
    }

    .next-amavasya-hero__icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.9rem;
    }

    .next-amavasya-hero__title {
        font-size: 1.1rem;
    }
}

.kshaya-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.variant-badge {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

.coord-help {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.coord-help .info-icon {
    cursor: help;
    transition: color 0.2s ease, transform 0.2s ease;
}

.coord-help:hover .info-icon,
.coord-help:focus .info-icon,
.coord-help:focus-within .info-icon {
    color: #9333ea !important;
    transform: scale(1.15);
}

.coord-help:focus {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

.coord-help-bubble {
    position: absolute;
    left: 50%;
    top: calc(100% + 0.75rem);
    margin-top: 0;
    width: 20rem;
    transform: translateX(-50%) translateY(4px);
    padding: 0;
    border: none;
    border-radius: 1rem;
    background: white;
    color: #374151;
    box-shadow:
        0 4px 6px -1px rgba(147, 51, 234, 0.05),
        0 10px 30px -5px rgba(147, 51, 234, 0.1),
        0 20px 60px -10px rgba(147, 51, 234, 0.08);
    font-size: 0.8rem;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    z-index: 50;
}

/* Triangle arrow */
.coord-help-bubble::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 0.5rem solid transparent;
    border-right: 0.5rem solid transparent;
    border-bottom: 0.5rem solid white;
}

/* Colored top strip */
.coord-help-bubble::after {
    content: '';
    position: absolute;
    top: -0.35rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2.5rem;
    height: 0.35rem;
    border-radius: 0.5rem 0.5rem 0 0;
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

.coord-help:hover .coord-help-bubble,
.coord-help:focus .coord-help-bubble,
.coord-help:focus-within .coord-help-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* City autocomplete dropdown */
.city-autocomplete {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    max-height: 18rem;
    overflow-y: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    z-index: 50;
    list-style: none;
    padding: 0;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
    color: #374151;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #f3e8ff;
    color: #6b21a8;
}

.autocomplete-item strong {
    font-weight: 600;
    color: #111827;
}

.autocomplete-item span {
    font-size: 0.8rem;
    color: #6b7280;
}

.autocomplete-item:hover span,
.autocomplete-item.active span {
    color: #6b21a8;
}

/* No-results / helper text inside dropdown */
.autocomplete-empty {
    padding: 0.75rem 1rem;
    color: #6b7280;
    font-size: 0.9rem;
}

/* Compact, responsive form rows */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

/* .hidden (display:none) and .form-row (display:flex) have equal
   specificity, so source order decides the winner. This rule adds
   specificity so the hidden state always wins regardless of order. */
.form-row.hidden {
    display: none;
}

.form-row>.field-year {
    flex: 0 0 6rem;
    min-width: 0;
}

.form-row>.field-city {
    flex: 1 1 0;
    min-width: 12rem;
}

.form-row>.field-coord,
.form-row>.field-tz {
    flex: 1 1 0;
    min-width: 10rem;
}

.label-compact {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    line-height: 1rem;
    color: #4b5563;
}

.input-compact {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    min-height: 2.25rem;
    box-sizing: border-box;
}

/* Matches .input-compact's actual rendered height (incl. its 1px border) */
.form-btn-height {
    min-height: 2.375rem;
}

.tz-display {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    min-height: 2.25rem;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.tz-edit-btn {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    flex: 0 0 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
