/* style.css - Same as before, no changes needed */

:root {
    /* Default Colors */
    --color-primary: #1e7e34;
    --color-primary-dark: #166b2a;
    --color-bg-primary: #eef2f7;
    --color-bg-sidebar: #f6f8fa;
    --color-bg-secondary: #ffffff;
    --color-bg-hover: #f3f4f6;
    --color-text-primary: #24292f;
    --color-text-secondary: #57606a;
    --color-text-muted: #6e7781;
    --color-border: #d0d7de;
    --color-border-hover: #6e7781;
    
    /* Node Colors */
    --node-subject: #FFD700;
    --node-chapter: #FFB6C1;
    --node-topic: #98FB98;
    --node-concept: #FFA07A;
    --node-description: #DDA0DD;
    
    /* Spacing */
    --sidebar-width: 320px;
    --sidebar-collapsed: 50px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-xxl: 24px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-family-hindi: 'Noto Sans Devanagari', 'Inter', sans-serif;
    --font-size-lg: 14px;
    --font-size-xl: 16px;
}

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

body {
    font-family: var(--font-family);
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

body.hindi-active {
    font-family: var(--font-family-hindi);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-bg-sidebar);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-content {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.sidebar.collapsed .sidebar-header {
    padding: var(--spacing-lg) 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    margin: 0 auto;
}

.sidebar-header {
    padding: var(--spacing-lg);
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.sidebar-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-toggle {
    width: 30px;
    height: 30px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-hover);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xl);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* ===== SECTIONS ===== */
.section {
    margin-bottom: var(--spacing-xxl);
}

.section h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 8px;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--spacing-xl) 0;
}

/* ===== RADIO GROUP ===== */
.radio-group {
    margin-bottom: 12px;
}

.radio-label {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
}

.radio-label input {
    margin-right: 8px;
}

/* ===== INSTRUCTIONS ===== */
.instructions {
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

/* ===== CONTENT INFO ===== */
.content-info {
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.content-info strong {
    color: var(--color-text-primary);
}

/* ===== LEGEND ===== */
.legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}
.legend-color.subject { background: #FFD700; }
.legend-color.chapter { background: #FFB6C1; }
.legend-color.topic { background: #98FB98; }
.legend-color.concept { background: #FFA07A; }
.legend-color.description { background: #DDA0DD; }

/* ===== NAVIGATION STYLES ===== */
.navigation-container {
    width: 100%;
}

.nav-links-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-section {
    background: var(--color-bg-secondary);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.nav-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
    text-transform: uppercase;
}

.nav-link {
    display: block;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--color-bg-hover);
    border-left-color: var(--color-primary);
    transform: translateX(4px);
}

.nav-link.active {
    background: #e8eef7;
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.nav-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-secondary);
}

/* ===== STICKY HEADER ===== */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg-secondary);
    padding: 8px 20px 8px 20px;
    border-bottom: 2px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-shrink: 0;
    min-height: 55px;
    flex-wrap: wrap;
}

.tabs-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    pointer-events: auto;
}

/* ===== MAIN TABS ROW - SIDE BY SIDE ===== */
.main-tabs-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

/* Main Tab - Light Red - Side by Side */
.tab-main {
    display: inline-block !important;
    width: auto !important;
    flex: 0 0 auto !important;
    min-width: auto !important;
    max-width: none !important;
    white-space: nowrap !important;
    padding: 7px 14px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    background: #ffcccc !important;
    border: 2px solid #ff9999 !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-family: inherit !important;
    color: #333 !important;
    box-shadow: 0 1px 3px rgba(255,0,0,0.1) !important;
    text-align: center !important;
    margin: 0 !important;
}

.tab-main:hover {
    background: #ffbbbb !important;
}

.tab-main.active {
    background: #ffaaaa !important;
    border-color: #ff6666 !important;
    box-shadow: 0 2px 8px rgba(255,0,0,0.25);
}

.tab-main .arrow {
    display: none;
}

/* ===== SUB-TABS CONTAINER - SIDE BY SIDE ===== */
.sub-tabs-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    padding: 6px 0 2px 0 !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

/* Sub-tabs - Light Red - Side by Side */
.tab-sub {
    display: inline-block !important;
    width: auto !important;
    flex: 0 0 auto !important;
    min-width: auto !important;
    max-width: none !important;
    white-space: nowrap !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    background: #ffcccc !important;
    border: 1.5px solid #ff9999 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-family: inherit !important;
    color: #333 !important;
    box-shadow: 0 1px 2px rgba(255,0,0,0.08) !important;
    margin: 0 !important;
}

.tab-sub:hover {
    background: #ffbbbb !important;
    transform: scale(1.03);
}

.tab-sub.active {
    background: #ffaaaa !important;
    border-color: #ff6666 !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(255,0,0,0.2);
}

/* Badge */
.badge {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--color-border);
    flex-shrink: 0;
    margin-top: 2px;
}

/* ===== CONTAINER FOR MIND MAP ===== */
#container {
    flex: 1;
    overflow: auto;
    position: relative;
    background: var(--color-bg-secondary);
    padding: 20px;
}

svg {
    display: block;
    margin: 0 auto;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.node rect {
    cursor: pointer;
    transition: filter 0.2s;
}

.node:hover rect {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.node text {
    user-select: none;
    pointer-events: none;
    fill: #000;
    font-family: inherit;
}

.connection path {
    stroke: #8f97b3;
    stroke-width: 2;
    fill: none;
    opacity: 0.8;
    transition: stroke 0.2s;
}

.connection:hover path {
    stroke: var(--color-primary);
}

/* ===== FOOTER ===== */
.footer {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--color-border);
}

/* ===== LOADING STATES ===== */
html.js-loading {
    visibility: hidden;
    opacity: 0;
}

html.js-loaded {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar {
    transition: none !important;
}

.sidebar.transitions-ready {
    transition: width 0.3s ease !important;
}

.sidebar.transitions-ready .sidebar-content {
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

/* ===== SCROLLBAR STYLES ===== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-tertiary, #f1f1f1);
}

::-webkit-scrollbar-thumb {
    background: #c0c7cf;
    border-radius: 6px;
    border: 3px solid var(--color-bg-tertiary, #f1f1f1);
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a9b3;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sticky-header {
        padding: 6px 12px 6px 12px;
        min-height: 48px;
    }
    .tabs-wrapper {
        max-width: 100%;
    }
    .tab-main {
        font-size: 12px !important;
        padding: 5px 10px !important;
    }
    .tab-sub {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }
    #container {
        padding: 12px;
    }
    .badge {
        font-size: 11px;
        padding: 4px 10px;
    }
}

@media (max-width: 480px) {
    .sticky-header {
        padding: 4px 6px 4px 6px;
        min-height: 42px;
    }
    .tab-main {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }
    .tab-sub {
        font-size: 10px !important;
        padding: 3px 6px !important;
    }
    #container {
        padding: 6px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar,
    .sticky-header {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
        background: white;
    }
    
    #container svg {
        background: white;
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .node text {
        fill: black;
    }
    
    .connection path {
        stroke: #666 !important;
    }
}

/* ===== FOCUS STATES ===== */
.sidebar-toggle:focus-visible,
.tab-main:focus-visible,
.tab-sub:focus-visible,
.nav-link:focus-visible,
.radio-label input:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ===== HINDI FONT SUPPORT ===== */
.hindi-active .node text,
.hindi-active .instructions,
.hindi-active .content-info,
.hindi-active .nav-link,
.hindi-active .nav-section-title,
.hindi-active .section h3,
.hindi-active .radio-label,
.hindi-active .footer {
    font-family: var(--font-family-hindi);
}
