:root {
    --bg: #05070a;
    --surface: #0c1016;
    --surface-hover: #161c24;
    --border: rgba(255, 255, 255, 0.08);
    --accent: #00f2c3;
    --accent-glow: rgba(0, 242, 195, 0.15);
    --secondary: #0099ff;
    --text: #f0f4f8;
    --text-muted: #8a99a8;
    --danger: #ff3d71;
    --warning: #ffaa00;
    --success: #00d68f;
    --glass: rgba(255, 255, 255, 0.02);
    --sidebar-width: 260px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 var(--accent-glow);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 242, 195, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 242, 195, 0);
    }
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 100;
    padding: 32px 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 48px;
    text-decoration: none;
    color: inherit;
}

.logo-img {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-group {
    margin-bottom: 32px;
}

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-left: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 15px;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-icon {
    font-size: 18px;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Main Content */
.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 40px;
    max-width: 1600px;
    width: 100%;
}

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

.title-h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
}

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    opacity: 0.5;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -1px;
}

.stat-blue {
    color: var(--secondary);
}

.stat-green {
    color: var(--success);
}

.stat-red {
    color: var(--danger);
}

.stat-warn {
    color: var(--warning);
}

/* Content Sections */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    animation: fadeIn 0.4s ease-out;
}

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

.section-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 16px 20px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

td {
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

td:last-child {
    white-space: nowrap;
    width: 1%;
}


.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.s-not-tested {
    background: rgba(138, 153, 168, 0.1);
    color: var(--text-muted);
}

.s-running {
    background: rgba(0, 153, 255, 0.1);
    color: var(--secondary);
    animation: pulse 2s infinite;
}

.s-pass {
    background: rgba(0, 214, 143, 0.1);
    color: var(--success);
}

.s-fail {
    background: rgba(255, 61, 113, 0.1);
    color: var(--danger);
}

.s-stopped {
    background: rgba(255, 160, 50, 0.1);
    color: #ffa032;
}

.s-paused {
    background: rgba(138, 153, 168, 0.15);
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #05070a;
    box-shadow: 0 4px 14px var(--accent-glow);
}

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

.btn-ghost {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Form Controls */
.form-group {
    margin-bottom: 24px;
}

.label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 14px 18px;
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    transition: border 0.2s;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

.upload-zone {
    border: 2px dashed var(--border);
    padding: 48px;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* Log Panel */
.log-panel {
    background: #000;
    font-family: 'JetBrains Mono', monospace;
    padding: 24px;
    font-size: 13px;
    line-height: 1.6;
    color: #a0aec0;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 98%;
    max-width: 98vw;
    height: 96vh;
    max-height: 96vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    margin: 2vh auto;
}

.url-label {
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 13px;
    cursor: help;
    transition: all 0.3s ease;
}

.url-label:hover {
    max-width: 100%;
    color: var(--text-color);
}

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.report-mini-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.report-mini-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.report-mini-value {
    font-size: 20px;
    font-weight: 700;
}

.result-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.result-item.vulnerable {
    border-left: 4px solid var(--danger);
}

.result-item.safe {
    border-left: 4px solid var(--success);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.result-path {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--text);
}

.result-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 8px;
}

.badge-red {
    background: var(--danger);
    color: #fff;
}

.badge-green {
    background: var(--success);
    color: #fff;
}

.badge-blue {
    background: var(--secondary);
    color: #fff;
}

/* Wizard Steps */
.wizard-step {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.wizard-step.active {
    display: block;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 40px;
}

.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    position: relative;
}

.step-dot.active {
    background: var(--accent);
    color: #05070a;
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.step-dot.completed {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.step-dot:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -33px;
    top: 15px;
    width: 32px;
    height: 2px;
    background: var(--border);
}

.step-dot.completed::after {
    background: var(--success);
}

.analysis-card {
    background: rgba(0, 242, 195, 0.03);
    border: 1px solid var(--accent-glow);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
}

.variable-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.variable-name {
    font-family: var(--mono);
    color: var(--accent);
    font-size: 13px;
}

/* Loading Animation */
.loading-pulse {
    width: 64px;
    height: 64px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

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

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 450px;
    display: inline-block;
    vertical-align: middle;
}

/* System Status Sidebar Section */
.system-status-container {
    margin-top: auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 8px;
}

.status-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 700;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.status-row:last-child {
    margin-bottom: 0;
}

.status-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.status-indicator.online {
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.status-indicator.offline {
    background: var(--danger);
    box-shadow: 0 0 10px rgba(255, 61, 113, 0.2);
}

.status-label-text {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-label-text.online {
    color: var(--accent);
}

.status-label-text.offline {
    color: var(--danger);
}

/* Flag Helper Styles */
.flags-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.flag-category {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
}

.flag-category h3 {
    margin: 0 0 16px 0;
    color: var(--secondary);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flag-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.flag-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.flag-card:hover {
    border-color: var(--accent);
    background: rgba(100, 255, 218, 0.05);
    transform: translateY(-2px);
}

.flag-name {
    color: var(--accent);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    display: block;
}

.flag-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.flags-grid::-webkit-scrollbar {
    width: 6px;
}

.flags-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Custom Dropdown Styles */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    padding: 8px;
    font-size: 12px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: -10px;
    /* Shift slightly right to clear textarea */
    top: calc(100% + 5px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    width: 300px;
    margin-top: 0;
    overflow: hidden;
}

.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-search {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.dropdown-items {
    max-height: 400px;
    overflow-y: auto;
}

.dropdown-category {
    padding: 8px 12px;
    background: rgba(100, 255, 218, 0.05);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-item {
    padding: 8px 12px;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-item label {
    margin: 0;
    user-select: none;
}

.dropdown-items::-webkit-scrollbar {
    width: 4px;
}

.dropdown-items::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* Hide Spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}