/* ============================================================
   VedIntel™ AstroAPI — Widget Styles
   Three themes: cosmic (dark), light, minimal
   ============================================================ */

/* ── CSS Custom Properties ── */
.vi-widget {
    --vi-radius:     12px;
    --vi-radius-sm:  8px;
    --vi-radius-xs:  5px;
    --vi-font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --vi-font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --vi-transition: 0.2s ease;

    font-family: var(--vi-font);
    box-sizing: border-box;
    line-height: 1.6;
}

.vi-widget *, .vi-widget *::before, .vi-widget *::after {
    box-sizing: inherit;
}

/* ── Theme: Cosmic (Dark) ── */
.vi-theme-cosmic {
    --vi-bg:           #0A0F1E;
    --vi-bg-card:      #111827;
    --vi-bg-elevated:  #1a2235;
    --vi-border:       rgba(79, 70, 229, 0.25);
    --vi-border-hover: rgba(79, 70, 229, 0.6);
    --vi-text-1:       #f1f5f9;
    --vi-text-2:       #94a3b8;
    --vi-text-3:       #64748b;
    --vi-accent:       #4F46E5;
    --vi-accent-light: #818cf8;
    --vi-gold:         #F59E0B;
    --vi-gold-light:   #fcd34d;
    --vi-success:      #10b981;
    --vi-error:        #ef4444;
    --vi-shadow:       0 4px 24px rgba(0,0,0,0.4);
    --vi-shadow-lg:    0 8px 48px rgba(0,0,0,0.6);

    background: var(--vi-bg);
    color: var(--vi-text-1);
    border-radius: var(--vi-radius);
    padding: 28px;
    border: 1px solid var(--vi-border);
    box-shadow: var(--vi-shadow);
}

/* ── Theme: Light ── */
.vi-theme-light {
    --vi-bg:           #ffffff;
    --vi-bg-card:      #f8fafc;
    --vi-bg-elevated:  #f1f5f9;
    --vi-border:       #e2e8f0;
    --vi-border-hover: #94a3b8;
    --vi-text-1:       #0f172a;
    --vi-text-2:       #475569;
    --vi-text-3:       #94a3b8;
    --vi-accent:       #4F46E5;
    --vi-accent-light: #6366f1;
    --vi-gold:         #d97706;
    --vi-gold-light:   #f59e0b;
    --vi-success:      #059669;
    --vi-error:        #dc2626;
    --vi-shadow:       0 2px 12px rgba(0,0,0,0.08);
    --vi-shadow-lg:    0 6px 32px rgba(0,0,0,0.12);

    background: var(--vi-bg);
    color: var(--vi-text-1);
    border-radius: var(--vi-radius);
    padding: 28px;
    border: 1px solid var(--vi-border);
    box-shadow: var(--vi-shadow);
}

/* ── Theme: Minimal ── */
.vi-theme-minimal {
    --vi-bg:           transparent;
    --vi-bg-card:      transparent;
    --vi-bg-elevated:  rgba(0,0,0,0.04);
    --vi-border:       #e2e8f0;
    --vi-border-hover: #cbd5e1;
    --vi-text-1:       inherit;
    --vi-text-2:       #64748b;
    --vi-text-3:       #94a3b8;
    --vi-accent:       #4F46E5;
    --vi-accent-light: #6366f1;
    --vi-gold:         #d97706;
    --vi-gold-light:   #f59e0b;
    --vi-success:      #059669;
    --vi-error:        #dc2626;
    --vi-shadow:       none;
    --vi-shadow-lg:    none;

    background: var(--vi-bg);
    color: var(--vi-text-1);
    padding: 0;
}

/* ============================================================
   WIDGET TITLE
   ============================================================ */
.vi-widget-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--vi-text-1);
    margin: 0 0 20px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--vi-border);
    letter-spacing: -0.01em;
}

/* ============================================================
   KUNDALI LAYOUT
   ============================================================ */
.vi-kundali-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 720px) {
    .vi-kundali-layout {
        grid-template-columns: 1fr;
    }
}

.vi-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.vi-chart-img {
    max-width: 100%;
    height: auto;
    border-radius: var(--vi-radius-sm);
    border: 1px solid var(--vi-border);
}

.vi-chart-caption {
    font-size: 0.7rem;
    color: var(--vi-text-3);
    text-align: center;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.vi-chart-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================================
   PLANETS TABLE
   ============================================================ */
.vi-planets-table-wrap {
    overflow-x: auto;
    border-radius: var(--vi-radius-sm);
    border: 1px solid var(--vi-border);
}

.vi-planets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.vi-planets-table thead tr {
    background: var(--vi-bg-elevated);
}

.vi-planets-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--vi-text-2);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--vi-border);
}

.vi-planets-table td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--vi-border);
    color: var(--vi-text-1);
}

.vi-planets-table tbody tr:last-child td {
    border-bottom: none;
}

.vi-planets-table tbody tr:hover {
    background: var(--vi-bg-elevated);
}

