/* ===== DESIGN SYSTEM ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-tertiary: #16161f;
    --bg-panel: #12121a;
    --bg-panel-header: #16161f;
    --bg-hover: #1e1e2a;
    
    --border-primary: #1e1e2e;
    --border-glow: rgba(139, 92, 246, 0.25);
    --border-subtle: rgba(255, 255, 255, 0.04);
    
    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;
    --text-tertiary: #55556a;
    --text-accent: #a78bfa;
    
    --accent-primary: #7c3aed;
    --accent-hover: #8b5cf6;
    --accent-glow: rgba(124, 58, 237, 0.4);
    --accent-gradient: linear-gradient(135deg, #7c3aed, #a78bfa);
    --accent-gradient-2: linear-gradient(135deg, #6d28d9, #8b5cf6);
    
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.3);
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --input-dot: #22c55e;
    --output-dot: #a78bfa;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.15);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ===== BACKGROUND EFFECTS ===== */
.bg-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(124, 58, 237, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.2), transparent 70%);
    top: -150px;
    left: -100px;
    animation: orbFloat1 20s ease-in-out infinite;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent 70%);
    bottom: -100px;
    right: -100px;
    animation: orbFloat2 25s ease-in-out infinite;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.1), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: orbFloat3 18s ease-in-out infinite;
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(80px, 50px); }
    66% { transform: translate(-30px, 80px); }
}

@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-60px, -40px); }
    66% { transform: translate(40px, -70px); }
}

@keyframes orbFloat3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
}

/* ===== APP CONTAINER ===== */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px 32px 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.app-header {
    text-align: center;
    margin-bottom: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.3)); }
    50% { filter: drop-shadow(0 0 16px rgba(124, 58, 237, 0.6)); }
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 3px 8px;
    background: var(--accent-gradient);
    color: white;
    border-radius: 20px;
    text-transform: uppercase;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* ===== FEATURES BAR ===== */
.features-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.feature-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-normal);
    user-select: none;
    position: relative;
}

.feature-chip:hover {
    border-color: var(--border-glow);
    background: var(--bg-hover);
    color: var(--text-primary);
}

.feature-chip.active {
    border-color: var(--border-glow);
    color: var(--text-accent);
    background: rgba(124, 58, 237, 0.08);
}

.chip-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: all var(--transition-normal);
}

.feature-chip.active .chip-indicator {
    background: var(--success);
    box-shadow: 0 0 6px var(--success-glow);
}

/* ===== EDITOR WRAPPER ===== */
.editor-wrapper {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
}

/* ===== EDITOR PANELS ===== */
.editor-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
    min-height: 400px;
}

.editor-panel:hover {
    border-color: var(--border-glow);
}

.input-panel:focus-within {
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: var(--shadow-md), 0 0 20px rgba(34, 197, 94, 0.05);
}

.output-panel:focus-within {
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: var(--shadow-md), 0 0 20px rgba(139, 92, 246, 0.05);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-panel-header);
    border-bottom: 1px solid var(--border-primary);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.input-dot {
    background: var(--input-dot);
    box-shadow: 0 0 8px var(--success-glow);
}

.output-dot {
    background: var(--output-dot);
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.4);
}

.panel-actions {
    display: flex;
    gap: 4px;
}

.panel-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 500;
}

.panel-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-primary);
    color: var(--text-primary);
}

.copy-btn {
    color: var(--text-accent);
}

.copy-btn:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: var(--border-glow);
}

.copy-label {
    font-size: 0.72rem;
}

.editor-body {
    flex: 1;
    position: relative;
    min-height: 0;
}

textarea {
    width: 100%;
    height: 100%;
    min-height: 350px;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    padding: 16px 20px;
    tab-size: 4;
}

textarea::placeholder {
    color: var(--text-tertiary);
    font-style: italic;
}

textarea::-webkit-scrollbar {
    width: 6px;
}

textarea::-webkit-scrollbar-track {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 3px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.3);
}

#output-editor {
    color: var(--text-accent);
    cursor: default;
}

.panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    border-top: 1px solid var(--border-primary);
    background: var(--bg-panel-header);
}

.char-count {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.size-ratio {
    font-size: 0.68rem;
    color: var(--text-accent);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ===== CENTER CONTROLS ===== */
.center-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    gap: 12px;
}

.obfuscate-btn {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    background: var(--bg-tertiary);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.obfuscate-btn:hover {
    transform: scale(1.1);
    border-color: var(--accent-hover);
    box-shadow: 0 0 30px var(--accent-glow);
}

.obfuscate-btn:active {
    transform: scale(0.95);
}

.obfuscate-btn.processing {
    pointer-events: none;
    border-color: var(--accent-hover);
}

.btn-glow {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--accent-primary), transparent, var(--accent-primary));
    opacity: 0;
    transition: opacity var(--transition-normal);
    animation: none;
}

.obfuscate-btn:hover .btn-glow {
    opacity: 0.3;
}

.obfuscate-btn.processing .btn-glow {
    opacity: 0.6;
    animation: spinGlow 1.5s linear infinite;
}

@keyframes spinGlow {
    to { transform: rotate(360deg); }
}

.btn-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.btn-icon {
    color: var(--text-accent);
    transition: all var(--transition-normal);
}

.obfuscate-btn:hover .btn-icon {
    color: white;
}

.btn-text {
    display: none;
}

.btn-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: var(--accent-gradient);
    border-radius: 0 0 50% 50%;
    transition: width 0.3s ease;
}

.obfuscate-status {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    text-align: center;
    min-height: 16px;
    font-weight: 500;
    max-width: 80px;
    white-space: nowrap;
}

.obfuscate-status.active {
    color: var(--text-accent);
    animation: statusPulse 1s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== STATS BAR ===== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 14px 24px;
    margin-top: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    animation: slideUpFade 0.4s ease-out;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-value {
    font-size: 0.85rem;
    color: var(--text-accent);
    font-weight: 700;
    font-family: var(--font-mono);
}

/* ===== FOOTER ===== */
.app-footer {
    text-align: center;
    padding: 16px 0 8px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
    color: var(--text-accent);
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-normal);
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .editor-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto 1fr;
        gap: 0;
    }
    
    .center-controls {
        flex-direction: row;
        padding: 12px 0;
    }
    
    .app-container {
        padding: 16px;
    }
    
    .features-bar {
        gap: 6px;
    }
    
    .feature-chip {
        font-size: 0.7rem;
        padding: 5px 10px;
    }
    
    .stats-bar {
        flex-wrap: wrap;
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .features-bar {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .feature-chip {
        flex-shrink: 0;
    }
    
    .logo-text h1 {
        font-size: 1.4rem;
    }
}

/* ===== PROCESSING ANIMATIONS ===== */
.editor-panel.processing {
    position: relative;
}

.editor-panel.processing::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(2px);
    z-index: 10;
    border-radius: var(--radius-lg);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Glitch effect on output during processing */
@keyframes glitchText {
    0%, 100% { opacity: 1; }
    10% { opacity: 0.8; transform: translateX(1px); }
    20% { opacity: 1; transform: translateX(-1px); }
    30% { opacity: 0.9; transform: translateX(0); }
}

.output-panel.glitch textarea {
    animation: glitchText 0.1s infinite;
}

/* ===== CUSTOM SELECTION ===== */
::selection {
    background: rgba(124, 58, 237, 0.3);
    color: white;
}
