/* ============================================================
   FORTIGATE DASHBOARD - MAIN STYLES
   ============================================================ */

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

:root {
    --sidebar-width: 240px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --purple: #8b5cf6;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #2d3b4f;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    margin: 0;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

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

.sidebar-brand {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.sidebar-brand span {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 8px;
    overflow-y: auto;
}

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

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

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

.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.nav-badge {
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: auto;
    animation: pulse-badge-nav 2s infinite;
}

@keyframes pulse-badge-nav {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

.nav-item.active .nav-badge {
    background: rgba(255,255,255,0.2);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.live-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

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

.status-dot.live {
    background: var(--success);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.fg-version {
    font-size: 11px;
    opacity: 0.6;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

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

.page-title h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-title h1 i {
    color: var(--primary);
    margin-right: 10px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

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

.btn-secondary:hover {
    background: var(--border-color);
}

.time-display {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ===== DASHBOARD CONTENT ===== */
.dashboard-content {
    padding: 20px 24px 40px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* ===== KPI CARDS ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 14px;
}

.kpi-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.bg-primary { background: rgba(37, 99, 235, 0.2); color: var(--primary); }
.bg-success { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.bg-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.bg-info { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.bg-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.bg-purple { background: rgba(139, 92, 246, 0.2); color: var(--purple); }

.kpi-info {
    flex: 1;
    min-width: 0;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    display: block;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    line-height: 1.2;
}

.kpi-progress {
    margin-top: 6px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}

.progress-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
    background: var(--primary);
}

.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ===== CARDS ===== */
.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.row .col-12 { grid-column: 1 / -1; }
.row .col-8 { grid-column: span 2; }
.row .col-4 { grid-column: span 1; }
.row .col-6 { grid-column: span 1; }

@media (max-width: 1200px) {
    .row { grid-template-columns: 1fr; }
    .row .col-8, .row .col-4 { grid-column: 1; }
    .row .col-6 { grid-column: 1; }
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-color);
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--primary);
}

.card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-select-sm {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}

.form-select-sm:focus {
    outline: none;
    border-color: var(--primary);
}

.card-body {
    padding: 16px 20px;
}

.card-body.table-responsive {
    overflow-x: auto;
    padding: 0;
}

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table thead {
    background: var(--bg-dark);
}

table th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

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

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

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge.up { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.status-badge.down { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.status-badge.warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.status-badge.info { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.status-badge.danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

.status-dot-sm {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-sm.up { background: var(--success); }
.status-dot-sm.down { background: var(--danger); }
.status-dot-sm.warning { background: var(--warning); }

/* ===== INTERFACE LIST ===== */
.interface-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.interface-item:last-child {
    border-bottom: none;
}

.interface-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.interface-name i {
    width: 16px;
    color: var(--text-secondary);
}

.interface-ip {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

/* ===== TOPOLOGY ===== */
.topology-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

.topology-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    border: 2px solid var(--border-color);
    min-width: 120px;
    transition: var(--transition);
}

.topology-node .node-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.topology-node .node-label {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.topology-node .node-status {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.topology-node.core {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

.topology-node.wan { border-color: var(--warning); }
.topology-node.lan { border-color: var(--success); }

.topology-connections {
    display: flex;
    gap: 40px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.connection-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.connection-line {
    width: 2px;
    height: 30px;
    background: var(--border-color);
    position: relative;
}

.connection-line::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -4px;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    transform: rotate(45deg);
}

.connection-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ===== LOADING ===== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 12px;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-brand span, .sidebar-nav .nav-item span, .sidebar-footer .fg-version {
        display: none;
    }
    .sidebar-brand { justify-content: center; padding: 16px 0; }
    .sidebar-nav .nav-item { justify-content: center; padding: 10px; }
    .main-content { margin-left: 60px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .top-bar { flex-direction: column; gap: 8px; padding: 12px 16px; }
    .page-title h1 { font-size: 16px; }
    .nav-badge { display: none; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .dashboard-content { padding: 12px; }
    .kpi-card { padding: 12px 16px; }
}