/* ─── DPR Agent System — Premium Dark UI ─────────────────────────────── */

:root {
    --bg-base: #0a0e1a;
    --bg-card: rgba(17, 24, 42, 0.85);
    --bg-card-hover: rgba(25, 35, 60, 0.9);
    --bg-sidebar: rgba(12, 17, 30, 0.95);
    --bg-input: rgba(20, 28, 50, 0.8);

    --border: rgba(99, 130, 195, 0.15);
    --border-focus: rgba(99, 160, 255, 0.5);

    --text-primary: #e8ecf4;
    --text-secondary: #8a9bc0;
    --text-muted: #5a6a8a;

    --accent: #4a90ff;
    --accent-glow: rgba(74, 144, 255, 0.25);
    --accent-green: #34d399;
    --accent-green-glow: rgba(52, 211, 153, 0.2);
    --accent-amber: #fbbf24;
    --accent-red: #f87171;

    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
}

body {
    display: flex;
}


/* ─── Sidebar ──────────────────────────────────────────────────────── */

.sidebar {
    width: 240px;
    min-width: 240px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    transition: var(--transition);
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse 3s ease-in-out infinite;
}

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

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(74, 144, 255, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(74, 144, 255, 0.12);
    color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

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

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.project-selector label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.project-selector select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.project-selector select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}


/* ─── Main Content ─────────────────────────────────────────────────── */

.main-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 0;
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 28px;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.top-bar h1 {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
    letter-spacing: -0.5px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
}

.status-badge {
    padding: 6px 14px;
    background: rgba(74, 144, 255, 0.1);
    border: 1px solid rgba(74, 144, 255, 0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.section {
    display: none;
    padding: 24px 28px;
    animation: fadeIn 0.35s ease;
}

.section.active { display: block; }

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


/* ─── Stats Grid ───────────────────────────────────────────────────── */

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(8px);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #6366f1);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.stat-card:hover::before { opacity: 1; }

.stat-card.accent::before {
    background: linear-gradient(90deg, var(--accent-green), #22c55e);
    opacity: 1;
}

.stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}


/* ─── Cards ────────────────────────────────────────────────────────── */

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

.card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}


/* ─── Charts ───────────────────────────────────────────────────────── */

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}


/* ─── Tables ───────────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(74, 144, 255, 0.08);
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(74, 144, 255, 0.04);
}


/* ─── Progress Bars ────────────────────────────────────────────────── */

.progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(74, 144, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

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

.progress-fill.complete {
    background: linear-gradient(90deg, var(--accent-green), #22c55e);
}

.progress-text {
    font-size: 12px;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
    color: var(--text-secondary);
}


/* ─── Forms ────────────────────────────────────────────────────────── */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group.compact {
    margin-bottom: 0;
}

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

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

input[type="text"], input[type="number"], input[type="date"],
textarea, select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.helper-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}


/* ─── Buttons ──────────────────────────────────────────────────────── */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px var(--accent-glow);
}

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

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(74, 144, 255, 0.1);
    border: 1px solid rgba(74, 144, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(74, 144, 255, 0.18);
}

.btn-accent {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent-green), #22c55e);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--accent-green-glow);
}

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


/* ─── Filter Bar ───────────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}


/* ─── Result Box ───────────────────────────────────────────────────── */

.result-box {
    margin-top: 20px;
    padding: 20px;
    background: rgba(10, 20, 40, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.result-box.hidden { display: none; }

.result-box.success {
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(52, 211, 153, 0.05);
}

.result-box.error {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.05);
}

.result-header {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-box pre {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}


/* ─── Team Grid ────────────────────────────────────────────────────── */

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

.team-member {
    padding: 16px;
    background: rgba(74, 144, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.team-member:hover {
    background: rgba(74, 144, 255, 0.1);
    border-color: rgba(74, 144, 255, 0.2);
}

.team-member .name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.team-member .role {
    font-size: 12px;
    color: var(--text-secondary);
}

.team-member .crew {
    font-size: 11px;
    color: var(--accent);
    margin-top: 4px;
    font-weight: 600;
}


/* ─── Reports List ─────────────────────────────────────────────────── */

.reports-list .report-entry {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    background: rgba(74, 144, 255, 0.03);
    transition: var(--transition);
}

.reports-list .report-entry:hover {
    border-color: rgba(74, 144, 255, 0.2);
}

.report-date {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
}

.report-platforms {
    display: grid;
    gap: 8px;
}

.report-platform {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: rgba(10, 20, 40, 0.5);
    border-radius: var(--radius-sm);
}

.report-platform .pname {
    font-weight: 600;
    min-width: 180px;
}

.report-platform .pscans {
    color: var(--accent-green);
    font-weight: 600;
    min-width: 80px;
}

.report-platform .pprogress {
    flex: 1;
}


/* ─── Loading spinner ──────────────────────────────────────────────── */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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


/* ─── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -240px;
        transition: left var(--transition);
    }
    .sidebar.open { left: 0; }
    .menu-toggle { display: block; }
    .charts-row { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
}

@media (max-width: 600px) {
    .section { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .top-bar { padding: 12px 16px; }
}


/* ─── Detail Modal ─────────────────────────────────────────────────── */

.detail-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.detail-modal-overlay.active {
    display: flex;
}

.detail-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.detail-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(74, 144, 255, 0.05);
}

.detail-modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.detail-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
    line-height: 1;
}

.detail-modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.detail-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

.detail-modal-body ul {
    padding-left: 20px;
}

.detail-modal-body li {
    margin-bottom: 4px;
}


/* ─── Popup Tables ─────────────────────────────────────────────────── */

.popup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.popup-table th {
    text-align: left;
    padding: 10px 12px;
    background: rgba(74, 144, 255, 0.08);
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.popup-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.popup-table tr:hover {
    background: rgba(74, 144, 255, 0.04);
}


/* ─── Team Card (dashboard) ────────────────────────────────────────── */

.team-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(74, 144, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.team-card:hover {
    background: rgba(74, 144, 255, 0.1);
    border-color: rgba(74, 144, 255, 0.2);
}

.team-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.team-info {
    min-width: 0;
}

.team-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.team-crew {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 2px;
}
