/* ============================================================
   ScopeBit — Technical Precision Design System
   Custom CSS (supplements Tailwind)
   ============================================================ */

/* ----------------------------------------------------------
   1. BASE RESETS & DEFAULTS
   ---------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ----------------------------------------------------------
   2. CUSTOM SCROLLBAR (Webkit)
   ---------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f6f3f2;
}

::-webkit-scrollbar-thumb {
    background: #c3c6d7;
    border-radius: 3px;
}

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

/* ----------------------------------------------------------
   3. CHART GRID BACKGROUND
   ---------------------------------------------------------- */
.chart-grid {
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, #E5E7EB 1px, transparent 1px),
        linear-gradient(to bottom, #E5E7EB 1px, transparent 1px);
}

/* ----------------------------------------------------------
   4. BENTO GRID (Dashboard)
   ---------------------------------------------------------- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}

@media (max-width: 767px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-grid>[class*="col-span"] {
        grid-column: span 1 !important;
    }
}

/* ----------------------------------------------------------
   5. BOTTOM DRAWER (Technical Precision)
   ---------------------------------------------------------- */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 27, 27, 0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.drawer-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #E5E7EB;
    border-radius: 0.75rem 0.75rem 0 0;
    z-index: 91;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}

.drawer-panel.active {
    transform: translateY(0);
}

.drawer-handle {
    width: 36px;
    height: 4px;
    background: #c3c6d7;
    border-radius: 2px;
    margin: 12px auto 0;
}

/* ----------------------------------------------------------
   6. MOBILE BOTTOM NAVIGATION
   ---------------------------------------------------------- */
.bottom-nav {
    width: 100%;
    flex-shrink: 0;
    z-index: 80;
    background: #ffffff;
    border-top: 1px solid #E5E7EB;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 0;
    font-size: 11px;
    font-weight: 500;
    color: #737686;
    transition: color 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    flex: 1;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: #004ac6;
}

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


/* ----------------------------------------------------------
   7. SIDEBAR STYLES
   ---------------------------------------------------------- */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 0.5rem;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: 0.05em;
    color: #434655;
    transition: all 0.15s ease;
    text-decoration: none;
}

.sidebar-link:hover {
    background: #eae7e7;
    color: #004ac6;
}

.sidebar-link.active {
    background: #2563eb;
    color: #eeefff;
    font-weight: 700;
}

.sidebar-link .material-symbols-outlined {
    font-size: 20px;
}

/* ----------------------------------------------------------
   8. CARD STYLES
   ---------------------------------------------------------- */
.card {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    border-color: #004ac6;
    box-shadow: 0 1px 4px rgba(0, 74, 198, 0.08);
}

/* ----------------------------------------------------------
   9. QUIZ FEEDBACK ANIMATIONS
   ---------------------------------------------------------- */
.quiz-option {
    transition: all 0.2s ease;
}

.quiz-option.correct {
    border-color: #10B981 !important;
    background: rgba(16, 185, 129, 0.05) !important;
}

.quiz-option.incorrect {
    border-color: #EF4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

.quiz-option.correct .quiz-icon-correct,
.quiz-option.incorrect .quiz-icon-incorrect {
    display: inline-flex !important;
}

/* ----------------------------------------------------------
   10. ANIMATIONS & TRANSITIONS
   ---------------------------------------------------------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-subtle {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s ease-out forwards;
}

.animate-pulse-subtle {
    animation: pulse-subtle 2s ease-in-out infinite;
}

/* Stagger children animation */
.stagger-children>* {
    opacity: 0;
    animation: fadeInUp 0.4s ease-out forwards;
}

.stagger-children>*:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger-children>*:nth-child(2) {
    animation-delay: 0.10s;
}

.stagger-children>*:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger-children>*:nth-child(4) {
    animation-delay: 0.20s;
}

.stagger-children>*:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger-children>*:nth-child(6) {
    animation-delay: 0.30s;
}

/* ----------------------------------------------------------
   11. TOPNAV ACTIVE TAB
   ---------------------------------------------------------- */
.topnav-tab {
    display: flex;
    align-items: center;
    height: 100%;
    padding-bottom: 2px;
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
    color: #434655;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
}

.topnav-tab:hover {
    color: #004ac6;
}

.topnav-tab.active {
    color: #004ac6;
    font-weight: 700;
    border-bottom-color: #004ac6;
}

/* ----------------------------------------------------------
   12. MOBILE SIDEBAR OVERLAY
   ---------------------------------------------------------- */
.mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 27, 27, 0.4);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-sidebar-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100dvh !important;
    width: 280px;
    background: #FAFAFA;
    border-right: 1px solid #E5E7EB;
    z-index: 91;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}

.mobile-sidebar.active {
    transform: translateX(0);
}

/* ----------------------------------------------------------
   13. PROGRESS CIRCLE
   ---------------------------------------------------------- */
.progress-circle-track {
    transition: stroke-dashoffset 1s ease-out;
}

/* ----------------------------------------------------------
   14. CTA BUTTON GLOW
   ---------------------------------------------------------- */
.cta-glow {
    position: relative;
    overflow: hidden;
}

.cta-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            transparent 40%,
            rgba(255, 255, 255, 0.15) 50%,
            transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.cta-glow:hover::after {
    transform: translateX(100%);
}

/* ----------------------------------------------------------
   15. CANVAS CHART CONTAINER
   ---------------------------------------------------------- */
.chart-canvas-container {
    position: relative;
    width: 100%;
    min-height: 300px;
}

.chart-canvas-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Crosshair cursor for chart */
.chart-canvas-container:hover {
    cursor: crosshair;
}

/* ----------------------------------------------------------
   16. GLOSSARY CARD ANIMATIONS
   ---------------------------------------------------------- */
.glossary-card {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.glossary-card.hidden-filtered {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

/* ----------------------------------------------------------
   17. MATERIAL SYMBOLS OVERRIDES
   ---------------------------------------------------------- */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.material-symbols-outlined.fill {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ----------------------------------------------------------
   18. HIDE SCROLLBAR (Clean UI)
   ---------------------------------------------------------- */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ----------------------------------------------------------
   19. SMART GLOSSARY TOOLTIP (Premium UI)
   ---------------------------------------------------------- */
.glossary-highlight {
    color: #004ac6;
    font-weight: 600;
    border-bottom: 2px dotted #004ac6;
    cursor: help;
    transition: all 0.2s ease;
}

.glossary-highlight:hover {
    background-color: rgba(0, 74, 198, 0.1);
    border-radius: 4px;
}

#smart-tooltip {
    position: absolute;
    z-index: 9999;
    width: 320px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(229, 231, 235, 0.8);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-radius: 1rem;
    padding: 1rem;
    pointer-events: none;
    /* Agar kursor tembus */
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
}

#smart-tooltip.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

/* ----------------------------------------------------------
   20. PAGE TRANSITIONS (SPA-like Feel)
   ---------------------------------------------------------- */
body {
    opacity: 0;
    animation: pageFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body.page-fade-out {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* ----------------------------------------------------------
   21. GLOSSARY MODAL TRANSITIONS
   ---------------------------------------------------------- */
#glossary-modal-backdrop.active {
    opacity: 1 !important;
}

#glossary-modal-content.active {
    opacity: 1 !important;
    transform: scale(1) !important;
}