/* ==========================================================================
   STUDYAGORA - UNIFIED GLOBAL & SMART NOTES STYLESHEET
   Target Directory: /css/notes-style.css
   Theme: High-Contrast Dark Mode (UPSC & UPPCS GS2 Series)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ROOT VARIABLES & GLOBAL RESETS (STRICT OVERFLOW CONTROL)
   -------------------------------------------------------------------------- */
:root {
    --bg-color: #050505;
    --card-bg: #111111;
    --card-border: rgba(255, 255, 255, 0.05);
    
    /* Accent Palette */
    --accent-purple: #d400ff;
    --accent-pink: #ff00ff;
    --accent-blue: #00d4ff;
    --accent-gold: #ffd700;
    --accent-green: #39ff14;
    
    /* Typography Colors */
    --text-main: #e0e0e0;
    --text-dim: #b0b0b0;
    --text-white: #ffffff;
    
    /* Box Shadows & Glows */
    --glow-pink: 0 0 20px rgba(255, 0, 255, 0.4), 0 0 40px rgba(255, 0, 255, 0.2);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    width: 100%;
    max-width: 950px;
    margin: 0 auto;
    padding: 0 20px 40px;
    line-height: 1.7;
    animation: fadeIn 0.6s ease-in-out;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden !important; /* Strictly prevents main body horizontal scroll */
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.25s ease, text-shadow 0.25s ease;
}

a:hover {
    text-decoration: underline;
    text-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
}

/* --------------------------------------------------------------------------
   2. SITE NAVBAR (FIXED OVERFLOW ISSUE)
   -------------------------------------------------------------------------- */
.navbar {
    background: #000;
    padding: 12px clamp(16px, 4vw, 48px);
    min-height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #17121f;
    margin-bottom: 25px;
    width: 100%; /* Changed from 100vw to prevent horizontal scrollbar leak */
    box-sizing: border-box;
}

.nav-left {
    display: flex;
    align-items: center;
    min-width: 0;
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.nav-title {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.desktop-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(12px, 1.65vw, 23px);
    min-width: 0;
}

.desktop-menu a {
    color: #ccc;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.desktop-menu a:hover {
    color: #fff;
    text-decoration: none;
}

.desktop-menu a.active-link {
    color: #fff !important;
    text-decoration: none;
    position: relative;
}

.desktop-menu a.active-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -9px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #a855f7, #ff3fd5);
}

.prelims-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.prelims-nav-link i {
    color: #ff7a18;
}

.premium-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #f5d77a !important;
}

.premium-nav-link i {
    color: #f6c84c;
}

.mobile-menu-btn {
    width: 44px;
    height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    background: #101016 !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    border-radius: 12px;
    outline: none !important;
    padding: 0;
    z-index: 1001;
}

.mobile-menu-btn:hover {
    border-color: rgba(168,85,247,.45) !important;
}

.mobile-menu {
    display: none;
    background: #0b0b10;
    padding: 12px 18px 18px;
    border-bottom: 1px solid #2e1065;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    z-index: 99999;
    box-sizing: border-box;
    box-shadow: 0 20px 45px rgba(0,0,0,.65);
}

.mobile-menu.is-open {
    display: block !important;
}

.mobile-menu a {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: #ccc;
    border-bottom: 1px solid rgba(255,255,255,.06);
    text-decoration: none;
}

.mobile-menu a:last-child {
    border-bottom: 0;
}

.mobile-menu a:hover,
.mobile-menu a.active-link {
    color: #fff;
    text-decoration: none;
}

.mobile-menu .active-link::after {
    display: none;
}

.mobile-menu .prelims-nav-link,
.mobile-menu .premium-nav-link {
    display: flex;
}

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY & ARTICLE HEADINGS
   -------------------------------------------------------------------------- */
h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin-top: 15px;
    margin-bottom: 15px;
    line-height: 1.2;
    word-wrap: break-word;
}