.vi-planet-name {
    font-weight: 600;
    color: var(--vi-accent-light) !important;
}

.vi-retro {
    color: var(--vi-gold);
    font-size: 0.75em;
    margin-left: 2px;
}

/* ============================================================
   DASHA CARD (compact, inside chart widget)
   ============================================================ */
.vi-dasha-card {
    background: var(--vi-bg-elevated);
    border: 1px solid var(--vi-border);
    border-radius: var(--vi-radius-sm);
    padding: 14px 16px;
}

.vi-dasha-card-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--vi-text-3);
    margin-bottom: 10px;
}

.vi-dasha-card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.vi-dasha-badge {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.vi-badge-maha {
    background: rgba(79, 70, 229, 0.2);
    color: var(--vi-accent-light);
    border: 1px solid rgba(79, 70, 229, 0.4);
}

.vi-badge-antar {
    background: rgba(245, 158, 11, 0.15);
    color: var(--vi-gold-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.vi-dasha-card-end {
    font-size: 0.78rem;
    color: var(--vi-text-2);
}

/* ============================================================
   DASHA WIDGET (full standalone)
   ============================================================ */
.vi-dasha-widget .vi-dasha-tree {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.vi-dasha-row {
    display: grid;
    grid-template-columns: 130px 1fr 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--vi-border);
}

.vi-dasha-row:last-child {
    border-bottom: none;
}

.vi-dasha-maha    { background: rgba(79, 70, 229, 0.08); }
.vi-dasha-antar   { padding-left: 32px; background: rgba(79, 70, 229, 0.04); }
.vi-dasha-pratyantar { padding-left: 56px; }

.vi-dasha-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--vi-text-3);
}

.vi-dasha-planet {
    font-weight: 700;
    font-size: 1rem;
    color: var(--vi-accent-light);
}

.vi-dasha-dates {
    font-size: 0.8rem;
    color: var(--vi-text-2);
    font-family: var(--vi-font-mono);
}

.vi-dasha-upcoming {
    margin-top: 20px;
    border-top: 1px solid var(--vi-border);
    padding-top: 16px;
}

.vi-dasha-upcoming-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--vi-text-3);
    margin-bottom: 10px;
}

.vi-dasha-seq-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--vi-border);
    font-size: 0.83rem;
    color: var(--vi-text-2);
}

.vi-dasha-seq-row:last-child { border-bottom: none; }
.vi-dasha-seq-row span:first-child { font-weight: 600; color: var(--vi-text-1); }

/* ============================================================
   PANCHANG WIDGET
   ============================================================ */
.vi-panchang-widget .vi-panchang-date {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--vi-gold);
    margin-bottom: 16px;
}

.vi-panchang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0;
    margin: 0;
    border: 1px solid var(--vi-border);
    border-radius: var(--vi-radius-sm);
    overflow: hidden;
}

.vi-panchang-grid dt,
.vi-panchang-grid dd {
    padding: 10px 14px;
    border-bottom: 1px solid var(--vi-border);
    margin: 0;
}

.vi-panchang-grid dt {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--vi-text-3);
    background: var(--vi-bg-elevated);
}

.vi-panchang-grid dd {
    font-size: 0.9rem;
    color: var(--vi-text-1);
    font-weight: 500;
}

/* ============================================================
   COMPATIBILITY WIDGET
   ============================================================ */
.vi-compat-widget .vi-compat-score {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.vi-score-ring {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.vi-ring-svg {
    width: 80px;
    height: 80px;
    transform: rotate(-90deg);
}

.vi-ring-bg {
    fill: none;
    stroke: var(--vi-bg-elevated);
    stroke-width: 7;
}

.vi-ring-fill {
    fill: none;
    stroke: var(--vi-accent);
    stroke-width: 7;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
}

.vi-score-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.vi-score-num {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--vi-text-1);
    line-height: 1;
}

.vi-score-denom {
    font-size: 0.72rem;
    color: var(--vi-text-3);
}

.vi-compat-rating {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--vi-text-2);
}

.vi-rating-excellent { color: #10b981; }
.vi-rating-very-good { color: #34d399; }
.vi-rating-good      { color: var(--vi-gold); }
.vi-rating-average   { color: #fb923c; }
.vi-rating-below-average { color: var(--vi-error); }

.vi-koots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.vi-koot-cell {
    background: var(--vi-bg-elevated);
    border: 1px solid var(--vi-border);
    border-radius: var(--vi-radius-xs);
    padding: 10px 12px;
}

.vi-koot-name {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--vi-text-3);
    margin-bottom: 4px;
}

.vi-koot-score {
    font-size: 1rem;
    font-weight: 700;
    color: var(--vi-text-1);
    margin-bottom: 6px;
}

.vi-koot-bar {
    height: 4px;
    background: var(--vi-bg);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--vi-border);
}

.vi-koot-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--vi-accent), var(--vi-gold));
    border-radius: 999px;
    transition: width 0.8s ease;
}

