@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-dark: #07070e;
    --bg-main: #0c0c18;
    --bg-card: #10101e;
    --bg-elevated: #151528;
    --border: #1a1a35;
    --border-light: #252545;
    --text: #e2e2f0;
    --text-muted: #7a7a9a;
    --text-dim: #4a4a6a;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.3);
    --gold: #f59e0b;
    --gold-light: #fbbf24;
    --green: #10b981;
    --green-light: #34d399;
    --red: #ef4444;
    --red-light: #f87171;
    --blue: #3b82f6;
    --blue-light: #60a5fa;
    --orange: #f97316;
    --pink: #ec4899;
    --sidebar-w: 240px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    display: flex;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    background: linear-gradient(180deg, #0e0e1c 0%, #0a0a16 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 60;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 22px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(139,92,246,0.06) 0%, transparent 100%);
}
.sidebar-logo-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 900; font-size: 15px;
    box-shadow: 0 4px 15px rgba(139,92,246,0.4);
    letter-spacing: -0.5px;
}
.sidebar-title { color: #fff; font-size: 15px; font-weight: 800; letter-spacing: -0.3px; }
.sidebar-subtitle { color: var(--text-dim); font-size: 10px; margin-top: 2px; font-weight: 500; }

.sidebar-section { padding: 16px 0 4px; }
.sidebar-label {
    padding: 0 20px 8px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.sidebar-icon {
    width: 18px; height: 18px;
    opacity: 0.5;
    flex-shrink: 0;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    border-left: 3px solid transparent;
    position: relative;
}
.sidebar-item:hover {
    color: var(--text);
    background: rgba(139,92,246,0.05);
}
.sidebar-item:hover .sidebar-icon { opacity: 0.8; }
.sidebar-item.active {
    color: var(--accent-light);
    background: linear-gradient(90deg, rgba(139,92,246,0.12) 0%, transparent 100%);
    border-left-color: var(--accent);
    font-weight: 600;
}
.sidebar-item.active .sidebar-icon { opacity: 1; }

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: rgba(139,92,246,0.03);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--pink) 100%);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 12px; font-weight: 800;
    box-shadow: 0 2px 10px rgba(139,92,246,0.3);
}
.sidebar-user-name { font-size: 12px; color: var(--text); font-weight: 600; }
.sidebar-user-role { font-size: 10px; color: var(--text-dim); font-weight: 500; }

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
}

/* ========================================
   PAGES
   ======================================== */
.page { display: none; flex-direction: column; flex: 1; }
.page.active { display: flex; }

.page-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
}
.page-placeholder-icon {
    width: 64px; height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(139,92,246,0.15) 0%, rgba(139,92,246,0.05) 100%);
    border: 1px solid rgba(139,92,246,0.2);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 20px;
}
.page-placeholder-icon svg { width: 28px; height: 28px; color: var(--accent); }
.page-placeholder h2 { color: var(--text); font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.page-placeholder p { color: var(--text-dim); font-size: 13px; max-width: 300px; }
.page-placeholder .badge-coming {
    margin-top: 16px;
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.2);
    color: var(--accent-light);
    font-size: 11px;
    font-weight: 600;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
}
.header-left {
    display: flex; align-items: center; gap: 12px;
}
.header-title {
    font-size: 16px; font-weight: 700; color: var(--text);
}
.header-badge {
    padding: 3px 10px; border-radius: 12px;
    background: rgba(139,92,246,0.12); border: 1px solid rgba(139,92,246,0.25);
    color: var(--accent-light); font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 15px rgba(139,92,246,0.1);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(139,92,246,0.08);
}
.btn-primary:hover {
    background: rgba(139,92,246,0.15);
    box-shadow: 0 0 20px rgba(139,92,246,0.2);
}

.btn-run {
    border-color: var(--green);
    color: var(--green-light);
    background: rgba(16,185,129,0.08);
    font-weight: 800;
    padding: 8px 22px;
}
.btn-run:hover {
    background: rgba(16,185,129,0.15);
    box-shadow: 0 0 20px rgba(16,185,129,0.2);
    border-color: var(--green-light);
}
.btn-run.running {
    border-color: var(--orange);
    color: var(--orange);
    background: rgba(249,115,22,0.08);
    animation: pulse 1.5s infinite;
}

