/* ============================================================
   DIGITAL TWIN — LS-RAPID 3D SIMULATION STYLES
   Sci-Fi Dark Mode / Glassmorphism HUD
   ============================================================ */

:root {
    --dt-bg: #0a0e1a;
    --dt-panel-bg: rgba(10, 14, 30, 0.85);
    --dt-panel-border: rgba(45, 212, 191, 0.15);
    --dt-accent: #2dd4bf;
    --dt-accent-glow: rgba(45, 212, 191, 0.4);
    --dt-danger: #f43f5e;
    --dt-danger-glow: rgba(244, 63, 94, 0.5);
    --dt-warning: #f59e0b;
    --dt-warning-glow: rgba(245, 158, 11, 0.4);
    --dt-safe: #10b981;
    --dt-text: #e2e8f0;
    --dt-text-dim: #94a3b8;
    --dt-hud-bg: rgba(10, 14, 30, 0.7);
    --dt-radius: 12px;
    --dt-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --dt-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

.dt-overlay-container {
    position: fixed;
    inset: 0;
    z-index: 9999;
    font-family: var(--dt-font);
    background: var(--dt-bg);
    color: var(--dt-text);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: none;
}
.dt-overlay-container.dt-active {
    display: block;
}

/* ============================================================
   HEADER
   ============================================================ */
.dt-overlay-container #dt-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(10, 14, 30, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--dt-panel-border);
}

.dt-header-left, .dt-header-center, .dt-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dt-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--dt-text);
}

.dt-logo-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--dt-accent), #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    box-shadow: 0 0 12px var(--dt-accent-glow);
}

.dt-logo-text {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.3px;
}

.dt-status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: var(--dt-mono);
    transition: all 0.5s ease;
}

.dt-status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}
.dt-status-badge.warning .dt-status-dot { background: var(--dt-warning); box-shadow: 0 0 8px var(--dt-warning-glow); }
.dt-status-badge.warning .dt-status-text { color: var(--dt-warning); }

.dt-status-badge.critical {
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.4);
    animation: badge-pulse 1s ease-in-out infinite;
}
.dt-status-badge.critical .dt-status-dot { background: var(--dt-danger); box-shadow: 0 0 12px var(--dt-danger-glow); }
.dt-status-badge.critical .dt-status-text { color: var(--dt-danger); }

.dt-status-badge.sliding {
    background: rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.5);
    animation: badge-pulse 0.5s ease-in-out infinite;
}
.dt-status-badge.sliding .dt-status-dot { background: #ff1744; box-shadow: 0 0 16px rgba(255, 23, 68, 0.8); }
.dt-status-badge.sliding .dt-status-text { color: #ff1744; }

@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.dt-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--dt-safe);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.dt-status-text {
    color: var(--dt-safe);
}

.dt-fos-mini {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-family: var(--dt-mono);
}

.dt-fos-label {
    font-size: 10px;
    color: var(--dt-text-dim);
    font-weight: 500;
}

.dt-fos-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--dt-safe);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
    transition: color 0.5s, text-shadow 0.5s;
}

.dt-btn-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: var(--dt-text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}
.dt-btn-icon:hover {
    background: rgba(255,255,255,0.1);
    color: var(--dt-accent);
    border-color: var(--dt-accent);
}

.dt-btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--dt-text-dim);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}
.dt-btn-back:hover {
    background: var(--dt-accent);
    color: white;
    border-color: var(--dt-accent);
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
#dt-main {
    display: flex;
    width: 100%;
    height: calc(100vh - 48px);
    margin-top: 48px;
}

/* ============================================================
   LEFT PANEL
   ============================================================ */
#dt-panel {
    width: 320px;
    min-width: 320px;
    height: 100%;
    background: var(--dt-panel-bg);
    backdrop-filter: blur(30px);
    border-right: 1px solid var(--dt-panel-border);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: margin-left 0.3s ease, opacity 0.3s ease;
    user-select: none;
}

#dt-panel.dt-panel-closed {
    margin-left: -320px;
    opacity: 0;
    pointer-events: none;
}

#dt-panel::-webkit-scrollbar {
    width: 4px;
}
#dt-panel::-webkit-scrollbar-track {
    background: transparent;
}
#dt-panel::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.dt-panel-section {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--dt-radius);
    padding: 14px;
    margin-bottom: 8px;
}

.dt-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--dt-accent);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dt-section-header i {
    font-size: 14px;
}

.dt-param-group {
    margin-bottom: 12px;
}
.dt-param-group:last-child {
    margin-bottom: 0;
}

.dt-param-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    color: var(--dt-text-dim);
    margin-bottom: 6px;
    font-weight: 500;
}

.dt-param-label output {
    font-family: var(--dt-mono);
    font-size: 12px;
    color: var(--dt-accent);
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

/* Custom Range Slider */
.dt-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    outline: none;
    cursor: pointer;
}

