:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
    
    /* Glassmorphism */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(12px);
    
    /* Layout */
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    position: relative;
}

/* Background Animated Orbs */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite alternate;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59,130,246,0.8) 0%, rgba(15,23,42,0) 70%);
}

.orb-2 {
    bottom: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139,92,246,0.6) 0%, rgba(15,23,42,0) 70%);
    animation-delay: -5s;
}

.orb-3 {
    top: 40%;
    left: 50%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16,185,129,0.3) 0%, rgba(15,23,42,0) 70%);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Main Container */
.container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

/* Header */
.header {
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Select Dropdown */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "▼";
    font-size: 0.8rem;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
}

select {
    width: 100%;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: calc(var(--radius) / 2);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    appearance: none;
    cursor: pointer;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* File Upload Zone */
.file-upload-zone {
    border: 2px dashed var(--glass-border);
    border-radius: calc(var(--radius) / 2);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(15, 23, 42, 0.3);
    position: relative;
    overflow: hidden;
}

.file-upload-zone:hover, .file-upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.upload-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.file-name-display {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    border-radius: 20px;
    display: inline-block;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Buttons */
.primary-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: calc(var(--radius) / 2);
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.primary-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.primary-btn:disabled {
    background: rgba(59, 130, 246, 0.3);
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.5);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) / 2);
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Loader */
.btn-loader, .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

.spinner {
    width: 40px;
    height: 40px;
    border-top-color: var(--accent-primary);
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results Section */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Error Box */
.error-box {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.error-box svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Summary Dashboard */
.summary-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-card {
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

/* Patterns */
.patterns-container h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    border-left: 4px solid var(--accent-primary);
}

.patterns-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pattern-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pattern-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.pattern-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.pattern-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.pattern-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pattern-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: calc(var(--radius) / 2);
    background: rgba(0,0,0,0.2);
    padding: 0.5rem;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}

/* Raw JSON */
.raw-json-container {
    padding: 1rem;
}

pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: calc(var(--radius) / 2);
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: #a78bfa;
    margin-top: 1rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

@media (max-width: 600px) {
    .summary-dashboard {
        grid-template-columns: 1fr;
    }
}