/* ============================================================
   AI WIDGET
   ============================================================ */
.vi-ai-widget .vi-ai-meta {
    background: var(--vi-bg-elevated);
    border: 1px solid var(--vi-border);
    border-radius: var(--vi-radius-sm);
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 0.82rem;
    color: var(--vi-text-2);
}

.vi-ai-streaming {
    min-height: 80px;
}

.vi-ai-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px;
}

.vi-ai-loader-dots {
    display: flex;
    gap: 6px;
}

.vi-ai-loader-dots span {
    width: 8px;
    height: 8px;
    background: var(--vi-accent);
    border-radius: 50%;
    animation: vi-bounce 1.2s infinite;
}

.vi-ai-loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.vi-ai-loader-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes vi-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1;   }
}

.vi-ai-loader-text {
    font-size: 0.85rem;
    color: var(--vi-text-2);
    font-style: italic;
}

.vi-ai-content {
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--vi-text-1);
}

.vi-ai-content h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--vi-accent-light);
    margin: 20px 0 8px;
    border-bottom: 1px solid var(--vi-border);
    padding-bottom: 6px;
}

.vi-ai-content h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--vi-gold);
    margin: 16px 0 6px;
}

.vi-ai-content p { margin: 0 0 12px; }
.vi-ai-content strong { color: var(--vi-text-1); font-weight: 600; }

/* ============================================================
   INTERACTIVE FORM WIDGET
   ============================================================ */
.vi-form-wrapper .vi-birth-form {
    margin-top: 4px;
}

.vi-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}

@media (max-width: 520px) {
    .vi-form-grid { grid-template-columns: 1fr; }
}

.vi-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vi-field--full {
    grid-column: 1 / -1;
}

.vi-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--vi-text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vi-req {
    color: var(--vi-error);
    margin-left: 2px;
}

.vi-field input[type="text"],
.vi-field input[type="time"] {
    background: var(--vi-bg-elevated);
    border: 1px solid var(--vi-border);
    border-radius: var(--vi-radius-xs);
    color: var(--vi-text-1);
    padding: 9px 13px;
    font-size: 0.9rem;
    font-family: var(--vi-font);
    transition: border-color var(--vi-transition), box-shadow var(--vi-transition);
    outline: none;
    width: 100%;
}

.vi-field input:focus {
    border-color: var(--vi-accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.vi-city-wrap {
    position: relative;
}

.vi-city-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--vi-bg-card);
    border: 1px solid var(--vi-border);
    border-radius: var(--vi-radius-xs);
    box-shadow: var(--vi-shadow-lg);
    z-index: 999;
    max-height: 220px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.vi-city-suggestions li {
    padding: 9px 14px;
    font-size: 0.88rem;
    color: var(--vi-text-1);
    cursor: pointer;
    transition: background var(--vi-transition);
}

.vi-city-suggestions li:hover,
.vi-city-suggestions li.vi-active {
    background: var(--vi-bg-elevated);
    color: var(--vi-accent-light);
}

.vi-partner-section {
    border-top: 1px solid var(--vi-border);
    padding-top: 14px;
    margin-top: 4px;
}

.vi-section-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--vi-gold);
    margin-bottom: 12px;
}

/* ── Submit Button ── */
.vi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 28px;
    border-radius: var(--vi-radius-xs);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--vi-font);
    cursor: pointer;
    transition: all var(--vi-transition);
    border: none;
    outline: none;
    letter-spacing: 0.02em;
}

.vi-btn--primary {
    background: linear-gradient(135deg, var(--vi-accent), #7c3aed);
    color: #fff;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.35);
}

.vi-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.5);
}

.vi-btn--primary:active { transform: translateY(0); }

.vi-btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.vi-btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vi-spin 0.7s linear infinite;
}

@keyframes vi-spin {
    to { transform: rotate(360deg); }
}

/* ── Form results ── */
.vi-result {
    margin-top: 24px;
    animation: vi-fade-in 0.3s ease;
}

@keyframes vi-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.vi-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--vi-radius-xs);
    color: var(--vi-error);
    font-size: 0.88rem;
}

.vi-error-box {
    padding: 14px 18px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--vi-radius-xs);
    color: var(--vi-error);
    font-size: 0.88rem;
}

/* ============================================================
   POWERED BY FOOTER
   ============================================================ */
.vi-powered-by {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--vi-border);
    font-size: 0.72rem;
    color: var(--vi-text-3);
    text-align: right;
}

.vi-powered-by a {
    color: var(--vi-accent-light);
    text-decoration: none;
    font-weight: 600;
}

.vi-powered-by a:hover {
    text-decoration: underline;
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 480px) {
    .vi-widget { padding: 18px; }
    .vi-kundali-layout { gap: 18px; }
    .vi-dasha-row { grid-template-columns: 100px 1fr; }
    .vi-dasha-dates { grid-column: 1 / -1; }
    .vi-koots-grid { grid-template-columns: 1fr 1fr; }
}