h2 {
    color: var(--accent-pink);
    font-size: 1.8rem;
    margin-top: 50px;
    border-bottom: 2px solid rgba(255, 0, 255, 0.2);
    padding-bottom: 10px;
    transition: text-shadow 0.3s ease;
    word-wrap: break-word;
}

h2:hover {
    text-shadow: 0 0 10px var(--accent-pink);
}

h3 {
    color: var(--accent-blue);
    font-size: 1.4rem;
    margin-top: 35px;
    margin-bottom: 12px;
    transition: text-shadow 0.3s ease;
    word-wrap: break-word;
}

h3:hover {
    text-shadow: 0 0 8px var(--accent-blue);
}

h4 {
    color: var(--text-white);
    font-size: 1.05rem;
    margin-top: 18px;
    margin-bottom: 6px;
    opacity: 0.95;
    word-wrap: break-word;
}

p {
    margin-bottom: 1.2rem;
    color: var(--text-dim);
    word-wrap: break-word;
}

strong, .highlight {
    color: var(--text-white);
    font-weight: 600;
}

.highlight {
    color: var(--accent-pink);
}

/* --------------------------------------------------------------------------
   4. BREADCRUMBS & METADATA BAR
   -------------------------------------------------------------------------- */
.breadcrumb-container {
    margin-bottom: 20px;
    font-size: 0.9rem;
    max-width: 100%;
}

.breadcrumb-list {
    list-style: none !important;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.breadcrumb-list li {
    display: inline-flex;
    align-items: center;
    margin: 0 !important;
}

.breadcrumb-list li::before {
    content: none !important;
}

.breadcrumb-list li::after {
    content: "›";
    margin-left: 8px;
    color: rgba(255, 255, 255, 0.3);
}

.breadcrumb-list li:last-child::after {
    content: "";
}

.breadcrumb-list a {
    color: var(--accent-pink);
    text-decoration: none;
}

.breadcrumb-list li[aria-current="page"] {
    color: var(--text-white);
    font-weight: 600;
}

.back-btn {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--accent-pink);
    font-weight: 600;
    transition: text-shadow 0.3s ease;
}

.back-btn:hover {
    text-shadow: 0 0 10px var(--accent-pink);
    text-decoration: none;
}

.note-meta-bar, .metadata-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--text-dim);
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-wrap: wrap;
}

.note-meta-bar strong {
    color: var(--accent-pink);
}

/* --------------------------------------------------------------------------
   5. IMAGES & INFOGRAPHICS
   -------------------------------------------------------------------------- */
.featured-image-wrapper, .note-featured-image {
    width: 100%;
    max-width: 900px;
    margin: 20px auto 30px auto;
    border-radius: 12px;
    overflow: hidden; 
    background: #111111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    height: auto !important;
    text-align: center;
}

.featured-image, .note-featured-image img, .secondary-infographic img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
    object-fit: contain !important;
}

.img-caption {
    display: block;
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-top: 8px;
    font-style: italic;
}

/* --------------------------------------------------------------------------
   6. CONTAINER CARDS & CALLOUT BOXES
   -------------------------------------------------------------------------- */
.intro-box, .section-card, .toc-card, .toc, .faq-item {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Contains internal element overflows */
}

.intro-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.intro-heading {
    margin-top: 0;
}

.section-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    margin-top: 25px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section-card:hover, .intro-box:hover, .toc:hover, .toc-card:hover, .faq-item:hover {
    box-shadow: var(--glow-pink);
    transform: translateY(-3px);
}

.upsc-fact-box, .prelims-box, .mains-box {
    padding: 20px;
    margin: 20px 0;
    border-radius: 4px 12px 12px 4px;
    width: 100%;
    box-sizing: border-box;
}

.upsc-fact-box {
    background: rgba(255, 215, 0, 0.05);
    border-left: 5px solid var(--accent-gold);
}

.prelims-box {
    background: rgba(0, 212, 255, 0.05);
    border-left: 5px solid var(--accent-blue);
}

.mains-box {
    background: rgba(57, 255, 20, 0.05);
    border-left: 5px solid var(--accent-green);
}

.fact-title {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 10px;
}

