/* ============================================
   KUNDALI CSS - Extracted from inline styles
   ============================================ */
* { transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* CSS Variables */
:root {
    --background: #ffffff; --foreground: #000000; --border: #e5e7eb;
    --muted-foreground: #6b7280; --accent: #f3f4f6;
    --sidebar-width: 240px;
}
html.dark {
    --background: #000000; --foreground: #f0f0f0; --border: #333333;
    --muted-foreground: #999999; --accent: #1e1e1e;
    color-scheme: dark;
}
body { background-color: var(--background); color: var(--foreground); }

/* Logo switching */
.logo-light { display: block; }
.logo-dark { display: none; }
.dark .logo-light { display: none; }
.dark .logo-dark { display: block; }

/* ============================================
   HEADER
   ============================================ */
#app-header .header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Hamburger toggle */
#hamburger-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--background);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
#hamburger-toggle:hover {
    background-color: var(--accent);
}
#hamburger-toggle svg {
    width: 18px; height: 18px;
    color: var(--muted-foreground);
}

/* ============================================
   SETTINGS PANEL
   ============================================ */
#settings-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease;
    border-bottom: 1px solid var(--border);
    background: var(--background);
}
#settings-panel.open {
    max-height: 300px;
    opacity: 1;
}
#settings-panel .settings-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 16px;
}
.settings-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.settings-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.settings-select {
    width: 100%;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--foreground);
    padding: 0 10px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.settings-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
html.dark #settings-panel { background: #000; border-bottom-color: #333; }
html.dark .settings-select { background: #000; border-color: #333; color: #f0f0f0; }
html.dark .settings-select:focus { border-color: #666; }
@media (max-width: 768px) {
    .settings-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   BIRTH FORM CONTAINER
   ============================================ */
#birth-form-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 16px 0 16px;
}
#birth-data-form { margin-bottom: 0 !important; }

/* ============================================
   APP LAYOUT (sidebar + content)
   ============================================ */
#app-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ============================================
   SIDEBAR STYLES
   ============================================ */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    align-self: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border);
    background-color: var(--background);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 40;
}
#sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
    overflow: hidden;
}
#sidebar.collapsed .sidebar-content { opacity: 0; pointer-events: none; }
.sidebar-content {
    opacity: 1;
    transition: opacity 0.2s ease;
    width: var(--sidebar-width);
}

/* Sidebar scrollbar */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
#sidebar::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Sidebar menu items */
.sidebar-menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; margin: 2px 8px;
    border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 450;
    color: var(--muted-foreground);
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}
.sidebar-menu-item:hover {
    background-color: var(--accent);
    color: var(--foreground);
}
.sidebar-menu-item.active {
    background-color: var(--accent);
    color: var(--foreground);
    font-weight: 600;
}
.sidebar-menu-item svg { flex-shrink: 0; width: 18px; height: 18px; }

.sidebar-section-label {
    padding: 16px 16px 6px 16px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--muted-foreground);
    opacity: 0.7;
}
.sidebar-section-label:first-child { padding-top: 8px; }

.sidebar-divider {
    height: 1px; background: var(--border);
    margin: 8px 16px;
}

/* Main content area */
#app-content {
    flex: 1;
    min-width: 0;
    padding-left: 24px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#main-content {
    transition: opacity 0.15s ease;
}

/* ============================================
   DARK MODE OVERRIDES
   ============================================ */
