:root {
    --primary: #00d2ff;
    --secondary: #3a7bd5;
    --bg-black: #050505;
    --bg-dark: #121212;
    --bg-card: #1a1a1a;
    --text-glow: 0 0 10px rgba(0, 210, 255, 0.5);
    --border-glow: 0 0 15px rgba(0, 210, 255, 0.2);
}

body, html {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-black);
    color: #e0e0e0;
    -webkit-font-smoothing: antialiased;
    overflow: hidden !important; /* Strictly disable body scroll */
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

#app {
    height: 100vh !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

.font-jetbrains, .font-monospace {
    font-family: 'JetBrains Mono', monospace !important;
}

/* Fast-forward hint: gentle pulse on the speed control when training at 1× */
@keyframes ff-hint-pulse {
    0%, 100% { opacity: 0.45; }
    50%       { opacity: 1; }
}
.tt-speed-hint {
    animation: ff-hint-pulse 1.6s ease-in-out infinite;
}

/* Time stat sizing — proportional to the 1.1rem cash display */
#stat-time .time-display {
    font-size: 1rem;
    letter-spacing: 0.03rem;
}
#stat-time .badge {
    font-size: 0.7rem;
}

/* Gradient Text */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: var(--bg-black);
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Sidebar Customization */
.nav-sidebar {
    width: 200px;
    transition: all 0.3s ease;
}

.nav-sidebar .btn {
    border: none;
    border-radius: 8px;
    padding: 12px 15px;
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #888;
    transition: all 0.2s ease;
}

.nav-sidebar .btn:hover {
    background: rgba(0, 210, 255, 0.1);
    color: var(--primary);
}

.nav-sidebar .btn.active {
    background: linear-gradient(90deg, rgba(0, 210, 255, 0.2) 0%, transparent 100%);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

/* Cards & Glow */
.card {
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glow-blue {
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.05);
}

.glow-blue:hover {
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
    animation: fadeIn 0.4s ease-out;
}

#view-container {
    animation: fadeIn 0.4s ease-out;
}

/* Utility */
.fs-small {
    font-size: 0.65rem;
    padding: 2px 5px;
    vertical-align: middle;
}

.extra-small { font-size: 0.7rem; }
.tracking-widest { letter-spacing: 0.1em; }

.glow-blue {
    box-shadow: 0 0 15px rgba(13, 110, 253, 0.1);
}

.shadow-danger {
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.3);
}

.text-gradient {
    background: linear-gradient(90deg, #0d6efd, #0dcaf0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-color: rgba(var(--bs-primary-rgb), 0.5) !important;
}

/* Juicy Animations */
.extra-small { font-size: 0.75rem !important; }

header .container-fluid {
    height: 100%;
}

@media (max-width: 991px) {
    #stat-active-vram, #stat-burn-rate-top {
        display: none !important;
    }
    /* Explicitly hide desktop save button and show time on mobile as requested */
    #stat-time {
        display: flex !important;
    }
    #btn-auth-save {
        display: none !important;
    }
}

/* Offset for fixed header on all views */
main {
    padding-top: 100px; /* Match fixed header height */
    flex-grow: 1;
    overflow: hidden;
}

@keyframes pulseGlow {
    0% { opacity: 0.8; text-shadow: 0 0 5px var(--primary); }
    50% { opacity: 1; text-shadow: 0 0 15px var(--primary), 0 0 20px var(--primary); }
    100% { opacity: 0.8; text-shadow: 0 0 5px var(--primary); }
}

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