.upsc-fact-box .fact-title { color: var(--accent-gold); }
.prelims-box .fact-title { color: var(--accent-blue); }
.mains-box .fact-title { color: var(--accent-green); }

.fact-p-top { margin-bottom: 6px; }
.fact-p-bottom { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   7. TABLE OF CONTENTS & LISTS
   -------------------------------------------------------------------------- */
.toc, .toc-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 0, 255, 0.3);
    padding: 25px;
    border-radius: 16px;
    margin: 30px 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.toc h3, .toc-card h3 {
    color: var(--accent-pink);
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 15px;
}

.toc ul, .toc-card ul {
    padding-left: 0;
    list-style: none;
    margin: 0;
}

.toc ul li, .toc-card li {
    margin-bottom: 8px;
}

.toc ul li::before {
    content: "👉";
    margin-right: 8px;
}

ul {
    padding-left: 20px;
    list-style: none;
}

ul li {
    margin-bottom: 6px;
    color: var(--text-dim);
}

ul li::before {
    content: "▹";
    color: var(--accent-pink);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

ul li strong {
    color: var(--text-white);
}

ol {
    padding-left: 25px;
}

ol li {
    margin-bottom: 8px;
    color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   8. ISOLATED RESPONSIVE DATA TABLES (ISOLATES HORIZONTAL SCROLL)
   -------------------------------------------------------------------------- */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important; /* Confines horizontal scroll STRICTLY within this container */
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}

table {
    width: 100%;
    min-width: 550px; /* Ensures text stays readable on mobile without squishing letters vertically */
    border-collapse: collapse;
    font-size: 0.92rem;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    word-break: normal;
    overflow-wrap: break-word;
}

th {
    color: var(--accent-pink);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255, 0, 255, 0.3);
}

td {
    color: var(--text-dim);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Prevents Article numbers and key parameters from wrapping vertically */
td:first-child strong, th:first-child {
    white-space: nowrap;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-white);
}

/* --------------------------------------------------------------------------
   9. FAQS & FOOTER REVISION BOX
   -------------------------------------------------------------------------- */
.faq-item {
    background: var(--card-bg);
    border-left: 4px solid var(--accent-pink);
    padding: 20px;
    border-radius: 4px 12px 12px 4px;
    margin-bottom: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.faq-item h4 {
    color: var(--text-white);
    margin-top: 0;
    font-size: 1.1rem;
}

.faq-item p {
    margin-bottom: 0;
}

.final-revision-box {
    text-align: center;
    border: 1px dashed var(--accent-pink);
    margin-top: 40px;
    margin-bottom: 60px;
}

.revision-p-top { margin-bottom: 8px; }
.revision-p-bottom { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   10. RESPONSIVE BREAKPOINTS & PRINT OVERRIDES
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .desktop-menu { display: none !important; }
    .mobile-menu-btn { display: block !important; }
}

@media (max-width: 600px) {
    h1 {
        font-size: 2.1rem;
    }
    
    body {
        padding: 0 12px 30px;
    }

    .navbar {
        padding: 10px 14px;
        min-height: 64px;
    }

    .mobile-menu {
        top: 64px;
    }

    .nav-logo {
        width: 36px;
        height: 36px;
    }

    .nav-title {
        font-size: 18px;
    }

    .section-card, .intro-box, .toc, .toc-card {
        padding: 18px 15px;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 8px 10px;
    }
    
    .note-meta-bar, .metadata-bar {
        flex-direction: column;
        gap: 4px;
    }
}

@media print {
    body {
        background: #ffffff;
        color: #000000;
        max-width: 100%;
        padding: 0;
    }
    
    .navbar, .back-btn, .breadcrumb-container {
        display: none !important;
    }
    
    .section-card, .intro-box, .toc, .faq-item {
        background: none;
        border: 1px solid #ccc;
        box-shadow: none !important;
        color: #000;
    }
    
    h1, h2, h3, h4, p, td, li {
        color: #000 !important;
        -webkit-text-fill-color: initial !important;
    }
}