/* ═══════════════════════════════════════════════════════════════════
   Instagram Platform Destroyer — Admin UI Styles
   ═══════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0f0f13;
    --bg-card:   #1a1a24;
    --bg-input:  #22222e;
    --bg-hover:  #2a2a3a;
    --border:    #2e2e3e;
    --text:      #e0e0e8;
    --text-muted:#888898;
    --primary:   #6c5ce7;
    --primary-h: #7f70f0;
    --success:   #00b894;
    --success-h: #00d9a7;
    --danger:    #e74c3c;
    --danger-h:  #ff6b6b;
    --warning:   #fdcb6e;
    --info:      #74b9ff;
    --hot:       #ff4b4b;
    --warm:      #ffa500;
    --cold:      #4b9fff;
    --radius:    8px;
    --radius-sm: 4px;
    --shadow:    0 4px 24px rgba(0,0,0,0.3);
    --font:      'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:      'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-h); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: var(--danger-h); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-block { display: block; width: 100%; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── Alerts ─────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-error { background: var(--danger); color: #fff; }
.alert-success { background: var(--success); color: #fff; }

/* ═════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═════════════════════════════════════════════════════════════════════ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f13 0%, #1a1a2e 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 { font-size: 1.8rem; margin-bottom: 4px; }
.login-header p { color: var(--text-muted); font-size: 0.95rem; }

/* ═════════════════════════════════════════════════════════════════════
   TOP BAR
   ═════════════════════════════════════════════════════════════════════ */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-icon  { font-size: 1.4rem; }
.topbar-title { font-size: 1.1rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user  { color: var(--text-muted); font-size: 0.9rem; }

/* ═════════════════════════════════════════════════════════════════════
   TABS NAV
   ═════════════════════════════════════════════════════════════════════ */
.tabs-nav {
    display: flex;
    gap: 0;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 56px;
    z-index: 99;
}
.tab-btn {
    padding: 14px 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    font-family: var(--font);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ═════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═════════════════════════════════════════════════════════════════════ */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.panel-header h2 { margin-right: auto; }
.panel-header p { width: 100%; }

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

/* ═════════════════════════════════════════════════════════════════════
   VECTOR LIST
   ═════════════════════════════════════════════════════════════════════ */
.vector-list { display: flex; flex-direction: column; gap: 8px; }

.vector-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}
.vector-item:hover { border-color: var(--primary); }

.vector-info { flex: 1; min-width: 0; }
.vector-url {
    font-family: var(--mono);
    font-size: 0.88rem;
    color: var(--info);
    word-break: break-all;
    display: block;
    margin-bottom: 4px;
}
.vector-context {
    font-size: 0.88rem;
    color: var(--text-muted);
    display: block;
}
.vector-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ═════════════════════════════════════════════════════════════════════
   SESSION CARDS
   ═════════════════════════════════════════════════════════════════════ */
.session-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
}
.session-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.session-card-header h3 { font-size: 1.05rem; }
.session-card-info {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    min-height: 40px;
}
.upload-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Status Badge ──────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-badge.status-ok     { background: var(--success); color: #fff; }
.status-badge.status-missing { background: var(--danger); color: #fff; }
.status-badge.status-idle   { background: var(--bg-hover); color: var(--text-muted); }
.status-badge.status-running { background: var(--primary); color: #fff; }
.status-badge.status-finished { background: var(--info); color: #fff; }

/* ═════════════════════════════════════════════════════════════════════
   STATS
   ═════════════════════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.stat-card h3 {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-big {
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-muted); }
.stat-value { font-weight: 600; }

.stat-value.hot  { color: var(--hot); }
.stat-value.warm { color: var(--warm); }
.stat-value.cold { color: var(--cold); }
.stat-value.invalid { color: #808080; }
.stat-value.success { color: var(--success); }
.stat-value.danger  { color: var(--danger); }

/* ═════════════════════════════════════════════════════════════════════
   PROCESS CARDS
   ═════════════════════════════════════════════════════════════════════ */
.process-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}
.process-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.process-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.process-card-header h3 { font-size: 1.1rem; }
.process-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ═════════════════════════════════════════════════════════════════════
   MODALS
   ═════════════════════════════════════════════════════════════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}
.modal-lg { max-width: 900px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.modal-body-log {
    padding: 0;
    background: #0a0a10;
    min-height: 400px;
    max-height: 60vh;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
}

/* ── Log Panel ─────────────────────────────────────────────────────── */
.log-panel {
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.7;
    padding: 12px 16px;
    overflow-y: auto;
    min-height: 400px;
    max-height: 60vh;
}
.log-line {
    padding: 1px 0;
    white-space: pre-wrap;
    word-break: break-all;
}
.log-line.log-error { color: var(--danger); }
.log-line.log-warning { color: var(--warning); }
.log-line.log-info { color: var(--info); }
.log-line.log-success { color: var(--success); }

/* ═════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═════════════════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease;
    max-width: 400px;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-info    { background: var(--info);    color: #fff; }
.toast-warning { background: var(--warning); color: #000; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading Spinner ───────────────────────────────────────────────── */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ── Empty State ───────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 8px; color: var(--text); }

/* ═════════════════════════════════════════════════════════════════════
   SETTINGS
   ═════════════════════════════════════════════════════════════════════ */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}
.settings-section-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
}
.settings-section-header h3 {
    font-size: 1rem;
    font-weight: 600;
}
.settings-fields {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.settings-field {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    align-items: center;
    gap: 12px;
}
.settings-label {
    font-family: var(--mono);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.settings-input,
.settings-field select.settings-input {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--mono);
    transition: border-color 0.2s;
    max-width: 400px;
}
.settings-input:focus {
    outline: none;
    border-color: var(--primary);
}
.settings-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Toggle switch */
.settings-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: 0.2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.2s;
}
.settings-toggle input:checked + .toggle-slider {
    background: var(--primary);
    border-color: var(--primary);
}
.settings-toggle input:checked + .toggle-slider::before {
    background: #fff;
    transform: translateX(20px);
}
.settings-toggle-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 30px;
}

@media (max-width: 768px) {
    .settings-field {
        grid-template-columns: 1fr;
    }
    .settings-label {
        margin-bottom: 4px;
    }
}

/* ═════════════════════════════════════════════════════════════════════
   DATA MANAGEMENT
   ═════════════════════════════════════════════════════════════════════ */
.data-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.data-toolbar select {
    min-width: 240px;
}

.data-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th {
    background: var(--bg-hover);
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.data-table tr:hover td {
    background: var(--bg-hover);
}
.data-table tr:last-child td {
    border-bottom: none;
}
.data-key {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--info);
    word-break: break-all;
    max-width: 300px;
}
.data-preview {
    color: var(--text-muted);
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .tabs-nav { overflow-x: auto; padding: 0 12px; }
    .tab-btn  { padding: 12px 14px; font-size: 0.85rem; white-space: nowrap; }
    .main-content { padding: 16px; }
    .panel-header { flex-direction: column; align-items: flex-start; }
    .session-grid, .process-grid, .stats-grid { grid-template-columns: 1fr; }
    .data-toolbar { flex-direction: column; }
    .data-key, .data-preview { max-width: 100%; }
}
