/* ============================================
   KYD Platform - Stylesheet
   Know Your Devices - Network Trust Engine
   ============================================ */

:root {
    /* Colors - Dark Theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-card: #16161e;
    --bg-hover: #1e1e28;
    
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #5a5a70;
    
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --warning: #eab308;
    --warning-bg: rgba(234, 179, 8, 0.15);
    --orange: #f97316;
    --orange-bg: rgba(249, 115, 22, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.15);
    
    --border-color: #2a2a38;
    --border-light: #3a3a48;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;
    
    /* Effects */
    --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);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

html {
    font-size: 14px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

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

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-icon {
    color: var(--accent-primary);
    font-size: 1.8rem;
}

.logo-text {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

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

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

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

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

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

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

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

.user-org {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

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

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

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

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

.header-time {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.content-body {
    padding: 32px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

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

.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 4px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

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

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

/* Trust Score Badge */
.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-mono);
}

.trust-badge.verified { background: var(--success-bg); color: var(--success); }
.trust-badge.trusted { background: var(--warning-bg); color: var(--warning); }
.trust-badge.uncertain { background: var(--orange-bg); color: var(--orange); }
.trust-badge.unknown { background: var(--danger-bg); color: var(--danger); }

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-badge.online::before { background: var(--success); }
.status-badge.offline::before { background: var(--danger); }
.status-badge.stale::before { background: var(--warning); }
.status-badge.left::before { background: var(--text-muted); }

/* Device Row */
.device-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.device-name {
    font-weight: 500;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-secondary);
    box-shadow: 0 0 20px var(--accent-glow);
}

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

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

.btn-danger {
    background: var(--status-danger);
    color: white;
    border: 1px solid var(--status-danger);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

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

.btn-info:hover {
    background: var(--accent-primary);
    color: white;
}

/* Events Timeline */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--border-color);
}

.event-item.join { border-left-color: var(--success); }
.event-item.leave { border-left-color: var(--danger); }
.event-item.anomaly { border-left-color: var(--warning); }
.event-item.alert { border-left-color: var(--orange); }

.event-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.event-item.join .event-icon { background: var(--success-bg); color: var(--success); }
.event-item.leave .event-icon { background: var(--danger-bg); color: var(--danger); }
.event-item.anomaly .event-icon { background: var(--warning-bg); color: var(--warning); }

.event-content {
    flex: 1;
}

.event-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.event-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.event-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
}

.error-message {
    padding: 12px 16px;
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    color: var(--danger);
    margin-bottom: 20px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar-header,
    .nav-item span,
    .user-details,
    .logo-subtitle {
        display: none;
    }
    
    .logo-text {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: 14px;
    }
    
    .main-content {
        margin-left: 70px;
    }
}

