:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #f59e0b;
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 280px;
    --drawer-width: 500px;
    --header-height: 70px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* Mobile First Layout Shell */
.app-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar Styling (Hidden by default on mobile) */
.app-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-sidebar.active {
    left: 0;
}

/* Sidebar Backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.logo-box {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.brand-text h1 {
    font-size: 1.2rem;
    font-weight: 800;
}

.brand-text span {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
}

.sidebar-search {
    background: #f1f5f9;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    border: 1px solid transparent;
}

.sidebar-search:focus-within {
    background: white;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.sidebar-search input {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-family: inherit;
    font-size: 0.9rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
}

.section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 800;
    margin-bottom: 1rem;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.sidebar-nav li:hover, .sidebar-nav li.active {
    background: #eef2ff;
    color: var(--primary);
}

.sidebar-nav li.active {
    font-weight: 700;
}

/* Main Area */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
}

.top-nav {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    flex-shrink: 0;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 1.1rem;
}

.breadcrumb {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.stats-badge {
    background: #eef2ff;
    color: var(--primary);
    padding: 0.4rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Content Area */
.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}

.detailed-header {
    margin-bottom: 2rem;
}

.detailed-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.detailed-header p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.comprehensive-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.mega-tag-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.mega-tag-card:active {
    transform: scale(0.98);
}

.mtc-cat-badge {
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 900;
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.mtc-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
}

.mtc-short-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.mtc-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--primary);
}

/* Side Drawer (Responsive) */
.tag-drawer {
    position: fixed;
    right: -100%;
    top: 0;
    width: 100%;
    height: 100vh;
    background: white;
    z-index: 2000;
    box-shadow: -15px 0 50px rgba(0, 0, 0, 0.15);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.tag-drawer.open {
    right: 0;
}

.drawer-header-detailed {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    position: sticky;
    top: 0;
}

.close-btn {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
}

.drawer-header-detailed h2 {
    font-size: 1.1rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

.dh-cat {
    font-size: 0.6rem;
    font-weight: 800;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
}

.drawer-scroll-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 800;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-explanation {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-main);
}

.detailed-code-box {
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
}

.cb-head {
    background: #1e293b;
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 700;
}

.cb-head button {
    background: #334155;
    border: none;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.65rem;
}

.detailed-code-box pre {
    padding: 1rem;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.detailed-preview-box {
    background: #ffffff;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    font-size: 0.9rem;
}

.pro-section {
    background: #fffbeb;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid #fde68a;
}

.pro-tip-content p {
    color: #b45309;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Scrollbar Customization */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* Desktop Enhancements (Breakpoints) */
@media (min-width: 768px) {
    .detailed-header h1 { font-size: 2.25rem; }
    .comprehensive-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
    .content-body { padding: 2.5rem; }
}

@media (min-width: 1024px) {
    .app-sidebar {
        position: relative;
        left: 0;
        width: var(--sidebar-width);
    }
    .menu-toggle { display: none; }
    .sidebar-overlay { display: none !important; }
    .tag-drawer { width: var(--drawer-width); right: -100%; }
    .breadcrumb { max-width: none; font-size: 0.9rem; }
}
