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

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

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.5);
    
    --card-border: rgba(255, 255, 255, 0.05);
    --glass-blur: blur(12px);
    
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
}

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

body {
    overflow-x: hidden;
    background: radial-gradient(circle at top left, #1e1b4b, var(--bg-dark));
    min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.logo-icon {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    box-shadow: 0 0 20px var(--accent-glow);
}

.main-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

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

.nav-item.active {
    color: var(--text-main);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), transparent);
    border-left: 3px solid var(--accent);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.top-header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
}

/* Modules Grid */
.section-title {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.module-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.module-card:hover {
    transform: scale(1.02) translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.module-card:hover::before {
    opacity: 1;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}

.module-title {
    font-size: 1.4rem;
    font-weight: 800;
}

.module-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    flex: 1;
}

.module-stats {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.module-link {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    transition: background 0.3s ease;
}

.module-card:hover .module-link {
    background: var(--accent);
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 24px;
    padding: 2.5rem;
    overflow: (auto);
    position: relative;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2.5rem;
    cursor: pointer;
}

.control-panel {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

.status-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.running { background: #10b981; color: #fff; box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); }
.status-badge.stopped { background: #64748b; color: #fff; }

.editor-section {
    margin-bottom: 2.5rem;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
}

.tab-btn.active {
    background: var(--accent);
    color: #fff;
}

#prompt_editor {
    width: 100%;
    height: 300px;
    background: #000;
    color: #34d399;
    border: 1px solid var(--card-border);
    border-radius: 0 12px 12px 12px;
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
}

.btn-save {
    margin-top: 1rem;
    background: #10b981;
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
}

.logs-section pre {
    background: #000;
    color: #94a3b8;
    padding: 1.5rem;
    border-radius: 12px;
    font-size: 0.85rem;
    overflow-x: auto;
    max-height: 200px;
}

/* YouTube Module Stages */
.module-stages {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stage-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.stage-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.stage-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stage-card .control-panel {
    margin-bottom: 0;
    padding: 0.8rem;
    gap: 0.8rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.mini-logs {
    background: #000;
    color: #34d399;
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    height: 80px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
}

/* Storage View */
.storage-container {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    min-height: 500px;
}

.storage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
}

#storage_path {
    font-family: monospace;
    color: var(--accent);
    font-weight: 600;
}

.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.file-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-3px);
    border-color: var(--accent);
}

.file-icon {
    font-size: 2.5rem;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    word-break: break-all;
}

.file-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}