.workers-input {
    width: 42px;
    background: var(--bg-dark);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 7px 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}
.workers-input:focus { border-color: var(--accent); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ========================================
   TABS
   ======================================== */
.tabs {
    display: flex; gap: 6px; padding: 16px 28px;
    flex-wrap: wrap; border-bottom: 1px solid var(--border);
    background: var(--bg-main);
}
.tab {
    padding: 7px 16px; border-radius: 20px; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted); cursor: pointer;
    font-size: 12px; font-weight: 600; transition: all 0.2s; font-family: inherit;
}
.tab:hover { border-color: var(--border-light); color: var(--text); background: var(--bg-elevated); }
.tab.active {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(139,92,246,0.1);
    box-shadow: 0 0 12px rgba(139,92,246,0.15);
}
.tab .count {
    margin-left: 4px; font-size: 10px; opacity: 0.7;
    background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 8px;
}

/* ========================================
   TABLE
   ======================================== */
.table-wrap { padding: 0; overflow-x: auto; flex: 1; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
    padding: 12px 14px; text-align: left; font-weight: 700;
    color: var(--text-dim); text-transform: uppercase; font-size: 10px;
    letter-spacing: 1px; border-bottom: 1px solid var(--border);
    white-space: nowrap; background: var(--bg-main);
    position: sticky; top: 0; z-index: 1;
}
thead th:first-child { padding-left: 24px; width: 30px; }
thead th.icon-col { width: 30px; text-align: center; padding: 12px 6px; }

tbody tr {
    border-bottom: 1px solid rgba(26,26,53,0.5);
    transition: all 0.15s;
}
tbody tr:hover { background: rgba(139,92,246,0.03); }
tbody tr.selected { background: rgba(139,92,246,0.06); }

td { padding: 10px 14px; white-space: nowrap; vertical-align: middle; }
td:first-child { padding-left: 24px; width: 30px; }
td.icon-col { width: 30px; text-align: center; padding: 10px 6px; }

/* ========================================
   PROFILE PHOTO
   ======================================== */
.profile-photo {
    width: 38px; height: 38px; border-radius: 50%;
    object-fit: cover; border: 2px solid var(--border-light);
    transition: border-color 0.2s;
}
.profile-photo:hover { border-color: var(--accent); }
.profile-photo-placeholder {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
    display: flex; align-items: center;
    justify-content: center; color: var(--text-dim); font-size: 14px;
    font-weight: 700; border: 2px solid var(--border-light);
}

/* ========================================
   USERNAME
   ======================================== */
