:root {
    /* Color Palette - Premium Dark Mode */
    --bg-base: #0f1115;
    --bg-surface: #1a1d24;
    --bg-glass: rgba(26, 29, 36, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #6366f1; /* Indigo */
    --accent-primary-hover: #4f46e5;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-purple: #a855f7;
    --accent-blue: #3b82f6;

    /* Magic Gradient for AI */
    --magic-gradient: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    --magic-gradient-hover: linear-gradient(135deg, #9333ea 0%, #4f46e5 100%);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Effects */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.3);
    --radius-md: 12px;
    --radius-lg: 16px;
    --glass-blur: blur(12px);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* --- Layout --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    background: var(--magic-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo i {
    font-size: 28px;
    -webkit-text-fill-color: #a855f7;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item i {
    font-size: 20px;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
}

.nav-item.active i {
    color: var(--accent-primary);
}

.sidebar-footer {
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-success);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    max-width: 1200px;
}

.view-section {
    display: none;
    animation: fadeUp 0.4s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.view-section.active {
    display: block;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    margin-bottom: 32px;
}

.view-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

/* --- Components --- */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header-flex .card-title {
    margin-bottom: 0;
}

/* --- Layouts --- */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.flex-1 { flex: 1; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }

/* --- Forms & Inputs --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition);
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-sm {
    padding: 8px 12px;
}

select.input-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.textarea-large {
    min-height: 120px;
    resize: vertical;
}

.char-count {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
}

.btn i { font-size: 18px; }

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    box-shadow: var(--shadow-glow);
}

.btn-magic {
    background: var(--magic-gradient);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-magic:hover {
    background: var(--magic-gradient-hover);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
}

.btn-danger:hover {
    background-color: var(--accent-danger);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-large {
    padding: 14px 20px;
    font-size: 16px;
}

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

/* --- Drag & Drop Zone --- */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background-color: rgba(0, 0, 0, 0.2);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-primary);
    background-color: rgba(99, 102, 241, 0.05);
}

.drop-zone i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
    transition: var(--transition);
}

.drop-zone:hover i {
    color: var(--accent-primary);
}

.drop-zone h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 13px;
}

.file-preview {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
}

.file-preview video {
    width: 100%;
    aspect-ratio: 9/16;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

.file-preview .btn-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
}

#remove-video {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* --- AI Prompt Area --- */
.ai-prompt-area {
    background: rgba(168, 85, 247, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.generate-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* --- Table --- */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background-color: rgba(255, 255, 255, 0.02); }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px !important;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.badge-publishing { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge-published { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); }

/* --- Settings Grid --- */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card-header-icon {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.card-header-icon i { font-size: 24px; }
.card-header-icon h3 { margin-bottom: 0; }

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

/* --- Progress Bar --- */
.progress-bar-container {
    width: 100%;
    height: 36px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--magic-gradient);
    transition: width 0.3s ease;
    z-index: 1;
}

.progress-text {
    position: relative;
    z-index: 2;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

/* --- Toasts --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show { transform: translateX(0); }

.toast-icon { font-size: 24px; }
.toast-success .toast-icon { color: var(--accent-success); }
.toast-error .toast-icon { color: var(--accent-danger); }

.toast-content h4 { font-size: 14px; margin-bottom: 2px; }
.toast-content p { font-size: 13px; color: var(--text-secondary); }

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