/* FundedNext UI Automation Dashboard — Premium Dark Theme */

/* ========================================================================
   BASE & SCROLLBAR
   ======================================================================== */

* { box-sizing: border-box; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.3); }

.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

::selection { background: rgba(139, 92, 246, 0.3); color: white; }

/* ========================================================================
   GLASSMORPHISM COMPONENTS
   ======================================================================== */

.glass-header {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.glass-nav {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.glass-card {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.5);
}

/* ========================================================================
   TABS
   ======================================================================== */

.tab-content { display: none; animation: fadeSlideIn 0.35s ease-out; }
.tab-content.active { display: block; }

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

.tab-btn {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    border-radius: 10px 10px 0 0;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
}

.tab-btn:hover { color: #94a3b8; }

.tab-btn.active {
    color: #e2e8f0;
    background: rgba(139, 92, 246, 0.08);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, #8b5cf6, #3b82f6);
    border-radius: 2px;
}

.tab-icon { margin-right: 2px; }

/* ========================================================================
   STAT CARDS
   ======================================================================== */

.stat-card {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 40px rgba(139, 92, 246, 0.05);
}

/* ========================================================================
   BUTTONS
   ======================================================================== */

.btn-gradient-green {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}
.btn-gradient-green:hover { box-shadow: 0 6px 25px rgba(16, 185, 129, 0.35); transform: translateY(-1px); }
.btn-gradient-green:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-gradient-red {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}
.btn-gradient-red:hover { box-shadow: 0 6px 25px rgba(239, 68, 68, 0.35); transform: translateY(-1px); }
.btn-gradient-red:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-gradient-blue {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}
.btn-gradient-blue:hover { box-shadow: 0 6px 25px rgba(59, 130, 246, 0.3); transform: translateY(-1px); }

.btn-gradient-purple {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}
.btn-gradient-purple:hover { box-shadow: 0 6px 25px rgba(139, 92, 246, 0.3); transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    color: #94a3b8;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-outline:hover { border-color: rgba(255, 255, 255, 0.2); color: #e2e8f0; background: rgba(255, 255, 255, 0.03); }

/* Filter buttons */
.filter-btn {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.filter-btn:hover { color: #94a3b8; border-color: rgba(255, 255, 255, 0.1); }
.filter-btn.active { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border-color: rgba(139, 92, 246, 0.3); }

/* ========================================================================
   LOG CONSOLE
   ======================================================================== */

.log-console {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    line-height: 1.5;
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 12px 14px;
    overflow-y: auto;
    max-height: 400px;
    scroll-behavior: smooth;
}

.log-console .log-line { padding: 1px 0; white-space: pre-wrap; word-break: break-all; }
.log-console .log-line.cmd { color: #38bdf8; }
.log-console .log-line.info { color: #94a3b8; }
.log-console .log-line.passed { color: #4ade80; }
.log-console .log-line.failed { color: #f87171; }
.log-console .log-line.skipped { color: #fbbf24; }
.log-console .log-line.error { color: #fb923c; }
.log-console .log-line.output { color: #cbd5e1; }

/* ========================================================================
   SCREENSHOT CONTAINER
   ======================================================================== */

.screenshot-container {
    background: rgba(2, 6, 23, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s;
}

.screenshot-container.running {
    border-color: rgba(74, 222, 128, 0.3);
    animation: borderGlow 2s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { border-color: rgba(74, 222, 128, 0.2); box-shadow: 0 0 20px rgba(74, 222, 128, 0.05); }
    50% { border-color: rgba(74, 222, 128, 0.5); box-shadow: 0 0 40px rgba(74, 222, 128, 0.1); }
}

.screenshot-container img { max-width: 100%; height: auto; display: block; }
.screenshot-container img.hidden { display: none; }
.screenshot-container .placeholder { color: #475569; text-align: center; padding: 3rem; }

/* ========================================================================
   STATUS & BADGES
   ======================================================================== */

.status-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-pulse.running { background: #4ade80; animation: pulse 1.5s infinite; }
.status-pulse.idle { background: #475569; }
.status-pulse.failed { background: #f87171; }

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
}

.badge {
    font-size: 0.65rem;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
}

.badge-passed { background: rgba(22, 101, 52, 0.3); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.15); }
.badge-failed { background: rgba(127, 29, 29, 0.3); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.15); }
.badge-skipped { background: rgba(120, 53, 15, 0.3); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.15); }
.badge-blocked { background: rgba(88, 28, 135, 0.3); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.15); }
.badge-running { background: rgba(30, 58, 95, 0.3); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.15); }
.badge-not_executed { background: rgba(30, 41, 59, 0.3); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.15); }
.badge-error { background: rgba(154, 52, 18, 0.3); color: #fb923c; border: 1px solid rgba(251, 146, 60, 0.15); }

/* ========================================================================
   PROGRESS RING (SVG-based)
   ======================================================================== */

.progress-ring { transform: rotate(-90deg); }
.progress-ring__bg { stroke: rgba(255, 255, 255, 0.05); fill: none; }
.progress-ring__fill { fill: none; stroke-linecap: round; transition: stroke-dashoffset 1s ease-in-out; }

/* ========================================================================
   TABLES
   ======================================================================== */

table { border-collapse: collapse; }
table tbody tr { transition: background 0.15s; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
table tbody tr:hover { background: rgba(139, 92, 246, 0.04); }
table tbody td { padding: 10px 12px; }
table thead th { padding: 0 12px; }

.run-row { cursor: pointer; }
.run-row:hover { background: rgba(139, 92, 246, 0.08) !important; }

/* ========================================================================
   TOGGLE SWITCH
   ======================================================================== */

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #374151;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-switch.active { background: linear-gradient(135deg, #059669, #10b981); }
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.toggle-switch.active::after { transform: translateX(20px); }

/* ========================================================================
   CONFIG FORMS
   ======================================================================== */

.config-field label {
    display: block;
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.config-field input,
.config-field select,
.config-field textarea {
    width: 100%;
    padding: 9px 12px;
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.85rem;
    transition: all 0.2s;
    font-family: inherit;
}

.config-field input:focus,
.config-field select:focus,
.config-field textarea:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ========================================================================
   WRITER COMBOBOX (Run tab)
   ======================================================================== */

.combobox-label {
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.writer-combobox { position: relative; }

.combobox-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    user-select: none;
}
.combobox-trigger:hover { border-color: rgba(255, 255, 255, 0.12); }
.combobox-trigger.open {
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.combobox-value {
    font-size: 0.85rem;
    color: #e2e8f0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.combobox-arrow {
    color: #475569;
    font-size: 0.75rem;
    margin-left: 8px;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.combobox-trigger.open .combobox-arrow { transform: rotate(180deg); }

.combobox-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(13, 20, 38, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: comboboxIn 0.15s ease-out;
}
@keyframes comboboxIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.combobox-search-wrap {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.combobox-search-wrap input {
    width: 100%;
    padding: 7px 10px;
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 7px;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.combobox-search-wrap input:focus { border-color: rgba(139, 92, 246, 0.4); }

.combobox-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
}

.combobox-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
}
.combobox-item:hover { background: rgba(139, 92, 246, 0.12); color: #e2e8f0; }
.combobox-item.selected { background: rgba(139, 92, 246, 0.18); color: #a78bfa; font-weight: 500; }

.combobox-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.combobox-avatar.all { background: linear-gradient(135deg, #475569, #334155); font-size: 0.75rem; }

/* ========================================================================
   SUITE CARDS (Run tab)
   ======================================================================== */

.suite-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(2, 6, 23, 0.3);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.suite-card:hover { border-color: rgba(255, 255, 255, 0.1); background: rgba(2, 6, 23, 0.5); }

.suite-card.selected {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.08);
}

.suite-card .suite-check {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.suite-card.selected .suite-check {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    border-color: transparent;
}

.suite-card.selected .suite-check::after {
    content: '✓';
    color: white;
    font-size: 11px;
    font-weight: 700;
}

/* ========================================================================
   MODAL
   ======================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden { display: none; }

.modal-content { animation: modalSlideIn 0.3s ease-out; }

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

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ========================================================================
   TOAST
   ======================================================================== */

.toast {
    padding: 12px 20px;
    border-radius: 12px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.toast.success { background: rgba(22, 101, 52, 0.85); border: 1px solid rgba(74, 222, 128, 0.2); }
.toast.error { background: rgba(127, 29, 29, 0.85); border: 1px solid rgba(248, 113, 113, 0.2); }
.toast.info { background: rgba(30, 58, 95, 0.85); border: 1px solid rgba(56, 189, 248, 0.2); }

.toast.fade-out { animation: toastOut 0.3s ease-in forwards; }

@keyframes toastIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(40px); opacity: 0; } }

/* ========================================================================
   MINI DONUT (CSS)
   ======================================================================== */

.mini-donut {
    position: relative;
    width: 64px;
    height: 64px;
}

.mini-donut canvas { width: 64px !important; height: 64px !important; }

.mini-donut-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
}

/* ========================================================================
   ANIMATED COUNTER
   ======================================================================== */

.counter { font-variant-numeric: tabular-nums; }

/* ========================================================================
   PROGRESS BAR
   ======================================================================== */

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    overflow: hidden;
    height: 6px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */

@media (max-width: 768px) {
    .glass-card { padding: 14px; border-radius: 12px; }
    .tab-btn { padding: 8px 10px; font-size: 12px; }
    .tab-icon { display: none; }
}
