/* ==================== Glassmorphism Twitch Dashboard ==================== */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0f0f2e;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.08);
    --accent: #9147ff;
    --accent-glow: rgba(145, 71, 255, 0.3);
    --accent-light: #b380ff;
    --success: #00e676;
    --warning: #ffab40;
    --danger: #ff5252;
    --info: #40c4ff;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --sidebar-width: 280px;
    --font: 'Tajawal', sans-serif;
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, rgba(145, 71, 255, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(64, 196, 255, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(0, 230, 118, 0.04) 0%, transparent 50%);
    animation: bgShift 30s ease-in-out infinite;
    z-index: 0;
}

@keyframes bgShift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-2%, -2%) rotate(1deg); }
    66% { transform: translate(2%, 1%) rotate(-1deg); }
}

/* ==================== Login Page ==================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 48px;
    width: 420px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-card .logo {
    font-size: 48px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 14px;
}

/* ==================== Glassmorphism Components ==================== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.glass:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
}

.glass-card:hover {
    background: var(--glass-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ==================== Input Fields ==================== */
.form-group {
    margin-bottom: 20px;
    text-align: right;
}

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder { color: var(--text-muted); }

textarea.form-input {
    resize: vertical;
    min-height: 100px;
    font-family: monospace, var(--font);
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-slider {
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    position: relative;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    right: 2px;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(-20px);
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7b2ff7);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-success { background: linear-gradient(135deg, #00c853, #00e676); }
.btn-danger { background: linear-gradient(135deg, #d32f2f, #ff5252); }
.btn-warning { background: linear-gradient(135deg, #f57c00, #ffab40); }
.btn-info { background: linear-gradient(135deg, #0288d1, #40c4ff); }

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ==================== Layout ==================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 15, 46, 0.8);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    padding: 24px 0;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 16px;
}

.sidebar-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--info));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-header .brand-text h2 {
    font-size: 16px;
    font-weight: 700;
}

.sidebar-header .brand-text span {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-section {
    padding: 8px 12px;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 8px;
    margin-top: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    margin-bottom: 2px;
}

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

.sidebar-link.active {
    background: var(--accent-glow);
    color: var(--text-primary);
    font-weight: 500;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.sidebar-link .badge {
    margin-right: auto;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}

.badge-success { background: rgba(0, 230, 118, 0.2); color: var(--success); }
.badge-danger { background: rgba(255, 82, 82, 0.2); color: var(--danger); }
.badge-warning { background: rgba(255, 171, 64, 0.2); color: var(--warning); }
.badge-info { background: rgba(64, 196, 255, 0.2); color: var(--info); }

/* Main Content */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}

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

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h1 i {
    color: var(--accent);
}

/* ==================== Stats Cards ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.purple { background: rgba(145, 71, 255, 0.2); color: var(--accent-light); }
.stat-icon.green { background: rgba(0, 230, 118, 0.2); color: var(--success); }
.stat-icon.blue { background: rgba(64, 196, 255, 0.2); color: var(--info); }
.stat-icon.orange { background: rgba(255, 171, 64, 0.2); color: var(--warning); }
.stat-icon.red { background: rgba(255, 82, 82, 0.2); color: var(--danger); }

.stat-info h3 {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ==================== Grid Layouts ==================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ==================== Card Sections ==================== */
.section-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-body {
    padding: 24px;
}

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

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

th {
    padding: 12px 16px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ==================== Log Console ==================== */
.log-console {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Fira Code', monospace, var(--font);
    font-size: 12px;
    line-height: 1.8;
}

.log-entry {
    display: flex;
    gap: 8px;
    padding: 2px 0;
}

.log-time { color: var(--text-muted); white-space: nowrap; }
.log-info { color: var(--info); }
.log-success { color: var(--success); }
.log-warning { color: var(--warning); }
.log-error { color: var(--danger); }

/* ==================== Progress Bar ==================== */
.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--accent), var(--info));
}

.progress-fill.green { background: linear-gradient(90deg, #00c853, #00e676); }

/* ==================== Tags & Chips ==================== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.tag-purple { background: rgba(145, 71, 255, 0.2); color: var(--accent-light); }
.tag-green { background: rgba(0, 230, 118, 0.2); color: var(--success); }
.tag-blue { background: rgba(64, 196, 255, 0.2); color: var(--info); }
.tag-red { background: rgba(255, 82, 82, 0.2); color: var(--danger); }
.tag-orange { background: rgba(255, 171, 64, 0.2); color: var(--warning); }

/* ==================== Modal ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 32px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal { transform: scale(1); }

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover { background: rgba(255, 82, 82, 0.2); color: var(--danger); }

/* ==================== File Upload ==================== */
.file-upload {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload:hover {
    border-color: var(--accent);
    background: rgba(145, 71, 255, 0.05);
}

.file-upload i { font-size: 36px; color: var(--accent); margin-bottom: 12px; }
.file-upload p { color: var(--text-secondary); font-size: 14px; }

.file-upload input[type="file"] { display: none; }

/* ==================== Channel Tabs ==================== */
.channel-tabs {
    display: flex;
    gap: 8px;
    padding: 0 24px;
    border-bottom: 1px solid var(--glass-border);
    overflow-x: auto;
}

.channel-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.channel-tab:hover { color: var(--text-primary); }
.channel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ==================== Bot Status Indicator ==================== */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.offline { background: var(--text-muted); }
.status-dot.working { background: var(--warning); box-shadow: 0 0 8px var(--warning); animation: pulse 1.5s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .sidebar { width: 260px; }
    .main-content { margin-right: 260px; padding: 20px; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-right: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==================== Loading Spinner ==================== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== Toast Notifications ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
}

.toast.success { border-right: 3px solid var(--success); }
.toast.error { border-right: 3px solid var(--danger); }
.toast.warning { border-right: 3px solid var(--warning); }

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h4 { font-size: 18px; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; }

/* Action buttons row */
.actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Flex utils */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }
