:root {
    /* Color Palette - Premium Dark Theme */
    --bg-base: #0f111a;
    --bg-panel: rgba(25, 28, 41, 0.6);
    --bg-panel-hover: rgba(33, 37, 54, 0.8);
    
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #3b82f6;
    --accent: #06b6d4;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --border: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(139, 92, 246, 0.5);
    
    --error: #ef4444;
    --success: #10b981;

    /* Shadows & Effects */
    --shadow-panel: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --glass-blur: blur(12px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Background Glow Effects */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: float 20s infinite alternate ease-in-out;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.orb-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.1); }
}

/* Layout */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 1rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Panels */
.panel {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-panel);
    transition: var(--transition);
}

/* Config Section */
.config-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

input[type="url"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

input[type="url"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.status-indicator {
    position: absolute;
    right: 1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--error);
    box-shadow: 0 0 8px var(--error);
    transition: var(--transition);
}

.status-indicator.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.system-info {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.info-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.info-badge span {
    color: var(--accent);
    font-weight: 600;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    cursor: pointer;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover, .upload-zone.drag-active {
    border-color: var(--primary);
    background: var(--bg-panel-hover);
}

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

.upload-zone:hover .upload-icon {
    transform: translateY(-5px);
}

.upload-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

#image-preview {
    max-height: 400px;
    max-width: 100%;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Action Panel */
.action-panel {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

/* Buttons */
.btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--secondary) 100%);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
}

/* Result Zone */
.comparison-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .comparison-container {
        flex-direction: row;
        justify-content: center;
        align-items: stretch;
    }
}

.image-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.image-box h4 {
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.image-box img {
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
    object-fit: contain;
}

.result-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: center;
}

.arrow-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    padding: 1rem;
}

@media (max-width: 767px) {
    .arrow-divider svg {
        transform: rotate(90deg);
    }
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Loaders */
.loader {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

.processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 17, 26, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--accent);
    font-weight: 500;
}

.pulse-loader {
    width: 40px;
    height: 40px;
    background-color: var(--primary);
    border-radius: 100%;
    animation: pulse 1s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    backdrop-filter: var(--glass-blur);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.5);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.5);
}