@keyframes typingFade {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

.typing-animation {
    animation: typingFade 1.5s infinite steps(2, end);
}

.active-job-pulse {
    animation: borderPulse 4s infinite ease-in-out;
}

@keyframes borderPulse {
    0% { border-color: rgba(0, 210, 255, 0.2); }
    50% { border-color: rgba(0, 210, 255, 0.6); box-shadow: 0 0 10px rgba(0,210,255,0.1); }
}

/* Tutorial Classes */

@keyframes pulseTutorialGlow {
    0% { box-shadow: 0 0 10px rgba(0, 255, 128, 0.4); border-color: rgba(0, 255, 128, 0.6); }
    50% { box-shadow: 0 0 25px rgba(0, 255, 128, 0.8), 0 0 10px rgba(0, 255, 128, 0.4) inset; border-color: rgba(0, 255, 128, 1); }
    100% { box-shadow: 0 0 10px rgba(0, 255, 128, 0.4); border-color: rgba(0, 255, 128, 0.6); }
}

.glow-tutorial {
    animation: pulseTutorialGlow 1.5s infinite ease-in-out !important;
    position: relative;
    z-index: 1040; /* Above normal flow, below tooltips */
}

.tutorial-tooltip {
    position: fixed !important;
    bottom: 25px;
    left: 0;
    top: auto !important;
    right: auto !important;
    background: rgba(13, 17, 23, 0.94);
    backdrop-filter: blur(10px);
    border: 1px solid var(--primary);
    border-left: none;
    border-radius: 0 10px 10px 0;
    padding: 10px 14px;
    color: #fff;
    font-size: 0.92rem;
    line-height: 1.35;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 10px rgba(0, 210, 255, 0.15);
    z-index: 9999;
    width: 660px;
    max-width: 95vw;
    animation: slideInFromLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    opacity: 0.98;
    pointer-events: auto;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.tutorial-tooltip.is-collapsed {
    transform: translateX(-100%);
    opacity: 0.85;
}

.tutorial-handle {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 60px;
    background: rgba(13, 17, 23, 0.96);
    border: 1px solid var(--primary);
    border-left: none;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 5px 0 15px rgba(0,0,0,0.3);
    color: var(--primary);
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.tutorial-handle:hover {
    background: #1a1e29;
    color: #fff;
    width: 42px;
}

.tutorial-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.tutorial-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

@media (max-width: 576px) {
    .tutorial-tooltip {
        width: calc(100% - 40px) !important;
        left: 20px !important;
        bottom: 20px !important;
        padding: 10px;
        font-size: 0.82rem;
    }
    
    .tutorial-avatar {
        width: 45px !important;
        height: 45px !important;
        flex-shrink: 0;
    }
}

@keyframes slideInFromLeft {
    from { transform: translateX(-30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.tutorial-tooltip strong {
    color: var(--primary);
}

.tutorial-avatar {
    /* Compact 70x70 framing for toast style.
       Using 600% background-size for perfect 6-column sprite mapping. */
    float: left;
    width: 70px;
    height: 70px;
    margin-right: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    background-image: url('images/sprites/customer_sprite.png');
    background-size: 600% auto;
    
    --col: 0;
    --row: 0;
    
    background-position: calc(var(--col) * 20%) calc(var(--row) * 50%);
    background-repeat: no-repeat;
    background-color: #1a1e29;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.tutorial-text {
    flex: 1;
    padding-top: 4px;
    overflow: hidden; /* contains the floated avatar */
}

.tutorial-gate ul {
    display: flex;
    flex-wrap: wrap;
    column-gap: 20px;
}

.tutorial-gate li {
    width: calc(50% - 10px);
    margin-bottom: 4px !important;
    /* Grid: icon pinned left, label+hint in their own column so wrap lines
       align under the first character, not back under the icon. */
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 6px;
    align-items: start;
}

.tutorial-gate li > i {
    grid-column: 1;
    grid-row: 1;
    padding-top: 2px; /* optical alignment with cap-height of label */
}

.tutorial-gate li > .tutorial-gate__label {
    grid-column: 2;
    grid-row: 1;
}

.tutorial-gate li > .tutorial-gate__hint {
    grid-column: 2;
    grid-row: 2;
    margin-left: 0 !important; /* override Bootstrap ms-4; grid handles the indent */
}

/* PM Sprite Emotions/Actions mapped to 6x3 grid coordinates 
   Row 0: Greeting, Welcoming, Winking, Impressed, Shocked, Pensive
   Row 1: Surprised, Correcting, Frustrated (A3), Frutrated2, Frustrated3, Enthusiastic (Thumbsup)
   Row 2: Confident, Presenting, Sarcastic (Arms crossed), Waving Goodbye */
.avatar-greeting      { --col: 0; --row: 0; }
.avatar-surprised     { --col: 0; --row: 1; }
.avatar-frustrated    { --col: 2; --row: 1; }
.avatar-impressed     { --col: 3; --row: 0; }
.avatar-enthusiastic  { --col: 5; --row: 1; }
.avatar-sarcastic     { --col: 2; --row: 2; }
.avatar-confident     { --col: 0; --row: 2; }
.avatar-anxious       { --col: 2; --row: 1; }
.avatar-correcting    { --col: 1; --row: 1; }
.avatar-bored         { --col: 5; --row: 0; }
.avatar-waving        { --col: 3; --row: 2; }
.avatar-winking       { --col: 2; --row: 0; }

/* Product Tool Calculator Theming overrides */
#product-calculator-container .card {
    background-color: transparent !important;
    border-color: #30363d !important;
}

#product-calculator-container .card-header {
    background-color: rgba(33, 38, 45, 0.5) !important;
    border-bottom-color: #30363d !important;
}

#product-calculator-container input,
#product-calculator-container select {
    background-color: #0d1117 !important;
    color: #c9d1d9 !important;
    border-color: #30363d !important;
}

#product-calculator-container .result-box,
.terminal-box {
    background-color: #0d1117 !important;
    border-color: #30363d !important;
}


.btn-outline-primary:hover, .btn-outline-info:hover {
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
    transform: scale(1.02);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary, .btn-info {
    transition: all 0.2s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.6);
    filter: brightness(1.1);
}

.scramble-up { position: relative; top: -0.15em; display: inline-block; }
.scramble-down { position: relative; top: 0.1em; display: inline-block; }
.scramble-tilt-l { transform: rotate(-4deg); display: inline-block; }
.scramble-tilt-r { transform: rotate(4deg); display: inline-block; }

/* Custom Context Menu */
.custom-context-menu {
    position: fixed;
    z-index: 10000;
    background: rgba(13, 17, 23, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 210, 255, 0.3);
    border-radius: 8px;
    padding: 5px 0;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 210, 255, 0.1);
    animation: contextMenuFadeIn 0.15s ease-out;
}

@keyframes contextMenuFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e6edf3;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
}

.context-menu-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    opacity: 0.7;
}

