/* ===== CSS Variables (shared with style.css) ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #16161f;
    --border-color: #262633;
    
    --text-primary: #e8e8ed;
    --text-secondary: #a0a0b0;
    --text-muted: #6a6a7a;
    
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #eab308 100%);
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
    --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.3);
    --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.3);
    --shadow-glow-yellow: 0 0 20px rgba(245, 158, 11, 0.3);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Dashboard Layout ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

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

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

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-blue);
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--accent-blue);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-avatar svg {
    width: 20px;
    height: 20px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-plan {
    font-size: 0.75rem;
    color: var(--accent-green);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.main-header {
    padding: 20px 32px;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.current-site-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
}

.current-site-indicator .indicator-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.btn-icon-only {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-icon-only svg {
    width: 18px;
    height: 18px;
}

/* ===== Content Area ===== */
.content-area {
    flex: 1;
    padding: 32px;
}

/* ===== Sections ===== */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.safe {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-yellow);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.stat-trend {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
}

.stat-trend.up {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.stat-trend.down {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.stat-trend.neutral {
    background: rgba(100, 100, 120, 0.15);
    color: var(--text-muted);
}

/* ===== Panel ===== */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.panel-header h2 {
    font-size: 1.125rem;
    margin: 0;
}

.view-all {
    font-size: 0.85rem;
    color: var(--accent-blue);
}

.panel-body {
    padding: 24px;
}

/* ===== Current Site Panel ===== */
.current-site-panel .site-info {
    margin-bottom: 20px;
}

.site-url {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    font-family: var(--font-mono);
}

.site-meta {
    display: flex;
    gap: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item svg {
    width: 14px;
    height: 14px;
}

.site-status-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.status-item {
    text-align: center;
}

.status-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.status-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.status-value.positive {
    color: var(--accent-green);
}

.status-value.warn {
    color: var(--accent-yellow);
}

.status-value.danger {
    color: var(--accent-red);
}

/* ===== Scan List ===== */
.scan-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scan-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.scan-item:hover {
    border-color: var(--accent-blue);
}

.scan-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.scan-status.status-secure {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.scan-status.status-caution {
    background: var(--accent-yellow);
    box-shadow: 0 0 8px var(--accent-yellow);
}

.scan-status.status-danger {
    background: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.scan-details {
    flex: 1;
}

.scan-url {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    word-break: break-all;
}

.scan-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-yellow);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-secure {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), var(--shadow-glow-blue);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-blue);
    background: var(--bg-card);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* ===== Filters ===== */
.filters {
    display: flex;
    gap: 12px;
}

.filter-select, .filter-date {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-primary);
}

.filter-select:focus, .filter-date:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* ===== Reports Table ===== */
.reports-table {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--bg-card);
}

/* ===== Settings ===== */
.settings-group {
    margin-bottom: 32px;
}

.settings-group h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.setting-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-label span:first-child {
    font-weight: 600;
    font-size: 0.9rem;
}

.setting-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: .3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: var(--accent-green);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* ===== Modal (same as landing page) ===== */
.report-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 24px;
}

/* Report Grid */
.report-summary {
    margin-bottom: 24px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.report-category {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.report-category h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.report-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.report-row:last-child {
    border-bottom: none;
}

.report-label {
    color: var(--text-secondary);
}

.report-value {
    font-weight: 600;
}

.report-value.good { color: var(--accent-green); }
.report-value.warn { color: var(--accent-yellow); }
.report-value.bad { color: var(--accent-red); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .site-status-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .report-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-header {
        padding: 16px;
    }
    
    .content-area {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .site-status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
