/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.font-rajdhani {
    font-family: 'Rajdhani', sans-serif;
}

.font-orbitron {
    font-family: 'Orbitron', sans-serif;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Panel Styles */
.panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: visible;
    box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
    z-index: 10;
}

.panel.mini {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.panel-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    color: #000;
    letter-spacing: 2px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.8;
}

.glow-dot {
    width: 6px;
    height: 6px;
    background: #000;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    animation: pulse 2s infinite;
}

.glow-dot.grayscale {
    background: #999;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Cyber Checkbox */
.cyber-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #94a3b8;
    transition: color 0.3s;
}

.cyber-checkbox:hover {
    color: #e2e8f0;
}

.cyber-checkbox input {
    display: none;
}

.cyber-checkbox .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #334155;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s;
}

.cyber-checkbox input:checked+.checkmark {
    background: #fff;
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.cyber-checkbox input:checked+.checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: black;
    font-size: 10px;
    font-weight: bold;
}

/* Cyber Slider */
.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 6px;
}

.slider-group label span {
    color: #06b6d4;
    font-weight: 600;
}

.cyber-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #1e293b;
    border-radius: 3px;
    outline: none;
}

.cyber-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    transition: transform 0.2s;
}

.cyber-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Cyber Button */
.cyber-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px 16px;
    color: #000;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    z-index: 50;
}

.cyber-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: #000;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.cyber-btn.grayscale {
    border-color: rgba(0, 0, 0, 0.2);
    color: #555;
}

.cyber-btn.grayscale:hover {
    color: #000;
    border-color: #000;
}

.cyber-btn.red {
    background: #ff4444;
    border-color: #ff4444;
    color: #fff;
}

.cyber-btn.red:hover {
    background: #ff0000;
    border-color: #ff0000;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
}

.cyber-btn.green {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.cyber-btn.green:hover {
    background: #059669;
    border-color: #059669;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    background: rgba(30, 41, 59, 0.3);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    color: #10b981;
    margin-top: 4px;
}

/* Canvas Container */
.canvas-container {
    position: relative;
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1/1;
    margin: 0 auto;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
}

.canvas-container canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.canvas-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 10px 10px;
    pointer-events: none;
}

.preview-canvas {
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    image-rendering: pixelated;
    width: 56px;
    height: 56px;
    background: #f9fafb;
}

/* Predictions */
.prediction-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prediction-label {
    width: 30px;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: #475569;
    text-align: center;
}

.prediction-track {
    flex: 1;
    height: 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.prediction-fill {
    height: 100%;
    background: #cbd5e1;
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.prediction-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.prediction-value {
    width: 50px;
    font-size: 12px;
    color: #475569;
    text-align: right;
}

.prediction-bar.top .prediction-label {
    color: #000;
    font-weight: 700;
}

.prediction-bar.top .prediction-fill {
    background: #000;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.prediction-bar.top .prediction-value {
    color: #000;
    font-weight: 600;
}

/* Glow Text */
.glow-text {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

/* Layer Label */
/* Model Architecture Styles */
.arch-item {
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    padding-left: 12px;
    margin-bottom: 2px;
}

.arch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.arch-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.arch-tag {
    font-size: 9px;
    color: #06b6d4;
    background: rgba(6, 182, 212, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
}

.arch-desc {
    font-size: 11px;
    color: #64748b;
    line-height: 1.4;
}

/* Integrated Layer Labels - Small Circles */
#layerLabels {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 30;
}

.layer-tag {
    position: absolute;
    pointer-events: auto;
    transform: translate(-50%, -50%);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 50;
}

.layer-hotspot {
    width: 14px;
    height: 14px;
    background: #06b6d4;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-hotspot::after {
    content: '?';
    color: white;
    font-size: 8px;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
}

.layer-tag:hover .layer-hotspot {
    transform: scale(1.2);
    background: #0891b2;
}

.layer-info-cloud {
    position: absolute;
    bottom: calc(100% + 12px);
    /* Positioned exactly above the circle with a small gap */
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.9);
    background: white;
    padding: 14px;
    border-radius: 12px;
    width: 220px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    z-index: 100;
}

.layer-tag.active .layer-info-cloud {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

.layer-tag-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #000;
    margin-bottom: 4px;
    display: block;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.layer-tag-desc {
    font-size: 11px;
    color: #475569;
    line-height: 1.4;
    display: block;
}

/* Arrow for the info cloud */
.layer-info-cloud::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid white;
}

/* 3D Visualization Container */
#threeContainer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative;
}

/* Mobile Responsive Styles */
@media (max-width: 1023px) {

    /* Portrait mode */
    .panel {
        padding: 16px;
        margin-bottom: 16px;
    }

    .canvas-container {
        max-width: 100%;
    }

    .cyber-btn {
        padding: 12px 16px;
        font-size: 11px;
        z-index: 100;
        position: relative;
    }
}

/* Mobile Landscape Mode */
@media (max-width: 1023px) and (orientation: landscape) {
    body {
        overflow: hidden;
        /* Prevent page scroll, manage per-section */
    }

    /* Force Row Layout */
    .flex.flex-col.lg\:flex-row {
        flex-direction: row !important;
        height: 100vh !important;
        width: 100vw !important;
    }

    /* 3D Container Area */
    .flex-1.relative.order-2.lg\:order-1 {
        order: 1 !important;
        width: 60% !important;
        flex: 0 0 60% !important;
        height: 100vh;
    }

    #threeContainer {
        width: 100%;
        height: 100%;
    }

    /* Sidebar Area */
    #sidebar {
        order: 2 !important;
        width: 40% !important;
        flex: 0 0 40% !important;
        position: relative !important;
        transform: none !important;
        /* Always show sidebar */
        height: 100vh;
        overflow-y: auto;
        border-left: 1px solid rgba(0, 0, 0, 0.1);
        padding: 10px;
        gap: 10px;
        background: rgba(249, 250, 251, 0.95);
        z-index: 20;
    }

    /* Hide Mobile Toggle Button since sidebar is visible */
    #sidebarToggle {
        display: none !important;
    }

    /* Also hide the close button inside sidebar */
    #closeSidebar {
        display: none !important;
    }

    /* Adjust Panels */
    .panel {
        padding: 10px;
        margin-bottom: 8px;
    }

    .panel-title {
        margin-bottom: 8px;
    }

    /* Smaller Canvas for short screens */
    .canvas-container {
        max-width: 180px;
        /* Reduced from 240px */
        margin: 0 auto;
    }

    /* Button adjustments */
    .cyber-btn {
        padding: 6px 10px;
        font-size: 10px;
        min-height: 32px;
    }

    /* Info Cloud adjustments for landscape */
    .layer-info-cloud {
        width: 180px;
        padding: 10px;
        font-size: 10px;
        /* Position to side if needed, but top is usually okay if container is tall enough */
    }
}

/* Mobile Portrait Mode - HIDE CONTENT, SHOW OVERLAY */
@media (max-width: 1023px) and (orientation: portrait) {
    #mainContent {
        display: none !important;
    }

    #landscapeOverlay {
        display: flex !important;
    }

    body {
        overflow: hidden;
    }
}

/* Base state for overlay (hidden by default) */
#landscapeOverlay {
    display: none;
}

/* Small mobile devices */
@media (max-width: 640px) {
    .panel {
        padding: 12px;
    }

    .panel-title {
        font-size: 9px;
    }

    .cyber-btn {
        padding: 10px 12px;
        font-size: 9px;
    }
}