.context-menu-item:hover {
    background: rgba(0, 210, 255, 0.15);
    color: var(--primary);
}

.context-menu-item:hover i {
    opacity: 1;
    color: var(--primary);
}

.context-menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
}

.context-menu-header {
    padding: 5px 15px;
    font-size: 0.65rem;
    font-weight: 800;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ================================================================
   GAME MODE — Product Tool: hide standalone-only calculator sections
   Sections 2, 4, 5, 8, 9 and their nav links are irrelevant in-game.
   Real-world dollar cost fields in section 7 are also hidden.
   The standalone calculator (no #product-calculator-container ancestor)
   is unaffected.
   ================================================================ */
#product-calculator-container #nav-link-drop,
#product-calculator-container #nav-link-console,
#product-calculator-container #nav-link-audit,
#product-calculator-container #nav-link-lr,
#product-calculator-container #nav-link-test {
    display: none !important;
}

#product-calculator-container #section-drop,
#product-calculator-container #section-console,
#product-calculator-container #section-audit,
#product-calculator-container #section-lr-schedule,
#product-calculator-container #section-test-suite {
    display: none !important;
}

/* Hide real-world dollar fields from Cost section in game */
#product-calculator-container #cost-per-hour-col,
#product-calculator-container #total-cost-col {
    display: none !important;
}

/* Hide export button in game */
#product-calculator-container #exportBtn {
    display: none !important;
}

/* Simulation Launch Overlay */
.simulation-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10001; /* Above modas */
    background: rgba(5, 5, 5, 0.4);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.simulation-launch-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(0, 210, 255, 0.3);
    border-radius: 16px;
    padding: 2.5rem;
    width: 480px;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 210, 255, 0.15);
}

.launch-progress-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 1.5rem 0;
    overflow: hidden;
}

.launch-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    animation: launchProgress 1.6s forwards cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px var(--primary);
}

.launch-status-text {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--primary);
    text-transform: uppercase;
    animation: pulse 1.5s infinite;
}

@keyframes launchProgress {
    0% { width: 0%; }
    40% { width: 65%; }
    70% { width: 85%; }
    100% { width: 100%; }
}