.dt-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--dt-accent);
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 0 8px var(--dt-accent-glow);
    cursor: pointer;
    transition: transform 0.2s;
}
.dt-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.dt-slider-rain::-webkit-slider-thumb {
    background: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.dt-slider-pore::-webkit-slider-thumb {
    background: #8b5cf6;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

.dt-slider-seismic::-webkit-slider-thumb {
    background: var(--dt-danger);
    box-shadow: 0 0 8px var(--dt-danger-glow);
}

/* Panel Actions */
.dt-panel-actions {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dt-btn-primary {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--dt-accent), #06b6d4);
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 20px var(--dt-accent-glow);
    font-family: var(--dt-font);
}
.dt-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 30px var(--dt-accent-glow);
}
.dt-btn-primary:active {
    transform: translateY(0);
}
.dt-btn-primary.running {
    background: linear-gradient(135deg, var(--dt-danger), #e11d48);
    box-shadow: 0 4px 20px var(--dt-danger-glow);
}

.dt-btn-secondary {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
    color: var(--dt-text-dim);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: var(--dt-font);
}
.dt-btn-secondary:hover {
    background: rgba(255,255,255,0.08);
    color: var(--dt-text);
}

/* ============================================================
   3D VIEWPORT
   ============================================================ */
#dt-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--dt-bg);
}

#dt-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ============================================================
   HUD ELEMENTS (overlaid on viewport)
   ============================================================ */
.dt-hud-element {
    position: absolute;
    z-index: 10;
    pointer-events: auto;
}

/* FoS Gauge */
#dt-fos-gauge {
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.dt-gauge-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.dt-gauge-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.dt-gauge-bg {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 8;
}

.dt-gauge-fill {
    fill: none;
    stroke: var(--dt-safe);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.8s ease, stroke 0.5s ease;
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.5));
}

.dt-gauge-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.dt-gauge-value {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--dt-mono);
    color: var(--dt-safe);
    line-height: 1;
    text-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
    transition: color 0.5s, text-shadow 0.5s;
}

.dt-gauge-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--dt-text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
}

.dt-gauge-status {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-family: var(--dt-mono);
    color: var(--dt-safe);
    padding: 3px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    transition: all 0.5s;
}

/* Damage Stats */
#dt-damage-stats {
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dt-hud-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(244, 63, 94, 0.3);
    border-radius: var(--dt-radius);
    padding: 12px 20px;
    min-width: 400px;
}

.dt-damage-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--dt-danger);
    text-align: center;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.dt-damage-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.dt-damage-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.dt-damage-item i {
    font-size: 18px;
    color: var(--dt-danger);
}

.dt-damage-val {
    font-family: var(--dt-mono);
    font-size: 20px;
    font-weight: 800;
    color: white;
}

.dt-damage-lbl {
    font-size: 10px;
    color: var(--dt-text-dim);
    font-weight: 500;
}

/* Timeline Bar */
#dt-timeline {
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--dt-hud-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 30px;
    padding: 6px 16px;
    min-width: 350px;
}

.dt-tl-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--dt-accent);
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.dt-tl-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px var(--dt-accent-glow);
}

.dt-tl-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.dt-tl-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--dt-accent), #06b6d4);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.dt-tl-time {
    font-family: var(--dt-mono);
    font-size: 12px;
    color: var(--dt-text-dim);
    min-width: 40px;
    text-align: center;
}

.dt-tl-speed {
    font-family: var(--dt-mono);
    font-size: 11px;
    color: var(--dt-accent);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 3px 6px;
    cursor: pointer;
    outline: none;
}
.dt-tl-speed option {
    background: var(--dt-bg);
    color: var(--dt-text);
}

/* Loading Overlay */
#dt-loading {
    position: absolute;
    inset: 0;
    background: var(--dt-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: opacity 0.6s ease;
}

#dt-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.dt-loading-content {
    text-align: center;
}

.dt-loading-spinner {
    width: 48px; height: 48px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--dt-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dt-loading-text {
    font-size: 14px;
    color: var(--dt-text-dim);
    font-weight: 500;
}

/* Warning Overlay */
#dt-warning-overlay {
    position: absolute;
    inset: 0;
    background: rgba(244, 63, 94, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
    animation: warning-flash 0.8s ease-in-out infinite;
}

@keyframes warning-flash {
    0%, 100% { background: rgba(244, 63, 94, 0.05); }
    50% { background: rgba(244, 63, 94, 0.12); }
}

.dt-warning-text {
    font-size: 32px;
    font-weight: 900;
    color: var(--dt-danger);
    text-shadow: 0 0 30px var(--dt-danger-glow), 0 0 60px var(--dt-danger-glow);
    letter-spacing: 4px;
    animation: warning-scale 1s ease-in-out infinite;
}

@keyframes warning-scale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.dt-warning-sub {
    font-family: var(--dt-mono);
    font-size: 18px;
    color: rgba(244, 63, 94, 0.8);
    margin-top: 8px;
    font-weight: 700;
}

/* ============================================================
   CAMERA SHAKE ANIMATION
   ============================================================ */
.camera-shake {
    animation: cameraShake 0.15s ease-in-out infinite;
}

@keyframes cameraShake {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-2px, 1px); }
    50%  { transform: translate(2px, -1px); }
    75%  { transform: translate(-1px, -2px); }
    100% { transform: translate(1px, 2px); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    #dt-panel {
        position: absolute;
        z-index: 30;
        width: 280px;
        min-width: 280px;
    }

    #dt-damage-stats {
        min-width: auto;
        width: calc(100% - 32px);
    }

    #dt-timeline {
        min-width: auto;
        width: calc(100% - 32px);
    }

    .dt-warning-text {
        font-size: 20px;
        letter-spacing: 2px;
    }
}
