/* Digital Guru Master Mobile-Responsive Stylesheet - Mobile Optimized */
:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(19, 27, 46, 0.88);
    --border-color: rgba(255, 255, 255, 0.12);
    --accent: #00f2fe;
    --accent-glow: rgba(0, 242, 254, 0.35);
    --accent-pink: #ff007f;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --sidebar-width: min(85vw, 320px);
    --topbar-height: 64px;
}

* {
    box-sizing: border-box;
}

body.digital-guru-body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Header Topbar */
.dg-topbar {
    height: var(--topbar-height);
    background: rgba(11, 15, 25, 0.96);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.dg-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.dg-brand .brand-icon {
    color: var(--accent);
    font-size: 1.35rem;
}

.dg-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-dg-outline {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.25s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-dg-outline:hover {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    color: var(--accent);
}

/* Mobile Hamburger Menu Toggle Button */
.mobile-sidebar-toggle {
    display: none;
    background: rgba(0, 242, 254, 0.12);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 1.1rem;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-sidebar-toggle:hover {
    background: var(--accent);
    color: #0b0f19;
}

/* Layout Wrapper */
.dg-layout {
    display: flex;
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    position: relative;
}

/* Sidebar Styles */
.dg-sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 23, 42, 0.98);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 950;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1rem 0.65rem;
    -webkit-overflow-scrolling: touch;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 920;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-search {
    margin-bottom: 1rem;
    padding: 0 0.2rem;
}

.sidebar-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 9px 12px;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.sidebar-search input:focus {
    border-color: var(--accent);
}

.category-group {
    margin-bottom: 0.75rem;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.category-header:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.topic-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
}

.topic-item a {
    display: block;
    padding: 8px 10px 8px 18px;
    color: #cbd5e1;
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    line-height: 1.4;
}

.topic-item a:hover {
    background: rgba(0, 242, 254, 0.08);
    color: var(--accent);
}

.topic-item.active a {
    background: linear-gradient(90deg, rgba(0, 242, 254, 0.2) 0%, rgba(79, 172, 254, 0.1) 100%);
    color: var(--accent);
    font-weight: 600;
    border-left: 3px solid var(--accent);
}

/* Main Content Reader */
.dg-main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem 2.5rem 4rem 2.5rem;
    max-width: 1050px;
    width: 100%;
}

.dg-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.dg-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

/* 3D Visualizer Canvas Container */
.topic-3d-wrapper {
    width: 100%;
    height: 220px;
    background: radial-gradient(circle at center, rgba(0, 242, 254, 0.1) 0%, rgba(11, 15, 25, 0.95) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.topic-3d-wrapper canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.topic-3d-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Code Snippet Box & Syntax Formatting */
.code-header {
    background: #1e293b;
    border: 1px solid #334155;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: #94a3b8;
    flex-wrap: wrap;
    gap: 6px;
}

.copy-btn {
    background: transparent;
    border: 1px solid #475569;
    color: #cbd5e1;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--accent);
    color: #0b0f19;
    border-color: var(--accent);
}

pre {
    background: #0f172a !important;
    border: 1px solid #334155;
    border-radius: 0 0 8px 8px;
    padding: 1rem;
    overflow-x: auto;
    margin-top: 0;
    color: #e2e8f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
}

/* Callouts & Tables */
.info-callout {
    background: rgba(0, 242, 254, 0.05);
    border-left: 4px solid var(--accent);
    padding: 1rem 1.15rem;
    border-radius: 6px;
    margin: 1.25rem 0;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 1.25rem 0;
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.custom-table th, .custom-table td {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    text-align: left;
    font-size: 0.85rem;
}

.custom-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
}

/* Topic Nav Footer Controls */
.topic-nav-footer {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.nav-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    text-decoration: none;
    color: #fff;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 48%;
}

.nav-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.nav-card span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}

.nav-card h5 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--accent);
    font-weight: 700;
    line-height: 1.35;
}

/* Comprehensive Responsive Media Queries */
@media (max-width: 992px) {
    .mobile-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .dg-sidebar {
        transform: translateX(-100%);
    }

    .dg-sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.7);
    }

    .dg-main-content {
        margin-left: 0;
        padding: 1.25rem 1rem 3rem 1rem;
    }

    .topic-3d-wrapper {
        height: 180px;
    }
}

@media (max-width: 768px) {
    :root {
        --topbar-height: 60px;
    }

    .dg-brand span {
        font-size: 1.05rem;
    }

    .dg-main-content h1 {
        font-size: 1.6rem !important;
        line-height: 1.3 !important;
    }

    .dg-main-content p {
        font-size: 0.95rem !important;
    }

    .btn-dg-outline {
        padding: 5px 8px;
        font-size: 0.75rem;
    }

    .topic-nav-footer {
        flex-direction: column;
        gap: 0.85rem;
    }

    .nav-card {
        max-width: 100%;
        text-align: left !important;
    }

    .topic-3d-wrapper {
        height: 160px;
    }
}

@media (max-width: 480px) {
    .dg-topbar {
        padding: 0 0.65rem;
    }

    .dg-brand span {
        font-size: 0.95rem;
    }

    .btn-dg-outline span {
        display: none; /* Hide text, keep icon on small mobile */
    }

    .btn-dg-outline {
        padding: 6px 10px;
    }

    .dg-main-content {
        padding: 1rem 0.75rem 2.5rem 0.75rem;
    }

    .dg-main-content h1 {
        font-size: 1.4rem !important;
    }

    .topic-3d-wrapper {
        height: 140px;
    }
}