html.dark header { background-color: #000000; border-bottom: 1px solid #333333; box-shadow: 0 1px 3px rgba(255,255,255,0.05); }
html.dark .bg-white { background-color: #000000 !important; }
html.dark .bg-gray-50 { background-color: #000000 !important; }
html.dark .border-gray-200, html.dark .border-gray-300 { border-color: #333333 !important; }
html.dark .text-gray-900, html.dark .text-gray-800 { color: #f0f0f0 !important; }
html.dark .text-gray-700, html.dark .text-gray-600 { color: #cccccc !important; }
html.dark .text-gray-500, html.dark .text-gray-400 { color: #999999 !important; }
html.dark .shadow-sm { box-shadow: 0 1px 2px 0 rgba(255,255,255,0.05) !important; }

/* Dark sidebar */
html.dark #sidebar { background-color: #000000; border-right-color: #333333; }
html.dark #sidebar::-webkit-scrollbar-thumb { background: #333333; }
html.dark #hamburger-toggle { background-color: #000000; border-color: #333333; }
html.dark #hamburger-toggle:hover { background-color: #1e1e1e; }
html.dark #hamburger-toggle svg { color: #999999; }
html.dark .sidebar-menu-item { color: #999999; }
html.dark .sidebar-menu-item:hover { background-color: #1e1e1e; color: #f0f0f0; }
html.dark .sidebar-menu-item.active { background-color: #1e1e1e; color: #f0f0f0; }

/* Dark mode inputs */
html.dark input[type="text"], html.dark input[type="date"], html.dark input[type="time"],
html.dark input[type="search"], html.dark select {
    background-color: #000000 !important; border: 1px solid #333333 !important; color: #f0f0f0 !important;
}
html.dark input:focus, html.dark select:focus {
    background-color: #1e1e1e !important; border-color: #666666 !important;
}
html.dark input::placeholder { color: #666666 !important; }
html.dark input::-webkit-calendar-picker-indicator { filter: invert(1); }

/* Dark mode buttons */
html.dark button:not([type="submit"]):not(.btn-primary):not(#hamburger-toggle) {
    background-color: #000000 !important; color: #f0f0f0 !important; border: 1px solid #333333 !important;
}
html.dark button:not([type="submit"]):not(.btn-primary):not(#hamburger-toggle):hover:not(:disabled) {
    background-color: #1e1e1e !important; border-color: #666666 !important;
}
html.dark button[type="submit"] {
    background-color: #ffffff !important; color: #000000 !important; border: 1px solid #ffffff !important;
}
html.dark button[type="submit"]:hover:not(:disabled) {
    background-color: #f0f0f0 !important;
}
html.dark #theme-toggle { background-color: #1e1e1e !important; border: 1px solid #333333 !important; color: #f0f0f0 !important; }
html.dark #theme-toggle:hover { background-color: #333333 !important; border-color: #666666 !important; }
html.dark #user-avatar { background-color: #333333 !important; color: #f0f0f0 !important; border: 1px solid #666666 !important; }
html.dark #header-search { background-color: #000000 !important; border: 1px solid #333333 !important; color: #f0f0f0 !important; }
html.dark #header-search::placeholder { color: #666666 !important; }
html.dark #header-search:focus { background-color: #1e1e1e !important; border-color: #666666 !important; }
html.dark #lang-menu { background-color: #000000 !important; border: 1px solid #333333 !important; }
html.dark #lang-menu a:hover { background-color: #1e1e1e !important; }
html.dark #lang-menu a { color: #999999; }
html.dark a { color: #999999; }
html.dark a:hover { color: #cccccc; }
html.dark .hover\:bg-gray-50:hover { background-color: #1e1e1e !important; }

/* Dark mode for new sections */
html.dark #dasha-timeline-section,
html.dark #dasha-subperiods-section,
html.dark #life-prediction-section,
html.dark #transits-section,
html.dark #learning-video-section { background-color: #000000 !important; border-color: #333333 !important; }
html.dark .desktop-controls select,
html.dark .mobile-controls select { background-color: #000000 !important; border-color: #333333 !important; color: #f0f0f0 !important; }
html.dark .desktop-controls button,
html.dark .mobile-controls button { background-color: #000000 !important; border-color: #333333 !important; color: #f0f0f0 !important; }
html.dark #yearValue { background-color: #000000 !important; color: #f0f0f0 !important; }

/* ============================================
   LOCATION SUGGESTIONS
   ============================================ */
#location-suggestions {
    border-top: none;
    border-radius: 0 0 8px 8px;
}
.location-suggestion {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
}
.location-suggestion:last-child { border-bottom: none; }
.location-suggestion:hover { background-color: #f9fafb; }
html.dark #location-suggestions { background-color: #000000 !important; border: 1px solid #333333 !important; }
html.dark .location-suggestion { border-bottom-color: #222; }
html.dark .location-suggestion:hover { background-color: #1e1e1e !important; }

/* Smooth scroll */
html { scroll-behavior: smooth; scroll-padding-top: 60px; }

/* ============================================
   PANCHANG SECTION
   ============================================ */
.panchang-card {
    border-radius: 10px; padding: 10px 14px;
    display: flex; flex-direction: column; gap: 2px;
    min-width: 0; flex: 1;
}
.panchang-card .card-icon { font-size: 16px; margin-bottom: 2px; }
.panchang-card .card-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; }
.panchang-card .card-value { font-size: 13px; font-weight: 700; line-height: 1.3; }
.panchang-card .card-sub { font-size: 11px; opacity: 0.65; }

.panchang-card.tithi { background: #fef3c7; color: #92400e; }
.panchang-card.nakshatra { background: #dbeafe; color: #1e40af; }
.panchang-card.yoga { background: #d1fae5; color: #065f46; }
.panchang-card.karana { background: #fce7f3; color: #9d174d; }
.panchang-card.vara { background: #ede9fe; color: #5b21b6; }

html.dark .panchang-card.tithi { background: #422006; color: #fcd34d; }
html.dark .panchang-card.nakshatra { background: #172554; color: #93c5fd; }
html.dark .panchang-card.yoga { background: #052e16; color: #6ee7b7; }
html.dark .panchang-card.karana { background: #500724; color: #f9a8d4; }
html.dark .panchang-card.vara { background: #2e1065; color: #c4b5fd; }

.status-card {
    border-radius: 8px; padding: 8px 12px;
    display: flex; align-items: center; gap: 10px;
    flex: 1; min-width: 0;
    border: 1px solid var(--border);
    background: var(--background);
}
.status-card .status-icon {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}
.status-card .status-label { font-size: 10px; color: var(--muted-foreground); }
.status-card .status-value { font-size: 12px; font-weight: 600; }

.status-icon.green { background: #d1fae5; color: #059669; }
.status-icon.yellow { background: #fef3c7; color: #d97706; }
.status-icon.blue { background: #dbeafe; color: #2563eb; }
html.dark .status-icon.green { background: #052e16; color: #6ee7b7; }
html.dark .status-icon.yellow { background: #422006; color: #fcd34d; }
html.dark .status-icon.blue { background: #172554; color: #93c5fd; }

/* ============================================
   CHART CONTROLS & DISPLAY
   ============================================ */
.desktop-controls { display: block; }
.mobile-controls { display: none !important; }

#charts-display {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 32px;
    margin-top: 8px;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}
.chart-section { width: 440px; flex-shrink: 0; }
.chart-section svg { width: 100%; max-width: 440px; height: auto; }

/* Tablet */
@media (max-width: 960px) and (min-width: 769px) {
    #charts-display { gap: 20px; }
    .chart-section { width: 400px; }
}
/* Mobile */
@media (max-width: 768px) {
    .desktop-controls { display: none !important; }
    .mobile-controls { display: block !important; }
    #charts-display { flex-direction: column; align-items: center; gap: 24px; }
    .chart-section { width: 100%; max-width: 440px; }
    .panchang-cards-row { flex-direction: column !important; }
    .status-cards-row { flex-direction: column !important; }
}

/* ============================================
   TWO-COLUMN GRID LAYOUTS
   ============================================ */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.two-col-grid-60-40 {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
}
.section-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    background: var(--background);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
html.dark .section-card {
    border-color: #333333;
    box-shadow: 0 1px 3px rgba(255,255,255,0.02);
}
.section-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Collapsible section */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}
.collapsible-header .collapse-icon {
    transition: transform 0.3s ease;
    width: 20px;
    height: 20px;
    color: var(--muted-foreground);
}
.collapsible-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}
.collapsible-body {
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    max-height: 600px;
    opacity: 1;
}
.collapsible-body.collapsed {
    max-height: 0;
    opacity: 0;
}

/* Scroll targets */
.scroll-target {
    scroll-margin-top: 60px;
}

/* Mobile: sidebar as overlay */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        top: 56px; left: 0;
        z-index: 45;
        max-height: calc(100vh - 56px);
        box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    }
    #sidebar.collapsed { transform: translateX(-100%); }
    #sidebar-overlay {
        display: none; position: fixed; inset: 0; top: 56px;
        background: rgba(0,0,0,0.3); z-index: 44;
    }
    #sidebar-overlay.show { display: block; }
}

/* Responsive: stack grids on mobile */
@media (max-width: 768px) {
    .two-col-grid,
    .two-col-grid-60-40 {
        grid-template-columns: 1fr;
    }
    #main-content [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }
    #main-content [style*="grid-template-columns:repeat(3"] {
        grid-template-columns: 1fr !important;
    }
    #main-content [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
