/* ============================================
   INSTRUCTIVO 2026 — DASHBOARD STYLES v4
   Nixtio-inspired | Left Sidebar | HarmonyOS feel
   ============================================ */

:root {
    --font-base: 16px;
    --font: 'Inter', sans-serif;

    /* Light Mode */
    --bg-shell:       #E8EAFE;
    --bg-panel:       #FFFFFF;
    --bg-sidebar:     #FFFFFF;
    --bg-card:        #F7F8FF;
    --bg-card-hover:  #ECEEFF;
    --bg-ctrl:        #F0F0F5;
    --bg-ctrl-hover:  #E2E2F0;
    --bg-tab-active:  #1C1E2E;
    --bg-tag:         #ECEEFF;

    --text-primary:   #1C1E2E;
    --text-secondary: #5A5D7A;
    --text-muted:     #9295B0;
    --text-inverse:   #FFFFFF;

    --accent-1:  #1C1E2E;
    --accent-blue: #4F6FE8;

    --border:         rgba(0,0,0,0.07);
    --border-strong:  rgba(0,0,0,0.12);

    --shadow-panel:   0 20px 60px rgba(0,0,0,0.10);
    --shadow-card:    0 4px 20px rgba(0,0,0,0.06);
    --shadow-card-hover: 0 12px 32px rgba(79,111,232,0.15);

    --radius-xl:  28px;
    --radius-lg:  18px;
    --radius-md:  12px;
    --radius-sm:  8px;
    --radius-pill: 100px;

    --transition: 0.25s cubic-bezier(.4,0,.2,1);

    /* Category Colors */
    --cat-1-bg: #FFF7ED; --cat-1-icon: #EA580C;
    --cat-2-bg: #EFF6FF; --cat-2-icon: #2563EB;
    --cat-3-bg: #F0FDF4; --cat-3-icon: #16A34A;
    --cat-4-bg: #FDF4FF; --cat-4-icon: #9333EA;
    --cat-5-bg: #FFF1F2; --cat-5-icon: #E11D48;

    --sidebar-w: 80px;
}

[data-theme="dark"] {
    --bg-shell:       #0F1117;
    --bg-panel:       #1A1D27;
    --bg-sidebar:     #12141E;
    --bg-card:        #22263A;
    --bg-card-hover:  #2A2F47;
    --bg-ctrl:        #22263A;
    --bg-ctrl-hover:  #2A2F47;
    --bg-tab-active:  #4F6FE8;
    --bg-tag:         #22263A;

    --text-primary:   #F0F2FF;
    --text-secondary: #9295B0;
    --text-muted:     #5A5D7A;
    --text-inverse:   #FFFFFF;

    --border:         rgba(255,255,255,0.06);
    --border-strong:  rgba(255,255,255,0.12);

    --shadow-panel:   0 20px 60px rgba(0,0,0,0.5);
    --shadow-card:    0 4px 20px rgba(0,0,0,0.3);
    --shadow-card-hover: 0 12px 32px rgba(79,111,232,0.25);
}

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

html {
    font-size: var(--font-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-shell);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: background var(--transition), color var(--transition);
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

/* ===== SHELL ===== */
.shell {
    width: 100%;
    max-width: 1280px;
    height: 88vh;
    background: var(--bg-panel);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-panel);
    display: flex;
    overflow: hidden;
    transition: background var(--transition);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 8px;
    transition: background var(--transition);
    z-index: 10;
}

.sidebar-logo {
    margin-bottom: 20px;
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: var(--accent-1);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
}

[data-theme="dark"] .logo-mark {
    background: var(--accent-blue);
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 0 10px;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    transition: all var(--transition);
    font-family: var(--font);
    text-align: center;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--accent-blue);
}

.nav-item.active {
    background: rgba(79,111,232,0.12);
    color: var(--accent-blue);
}

.nav-item.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

.nav-item .material-symbols-outlined {
    font-size: 22px;
}

.nav-item-label {
    font-size: 9px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.2px;
}

.sidebar-footer {
    padding: 0 10px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.sidebar-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-ctrl);
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-family: var(--font);
}

