:root {
    --bg-dark: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --accent-primary: #6366f1;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #06b6d4;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-light: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(20px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, sans-serif;
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
    height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Toolbar Styling */
.toolbar {
    background: rgba(15, 23, 42, 0.8);
    padding: 12px 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    z-index: 100;
}

.url-input-container {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    flex-grow: 1;
    max-width: 500px;
}

.url-input {
    background: transparent;
    border: none;
    padding: 8px 16px;
    color: white;
    font-size: 14px;
    flex-grow: 1;
    outline: none;
}

/* Button Refinement */
.btn {
    padding: 10px 18px;
    border: 1px solid var(--border-light);
    border-radius: 11px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn i {
    font-size: 14px;
}

.btn-primary { background: var(--accent-primary); color: white; border: none; }
.btn-primary:hover { background: #4f46e5; box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4); }

.btn-success { background: var(--accent-success); color: white; border: none; }
.btn-success:hover { background: #059669; box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4); }

.btn-info { background: var(--accent-info); color: white; border: none; }
.btn-info:hover { background: #0891b2; box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4); }

.btn-warning { background: var(--accent-warning); color: white; border: none; }
.btn-warning:hover { background: #d97706; box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4); }

/* Main Container */
.main-container {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #020617;
    position: relative;
    min-height: 0; /* Important for flex child scrolling */
}

.editor-container, .preview-container {
    flex: 1;
    background: var(--panel-bg);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
    backdrop-filter: var(--glass-blur);
    overflow: hidden; /* Header stays at top */
    transition: var(--transition);
    min-height: 0; /* Allows children to scroll */
}

.editor-container:hover, .preview-container:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.editor-header, .preview-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-header::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-primary);
}

.preview-header::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent-success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-success);
}

/* CodeMirror Override */
.CodeMirror {
    height: 100% !important;
    font-family: 'Fira Code', monospace !important;
    font-size: 15px !important;
    background: transparent !important;
    padding: 10px;
    flex: 1;
}

.CodeMirror-scroll {
    overflow: auto !important;
}

.CodeMirror-gutters {
    background: transparent !important;
    border-right: 1px solid var(--border-light) !important;
}

/* Preview Frame */
.preview-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Status Bar - Floating Pill */
.status-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    backdrop-filter: var(--glass-blur);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 1000;
}

.status-bar::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-success);
    border-radius: 50%;
}

/* Overlay & Modals */
.fullpage-overlay, .responsive-overlay, .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(15px);
    z-index: 2000;
    display: none; /* Initially hidden */
    flex-direction: column;
}

/* Classes to show them */
.modal-overlay.active, 
.responsive-overlay.active, 
.fullpage-overlay.active {
    display: flex !important;
}

.fullpage-header, .responsive-header {
    background: rgba(15, 23, 42, 0.8);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-content {
    background: #1e293b;
    width: 90%;
    max-width: 450px;
    border-radius: 24px;
    padding: 32px;
    margin: auto;
    border: 1px solid var(--border-light);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    color: white;
    font-family: 'Outfit', sans-serif;
    margin-top: 20px;
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

/* Responsive View Controls */
.device-controls {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--border-light);
}

.device-bt {
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.device-bt.active {
    background: var(--accent-primary);
    color: white;
}

/* Device Preview Frames */
.device-frame {
    margin: 40px auto;
    background: #334155;
    padding: 12px;
    border-radius: 32px;
    box-shadow: 0 50px 100px rgba(0,0,0,0.5);
    border: 4px solid #475569;
}

.device-screen {
    background: white;
    border-radius: 20px;
    width: 100%;
    height: 100%;
    border: none;
}

.device-frame.mobile { width: 375px; height: 667px; }
.device-frame.tablet { width: 768px; height: 1024px; }
.device-frame.desktop { width: 1024px; height: 768px; }

/* Responsive adjustments */
@media (max-width: 900px) {
    .main-container {
        flex-direction: column;
    }
}