:root {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --secondary: #fb7185;
    --accent: #fbbf24;
    --bg-deep: #020617;
    --card-glass: rgba(15, 23, 42, 0.6);
    --card-glass-hover: rgba(30, 41, 59, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-dim: #cbd5e0;
    --radius: 2rem;
    --shadow-float: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 80px rgba(129, 140, 248, 0.1);
    --surface-color: rgba(15, 23, 42, 0.8);
    --nav-height: 70px;
}

html {
    scroll-behavior: smooth;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background: 
        radial-gradient(circle at 0% 0%, rgba(129, 140, 248, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(251, 113, 133, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, #020617 0%, #0f172a 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-main);
    padding: var(--nav-height) 0.5rem 2rem; 
    line-height: 1.6;
    margin: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-wrap: break-word;
    word-wrap: break-word;
    -webkit-text-size-adjust: 100%;
}

.container {
    background: var(--card-glass);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    position: relative;
    box-sizing: border-box;
}

.container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    opacity: 0.6;
}

.container.result-view {
    max-width: 1200px;
    padding: 3rem 4rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem 0.5rem;
        border-radius: 0;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
    }
    .container.result-view {
        padding: 1.5rem 0.5rem;
        margin: 0 !important;
        max-width: 100vw !important;
    }
    .result-card {
        padding: 1.25rem 0.5rem !important; /* Edge-to-edge on mobile */
        border-radius: 1rem;
    }
    .kundli-header {
        margin-bottom: 2rem !important;
    }
}

h1 {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.result-view .tabs {
    display: none !important;
}

.result-view .new-calc-btn {
    display: inline-block !important;
}

.new-calc-btn:hover {
    background: var(--secondary) !important;
    color: #fff !important;
    box-shadow: 0 0 20px rgba(251, 113, 133, 0.3);
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.6rem;
        line-height: 1.1;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.4rem; line-height: 1.1; }
    h2 { font-size: 1.3rem !important; }
    p.subtitle { font-size: 0.9rem; margin-bottom: 1rem; line-height: 1.3; }
    .main-header-wrapper { justify-content: flex-start !important; gap: 10px !important; }
    :root {
        --shadow-float: 0 5px 15px rgba(0,0,0,0.3);
        --radius: 0.75rem;
    }
}

p.subtitle {
    text-align: center;
    color: var(--text-dim);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
    font-weight: 400;
}

.report-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.report-actions .btn {
    margin: 0;
    padding: 0.75rem 2rem;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 100px;
    cursor: pointer;
    transition: 0.3s;
    min-width: 160px;
    border: 1px solid transparent;
}

.report-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border-color: var(--border-glass);
}

.report-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.report-actions .btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.report-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.85rem 2rem;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: auto;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
    border-color: var(--primary);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 10px 20px -5px rgba(129, 140, 248, 0.4);
}

@media (max-width: 480px) {
    .tabs { gap: 0.75rem; }
    .tab-btn { padding: 0.75rem 1.25rem; font-size: 0.9rem; }
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
}

input,
select {
    width: 100%;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border-glass);
    border-radius: 1rem;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
    background: var(--surface-color);
    color: #fff;
    outline: none;
    appearance: none;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

input:focus,
select:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.15);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.grid-main {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .grid-2, .grid-main {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

button[type="submit"] {
    display: block;
    margin: 1.5rem auto 0;
    width: auto;
    min-width: 280px;
    padding: 1rem 3rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
    position: relative;
    overflow: hidden;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
    background: var(--primary-hover);
}





.result-section {
    margin-top: 0;
    display: none;
    animation: slideUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.kundli-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-glass);
}

.kundli-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #fff;
}

.kundli-info {
    font-size: 1.2rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.chart-data {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (max-width: 480px) {
    .chart-data {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
    .data-card {
        padding: 1rem 0.5rem;
    }
}

.data-card {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.75rem;
    border-radius: 1.5rem;
    text-align: center;
    border: 1px solid var(--border-glass);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.data-card:hover {
    background: var(--card-glass-hover);
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
}

.panchang-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-glass);
    border-radius: 1.25rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: 0.3s;
    cursor: help;
}

@media (max-width: 480px) {
    .panchang-item {
        padding: 0.75rem 0.85rem !important;
        gap: 4px !important;
        border-radius: 0.75rem !important;
    }
    .panchang-label {
        font-size: 0.6rem !important;
        letter-spacing: 0.5px !important;
        margin-bottom: 2px !important;
    }
    .panchang-value {
        font-size: 0.85rem !important;
    }
}

.data-card h3 {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.data-card p {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
}

.data-card .rashi-name {
    font-size: 0.95em;
    color: var(--secondary);
    margin-top: 0.5rem;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2rem 0;
}

th {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.25rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border-glass);
}

td {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    font-size: 1rem;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.result-card {
    background: var(--surface-color);
    border-radius: 1.5rem;
    border: 1px solid var(--border-glass);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* --- Loader Styling --- */
.loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 3rem;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(129, 140, 248, 0.1);
    border-radius: 50%;
    border-top: 3px solid var(--primary);
    border-right: 3px solid var(--secondary);
    animation: spin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    display: inline-block;
}

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

.lk-section {
    background: rgba(255, 255, 255, 0.01);
    border-radius: 1.5rem;
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-glass);
    border-left: 6px solid var(--primary);
}

.lk-collapse {
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.015);
    border-radius: 1.25rem;
    margin-bottom: 1.25rem;
}

.lk-summary {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.25rem 2rem;
    color: #fff;
    font-weight: 800;
}

.lk-summary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lk-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.lk-modal-overlay.open {
    display: flex;
}

.lk-modal-content {
    background: #0f172a;
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    border-radius: 1.5rem;
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}


.lk-modal-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom-color: var(--border-glass);
}