.username {
    color: var(--accent-light); font-weight: 600; font-size: 13px;
    text-decoration: none; transition: color 0.15s;
}
.username:hover { color: #c4b5fd; text-decoration: underline; }

/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 6px;
    font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
    text-transform: uppercase; margin-left: 8px; vertical-align: middle;
}
.badge-alive { background: rgba(16,185,129,0.12); color: var(--green-light); border: 1px solid rgba(16,185,129,0.2); }
.badge-banned { background: rgba(239,68,68,0.12); color: var(--red-light); border: 1px solid rgba(239,68,68,0.2); }
.badge-created { background: rgba(249,115,22,0.12); color: var(--orange); border: 1px solid rgba(249,115,22,0.2); }
.badge-error { background: rgba(239,68,68,0.08); color: #fca5a5; border: 1px solid rgba(239,68,68,0.15); }
.badge-badpw { background: rgba(249,115,22,0.08); color: #fdba74; border: 1px solid rgba(249,115,22,0.15); }

/* ========================================
   ICONS
   ======================================== */
.icon-ok { color: var(--green); font-size: 14px; }
.icon-fail { color: var(--red); font-size: 14px; }
.icon-none { color: var(--text-dim); }
.icon-link {
    color: var(--text-dim); text-decoration: none; font-size: 14px;
    transition: all 0.15s; display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 6px;
}
.icon-link:hover { color: var(--accent-light); background: rgba(139,92,246,0.1); }

/* ========================================
   MODEL TAG
   ======================================== */
.model-tag {
    display: inline-block; padding: 4px 14px; border-radius: 16px;
    font-size: 11px; font-weight: 600; background: var(--bg-elevated);
    border: 1px solid var(--border-light); color: var(--text-muted);
    transition: all 0.15s;
}
.model-tag:hover { border-color: var(--accent); color: var(--accent-light); }

/* ========================================
   DATE
   ======================================== */
.date-cell { color: var(--text-dim); font-size: 12px; font-weight: 500; }
.date-recent { color: var(--green-light); font-weight: 600; }
.date-old { color: var(--orange); }
.pin-icon { color: var(--red); margin-right: 3px; }

/* ========================================
   METHOD SELECT
   ======================================== */
.method-select {
    background: var(--bg-dark); color: var(--text-muted); border: 1px solid var(--border-light);
    border-radius: 8px; padding: 5px 10px; font-size: 11px; font-weight: 500;
    font-family: inherit; cursor: pointer; outline: none; transition: all 0.15s;
}
.method-select:hover { border-color: var(--accent); color: var(--text); }
.method-select:focus { border-color: var(--accent); box-shadow: 0 0 10px rgba(139,92,246,0.15); }

/* ========================================
   ACTION BUTTONS
   ======================================== */
.action-cell { display: flex; align-items: center; gap: 6px; }
.action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 16px; border-radius: 8px; border: 1px solid;
    font-size: 11px; cursor: pointer; font-weight: 700;
    font-family: inherit;
    transition: all 0.2s ease; white-space: nowrap;
    background: transparent;
}
.action-btn:active { transform: scale(0.95); }
.action-btn .dot {
    width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}

.action-login { border-color: var(--green); color: var(--green-light); }
.action-login:hover { background: rgba(16,185,129,0.1); box-shadow: 0 0 12px rgba(16,185,129,0.15); }
.action-login .dot { background: var(--green); }

.action-reprofile { border-color: var(--orange); color: var(--orange); }
.action-reprofile:hover { background: rgba(249,115,22,0.1); box-shadow: 0 0 12px rgba(249,115,22,0.15); }
.action-reprofile .dot { background: var(--orange); }

.action-pin { border-color: var(--blue); color: var(--blue-light); }
.action-pin:hover { background: rgba(59,130,246,0.1); box-shadow: 0 0 12px rgba(59,130,246,0.15); }
.action-pin .dot { background: var(--blue); }

.action-post { border-color: var(--pink); color: var(--pink); }
.action-post:hover { background: rgba(236,72,153,0.1); box-shadow: 0 0 12px rgba(236,72,153,0.15); }
.action-post .dot { background: var(--pink); }

.action-delete {
    border: none; background: none; color: var(--red);
    font-size: 14px; cursor: pointer; padding: 4px 6px;
    line-height: 1; opacity: 0.3; transition: all 0.2s;
    border-radius: 6px;
}
.action-delete:hover { opacity: 1; background: rgba(239,68,68,0.1); }

/* Link Poster */
.action-link { border-color: #9c27b0; color: #ce93d8; }
.action-link:hover { background: rgba(156,39,176,0.1); box-shadow: 0 0 12px rgba(156,39,176,0.15); }
.action-link .dot { background: #9c27b0; }

.action-link-toggle, .action-unlink {
    border: none; background: none; color: #9c27b0;
    font-size: 13px; cursor: pointer; padding: 4px 6px;
    line-height: 1; opacity: 0.35; transition: all 0.2s;
    border-radius: 6px;
}
.action-link-toggle:hover { opacity: 1; background: rgba(156,39,176,0.1); }
.action-unlink { color: #ce93d8; opacity: 0.6; }
.action-unlink:hover { opacity: 1; background: rgba(156,39,176,0.15); }

.badge-link-poster {
    display: inline-block; padding: 2px 8px; border-radius: 8px;
    font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
    background: rgba(156,39,176,0.12); color: #ce93d8;
    border: 1px solid rgba(156,39,176,0.25);
}

.row-link-poster { background: rgba(156,39,176,0.03); }

.tab-link { border-color: #9c27b0 !important; }
.tab-link.active { color: #ce93d8 !important; border-bottom-color: #9c27b0 !important; }
.tab-link .count { background: rgba(156,39,176,0.15); color: #ce93d8; }

/* ========================================
   PAGINATION
   ======================================== */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 20px; border-top: 1px solid var(--border);
    padding-bottom: 200px; background: var(--bg-main);
}

/* ========================================
   LOADING / EMPTY
   ======================================== */
.loading { text-align: center; padding: 50px; color: var(--text-dim); font-weight: 500; }
.empty { text-align: center; padding: 60px; color: var(--text-dim); font-size: 13px; font-weight: 500; }

/* ========================================
   CHECKBOX
   ======================================== */
input[type="checkbox"] {
    accent-color: var(--accent); cursor: pointer;
    width: 15px; height: 15px;
}

/* ========================================
   LOG PANEL
   ======================================== */
.log-panel {
    position: fixed; bottom: 0; left: var(--sidebar-w); right: 0;
    z-index: 50;
    background: linear-gradient(180deg, var(--bg-main) 0%, var(--bg-dark) 100%);
    border-top: 1px solid var(--border);
    display: flex; flex-direction: column;
    max-height: 40vh;
    transition: max-height 0.25s ease;
}
.log-panel.collapsed { max-height: 36px; }
.log-panel.collapsed .log-body { display: none; }

.log-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 20px; cursor: pointer; user-select: none;
    color: var(--text-muted); font-size: 12px; font-weight: 700;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    transition: color 0.15s;
}
.log-header:hover { color: var(--text); }
.log-header-left { display: flex; align-items: center; gap: 8px; }
.log-header-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--green); animation: pulse 2s infinite;
}

.log-body {
    flex: 1; overflow-y: auto; padding: 0;
    min-height: 100px;
}
.log-content {
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 11px; line-height: 1.7; padding: 10px 20px;
    white-space: pre-wrap; word-break: break-all;
}
.log-line { color: var(--text-muted); padding: 1px 0; }
.log-line .log-ts { color: var(--text-dim); margin-right: 10px; font-size: 10px; }
.log-line.log-error { color: var(--red-light); }
.log-line.log-ok { color: var(--green-light); }
.log-line.log-warn { color: var(--gold); }
.log-line.log-phase { color: var(--blue-light); }
.log-line.log-info { color: var(--text-muted); }

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ========================================
   MODAL
   ======================================== */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.75); backdrop-filter: blur(4px);
    z-index: 100; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 28px;
    width: 520px; max-width: 92vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(139,92,246,0.1);
}
.modal h3 { color: #fff; margin-bottom: 16px; font-size: 16px; font-weight: 700; }
.modal-label { color: var(--text-muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.modal-input {
    background: var(--bg-dark); color: var(--text); border: 1px solid var(--border-light);
    border-radius: 8px; padding: 8px 12px; font-size: 12px; font-family: inherit;
    outline: none; transition: border-color 0.2s; width: 100%;
}
.modal-input:focus { border-color: var(--accent); }
.modal-textarea {
    background: var(--bg-dark); color: var(--text); border: 1px solid var(--border-light);
    border-radius: 8px; padding: 12px; font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 11px; resize: vertical; outline: none; width: 100%;
    transition: border-color 0.2s;
}
.modal-textarea:focus { border-color: var(--accent); }
.modal-hint { color: var(--text-dim); font-size: 10px; margin-top: 4px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ========================================
   SELECTION
   ======================================== */
::selection { background: rgba(139,92,246,0.3); color: #fff; }

/* ===== Modo EMBEBIDO (iframe dentro del Lumina Suite) =====
   Oculta el sidebar propio y la marca "DM Media"; el X Panel ocupa todo el ancho. */
.embed .sidebar { display: none !important; }
.embed .main-content { margin-left: 0 !important; }
.embed .log-panel { left: 0 !important; }
