:root {
    --bg-dark: #07090e;
    --panel-bg: rgba(13, 17, 26, 0.95);
    --border: rgba(0, 242, 254, 0.2);
    --primary: #00f2fe;
    --primary-glow: rgba(0, 242, 254, 0.35);
    --accent: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.35);
    --text-main: #f9fafb;
    --text-dim: #9ca3af;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
}

/* Authentication Screen */
#authOverlay {
    position: fixed;
    inset: 0;
    background: #07090e;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(circle at center, rgba(0, 242, 254, 0.05) 0%, transparent 70%);
}

.auth-box {
    width: 90%;
    max-width: 420px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 20px var(--primary-glow);
    backdrop-filter: blur(10px);
}

.auth-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-glow), var(--accent-glow));
    border: 1px solid var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 20px;
    box-shadow: 0 0 25px var(--primary-glow);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Main Layout */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
}

.sidebar {
    width: 330px;
    background: #0a0e17;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.15rem;
}

.brand i {
    color: var(--primary);
    font-size: 1.3rem;
    filter: drop-shadow(0 0 8px var(--primary));
}

.script-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.script-item {
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.script-item:hover {
    background: rgba(0, 242, 254, 0.06);
    border-color: var(--primary);
    transform: translateX(2px);
}

.script-item.active {
    background: rgba(0, 242, 254, 0.12);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

.script-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.script-slug {
    font-size: 0.75rem;
    color: var(--primary);
    font-family: 'JetBrains Mono', Consolas, monospace;
}

.script-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 6px;
    display: flex;
    gap: 12px;
}

/* Workspace */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #07090e;
}

.topbar {
    padding: 14px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0a0e16;
}

.topbar-info h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.topbar-info .meta {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 3px;
}

.topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Editor */
.editor-box {
    flex: 1;
    position: relative;
    display: flex;
}

.code-area {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #05070c;
    color: #e5e7eb;
    border: none;
    outline: none;
    padding: 24px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}

/* Buttons & Inputs */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #00f2fe, #38bdf8);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 14px;
    outline: none;
    transition: all 0.2s;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.form-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-align: left;
}

/* Modals */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.modal-bg.open {
    display: flex;
}

.modal-box {
    width: 90%;
    max-width: 500px;
    background: #0f1420;
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 16px;
    padding: 26px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
}

/* Toast */
.toast-box {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    animation: slideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-success {
    background: #064e3b;
    color: #34d399;
    border: 1px solid #059669;
}

.toast-error {
    background: #7f1d1d;
    color: #f87171;
    border: 1px solid #dc2626;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
