/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-color: #08090c;
    --panel-bg: rgba(18, 20, 28, 0.7);
    --panel-border: rgba(255, 255, 255, 0.07);
    --text-main: #f1f3f9;
    --text-muted: #8e99b2;
    --accent-purple: #a855f7;
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    --glow-purple: rgba(168, 85, 247, 0.45);
    --glow-cyan: rgba(6, 182, 212, 0.45);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Space Grotesk', 'Courier New', Courier, monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Futuristic Background Glows */
.glow-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.glow-bg::before, .glow-bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.22;
}

.glow-bg::before {
    background: var(--accent-purple);
    width: 45vw;
    height: 45vw;
    top: -10vw;
    right: -5vw;
    animation: float1 25s infinite alternate ease-in-out;
}

.glow-bg::after {
    background: var(--accent-cyan);
    width: 50vw;
    height: 50vw;
    bottom: -15vw;
    left: -10vw;
    animation: float2 30s infinite alternate ease-in-out;
}

@keyframes float1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-8vw, 12vw) scale(1.15); }
}

@keyframes float2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10vw, -10vw) scale(0.9); }
}

/* Header */
.app-header {
    max-width: 1400px;
    width: 90%;
    margin: 2rem auto 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-area h1 {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, #ffffff 40%, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: var(--accent-purple);
}

.subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    font-weight: 300;
    max-width: 700px;
}

/* Grid Layout */
.dashboard-grid {
    max-width: 1400px;
    width: 90%;
    margin: 0 auto 3rem;
    display: grid;
    grid-template-columns: 1.1fr 1.3fr;
    gap: 1.5rem;
    z-index: 10;
    flex: 1;
}

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

/* Panels (Glassmorphism) */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 1.8rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.panel h2 {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
}

/* Drop Zone UI */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.015);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drop-zone.dragover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.05);
    box-shadow: 0 0 20px var(--glow-cyan);
    transform: scale(1.01);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 1rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.drop-zone:hover .upload-icon {
    color: var(--accent-cyan);
    transform: translateY(-3px);
}

.drop-text {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.or-divider {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* File Info display */
.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    animation: fadeIn 0.4s ease forwards;
}

.file-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 75%;
}

.file-size {
    color: var(--text-muted);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Settings Sliders */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.settings-group h3 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
}

.setting-item label span {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
}

/* Range Input styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    transition: background 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--glow-cyan);
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #ffffff;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 1.4rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
    filter: brightness(1.15);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-purple);
    color: #ffffff;
    box-shadow: none;
}

.btn-primary.btn-outline:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.1);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary:disabled, .btn-primary:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-upload {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    margin: 0 auto;
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-group .btn {
    flex: 1;
    min-width: 180px;
}

/* Analysis results */
.analysis-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.95rem;
    text-align: center;
    padding: 2rem;
}

.analysis-results {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease forwards;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
}

.metric-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin-top: 0.2rem;
    overflow: hidden;
}

.metric-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    transition: width 0.8s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.blueprint-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background: rgba(168, 85, 247, 0.03);
    border: 1px solid rgba(168, 85, 247, 0.12);
    border-radius: 10px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
}

.accent-cyan {
    color: var(--accent-cyan);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.accent-purple {
    color: var(--accent-purple);
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

/* JSON display area */
.blueprint-viewer {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.blueprint-viewer h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.json-display {
    background: #040507;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    max-height: 180px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.4;
    color: #4ade80; /* matrix green */
}

/* Custom Scrollbar for JSON */
.json-display::-webkit-scrollbar {
    width: 6px;
}
.json-display::-webkit-scrollbar-track {
    background: transparent;
}
.json-display::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Playback Column Visualizer */
.visualizer-container {
    position: relative;
    width: 100%;
    height: 240px;
    border-radius: 12px;
    background: #030406;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
}

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

.status-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 4, 6, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    backdrop-filter: blur(4px);
    z-index: 5;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(168, 85, 247, 0.1);
    border-top: 3px solid var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#status-text {
    font-size: 0.95rem;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    color: var(--text-main);
}

.playback-controls {
    display: flex;
    gap: 1rem;
}

.playback-controls .btn {
    flex: 1;
}

/* Progress bar */
.progress-bar-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.8rem 1rem;
}

.progress-bar {
    width: 0%;
    height: 6px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    box-shadow: 0 0 10px var(--glow-purple);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.time-display {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
    display: block;
    margin-top: 0.4rem;
}

/* Export Section */
.export-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.2rem;
}

.export-actions h3 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.export-notice {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    margin-top: 0.2rem;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    z-index: 10;
}

/* Custom Checkbox styles */
.checkbox-item {
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-main);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    position: relative;
    outline: none;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:hover {
    border-color: rgba(255, 255, 255, 0.45);
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--glow-cyan);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid #08090c;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