#profileManager {
    background: #1e293b !important;
    border: 1px solid var(--border-glass);
    color: #fff;
}

#manageProfilesBtn:hover {
    color: var(--secondary) !important;
}

.celestial-nav a {
    background: rgba(129, 140, 248, 0.15);
    border: 1px solid rgba(129, 140, 248, 0.4);
    backdrop-filter: blur(10px);
    color: #ffffff !important;
}

.celestial-nav {
    display: flex;
    gap: 1rem;
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .celestial-nav {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 2rem;
        justify-content: center;
        gap: 1rem;
    }
}

.celestial-nav a svg {
    stroke: #ffffff !important;
    opacity: 1 !important;
}

.celestial-nav a:hover {
    background: var(--primary);
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.4);
}

@media print {
    body { background: #fff; color: #000; }
    .container { background: #fff; border: none; box-shadow: none; color: #000; }
    th, td { border-color: #eee; color: #000; }
    .north-indian-chart svg { stroke: #000 !important; }
}

/* --- PDF Export Light Theme Override --- */
.pdf-export-mode {
    background: #ffffff !important;
    color: #000000 !important;
}

.pdf-export-mode .container,
.pdf-export-mode .result-card,
.pdf-export-mode .result-section,
.pdf-export-mode .tab-pane,
.pdf-export-mode .result-card div {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #000000 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.pdf-export-mode h1, 
.pdf-export-mode h2, 
.pdf-export-mode h3, 
.pdf-export-mode h4, 
.pdf-export-mode h5,
.pdf-export-mode th {
    color: #0f172a !important;
    background: none !important;
    -webkit-text-fill-color: initial !important;
    background-clip: initial !important;
}

.pdf-export-mode .kundli-info,
.pdf-export-mode p,
.pdf-export-mode td,
.pdf-export-mode .data-card p {
    color: #334155 !important;
}

.pdf-export-mode .north-indian-chart svg {
    background: #ffffff !important;
}

.pdf-export-mode .north-indian-chart svg g {
    stroke: #000000 !important;
    stroke-opacity: 1 !important;
}

.pdf-export-mode .planets-in-house {
    color: #000000 !important;
    text-shadow: none !important;
}

.pdf-export-mode .house-num {
    color: #64748b !important;
}

.pdf-export-mode table,
.pdf-export-mode tr,
.pdf-export-mode td,
.pdf-export-mode th {
    border-color: #cbd5e1 !important;
}

.pdf-export-mode .data-card {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
}

.pdf-export-mode .panchang-item {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
}

.pdf-export-mode .panchang-item div:last-child {
    color: #0f172a !important;
}

/* --- Global Navigation --- */
.global-nav {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none !important;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.3s ease;
    padding: 0.6rem 1.25rem;
    border-radius: 100px;
    border: 1px solid transparent !important;
    background: transparent !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-links a:hover, .nav-links a.active {
    color: #ffffff !important;
    background: rgba(129, 140, 248, 0.15) !important;
    border-color: rgba(129, 140, 248, 0.3) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-decoration: none !important;
}

.nav-links a i {
    opacity: 0.8;
}

.nav-links a:hover i {
    opacity: 1;
}

@media (max-width: 768px) {
    .global-nav {
        height: auto !important;
        padding: 0.75rem 1rem !important;
    }
    .nav-container {
        flex-direction: column !important;
        gap: 0.75rem !important;
        padding: 0 !important;
    }
    .nav-links {
        width: 100% !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 0.35rem 0.5rem !important;
    }
    .nav-links a { font-size: 0.7rem; padding: 0.5rem 0.75rem; letter-spacing: 0.5px; }
    .nav-logo { font-size: 1rem; }
}

/* --- Result Tabs --- */
.result-tabs-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.result-tabs-nav::-webkit-scrollbar { display: none; }

.result-tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 100px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-1px);
}

.result-tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.result-tab-btn.active::after {
    display: none;
}

.tab-pane {
    display: none;
    animation: tabFadeIn 0.4s ease-out;
}

.tab-pane.active {
    display: block;
}

@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.unified-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .unified-summary-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    th, td {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.85rem !important;
    }
}

.panchang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    width: 100%;
}

@media (max-width: 768px) {
    .panchang-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
}