.sidebar-icon-btn:hover {
    background: var(--bg-ctrl-hover);
    color: var(--text-primary);
}

/* ===== MAIN PANEL ===== */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ===== TOP BAR ===== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 36px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ctrl-btn {
    height: 34px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    background: var(--bg-ctrl);
    border: 1.5px solid var(--border);
    cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 700;
    transition: all var(--transition);
    letter-spacing: 0.3px;
}

.ctrl-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79,111,232,0.3);
}

/* Search bar */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    height: 34px;
    padding: 0 14px 0 36px;
    border-radius: var(--radius-pill);
    background: var(--bg-ctrl);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    width: 200px;
    outline: none;
    transition: all var(--transition);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    width: 260px;
    border-color: var(--accent-blue);
    background: var(--bg-panel);
    box-shadow: 0 0 0 3px rgba(79,111,232,0.12);
}

.search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 17px;
    pointer-events: none;
    line-height: 1;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    z-index: 100;
    overflow: hidden;
    display: none;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover { background: var(--bg-card-hover); }

.search-result-cat {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.search-result-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.search-result-snippet {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.search-no-results {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===== VIEWS ===== */
.view {
    flex: 1;
    overflow-y: auto;
    padding: 40px 36px;
}

/* ===== HOME VIEW ===== */
.hero {
    margin-bottom: 40px;
}

.hero-eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent-blue);
    margin-bottom: 12px;
}

.hero-heading {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.12;
    letter-spacing: -1.5px;
    margin-bottom: 12px;
}

.hero-sub {
    font-size: 1rem;
    color: var(--text-secondary);
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.home-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.home-card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-4px);
    border-color: transparent;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon .material-symbols-outlined {
    font-size: 24px;
}

.card-body h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.card-body p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.card-arrow {
    margin-top: auto;
    align-self: flex-end;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

/* ===== READING VIEW ===== */
.reading-tabs-bar {
    border-bottom: 1px solid var(--border);
    padding: 0 36px;
    flex-shrink: 0;
    background: var(--bg-panel);
    position: sticky;
    top: 0;
    z-index: 5;
}

#view-reading {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.reading-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 12px 0;
}

.reading-tabs::-webkit-scrollbar { height: 0; }

.rtab {
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}

.rtab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.rtab.active {
    background: var(--bg-tab-active);
    color: var(--text-inverse);
    font-weight: 600;
}

.reading-body {
    flex: 1;
    overflow-y: auto;
    padding: 36px 28px 40px 28px;
    max-width: 100%;
    width: 100%;
}

/* ===== DOCUMENT CONTENT ===== */
.doc-section-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-section-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 32px;
    background: var(--accent-blue);
    border-radius: 3px;
    flex-shrink: 0;
}

.doc-subheader {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 32px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-subheader::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--accent-blue);
    border-radius: 2px;
    flex-shrink: 0;
}

.doc-paragraph {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-align: justify;
    hyphens: auto;
}

.doc-bullet {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    padding: 10px 14px;
    background: rgba(79,111,232,0.06);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-blue);
    transition: background var(--transition);
}

.doc-bullet:hover {
    background: rgba(79,111,232,0.11);
}

.doc-bullet::before {
    content: '›';
    color: var(--accent-blue);
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1.65;
    flex-shrink: 0;
}

.doc-bullet-text {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text-secondary);
    text-align: justify;
    hyphens: auto;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 60px 20px;
}

.empty-state .material-symbols-outlined {
    font-size: 48px;
    opacity: 0.4;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body { padding: 0; }
    .shell { height: 100vh; border-radius: 0; flex-direction: column; }
    .sidebar { width: 100%; min-width: unset; flex-direction: row; height: 64px; border-right: none; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
    .sidebar-logo { display: none; }
    .sidebar-nav { flex-direction: row; padding: 0; }
    .sidebar-footer { border-top: none; padding: 0; }
    .nav-item-label { display: none; }
    .hero-heading { font-size: 1.8rem; }
    .reading-body { padding: 24px 20px; }
    .topbar { padding: 14px 20px; }
    .view { padding: 24px 20px; }
}
