/* ============================================
   GALACTIC BACKUP COMMAND - Modern Star Wars
   Clean, modern dashboard with Star Wars soul
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Core palette - inspired by Star Wars but modern */
    --sw-cyan: #22d3ee;
    --sw-cyan-dim: rgba(34, 211, 238, 0.5);
    --sw-blue: #3b82f6;
    --sw-purple: #8b5cf6;
    --sw-red: #ef4444;
    --sw-red-dim: rgba(239, 68, 68, 0.5);
    --sw-green: #22c55e;
    --sw-green-dim: rgba(34, 197, 94, 0.5);
    --sw-yellow: #eab308;
    --sw-yellow-dim: rgba(234, 179, 8, 0.5);
    --sw-orange: #f97316;
    
    /* Background layers */
    --bg-base: #030712;
    --bg-surface: rgba(15, 23, 42, 0.6);
    --bg-elevated: rgba(30, 41, 59, 0.5);
    --bg-hover: rgba(51, 65, 85, 0.4);
    
    /* Glass effect */
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(148, 163, 184, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.05);
    
    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accents */
    --accent: var(--sw-cyan);
    --accent-dim: var(--sw-cyan-dim);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(34, 211, 238, 0.15);
    
    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Star Wars Crawl Background */
.crawl-container {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -2;
    perspective: 400px;
    background: radial-gradient(ellipse at bottom, #0a0a12 0%, #000 100%);
}

.crawl-wrapper {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 100%;
    max-width: 800px;
    transform: translateX(-50%) rotateX(25deg);
    transform-origin: 50% 0;
    animation: crawl 120s linear infinite;
}

.crawl-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 2;
    text-align: justify;
    color: rgb(229, 177, 58);
    opacity: 0.12;
    padding: 0 2rem;
    text-shadow: 0 0 10px rgba(229, 177, 58, 0.3);
}

.crawl-text p {
    margin-bottom: 2rem;
}

.crawl-text .title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    letter-spacing: 0.1em;
}

@keyframes crawl {
    0% {
        top: 100%;
    }
    100% {
        top: -300%;
    }
}

/* Gradient fade at top */
.crawl-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(3, 7, 18, 1) 0%,
        rgba(3, 7, 18, 0.8) 10%,
        transparent 30%,
        transparent 70%,
        rgba(3, 7, 18, 0.5) 90%,
        rgba(3, 7, 18, 1) 100%
    );
    pointer-events: none;
}

/* Subtle star particles on top */
.stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image: 
        radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 30% 65%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1.5px 1.5px at 55% 15%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 70% 85%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1.5px 1.5px at 85% 40%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 95% 70%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 5% 50%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1.5px 1.5px at 45% 90%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 75% 30%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 25% 10%, rgba(255,255,255,0.3), transparent);
    background-size: 200px 200px;
    animation: twinkle 4s ease-in-out infinite;
}

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

/* ============================================
   HEADER
   ============================================ */

.header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.875rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.logo-icon {
    font-size: 1.75rem;
    filter: drop-shadow(0 0 8px var(--sw-cyan-dim));
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--sw-cyan), var(--sw-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-surface);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.nav-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 2rem;
    font-weight: 400;
}

/* ============================================
   STATS GRID
   ============================================ */

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

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--glass-highlight), transparent);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.stat-card.clickable {
    text-decoration: none;
    cursor: pointer;
    display: block;
}

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

.stat-card.clickable::after {
    content: '→';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.stat-card.clickable:hover::after {
    opacity: 1;
    transform: translateX(2px);
}

.stat-card.danger { --card-accent: var(--sw-red); }
.stat-card.warning { --card-accent: var(--sw-yellow); }
.stat-card.success { --card-accent: var(--sw-green); }
.stat-card.info { --card-accent: var(--sw-cyan); }

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--card-accent, var(--sw-cyan));
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.375rem;
}

.stat-character {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   CHARACTER QUOTE PANEL
   ============================================ */

.character-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.character-avatar {
    font-size: 2.5rem;
    min-width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.character-quote {
    flex: 1;
}

.character-quote blockquote {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 400;
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.character-quote cite {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: normal;
}

/* ============================================
   DATA PANELS
   ============================================ */

.data-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-highlight);
}

.panel-title {
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--text-primary);
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   DATA TABLES
   ============================================ */

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

.data-table th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.data-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.875rem;
}

.data-table tr {
    transition: background 0.15s ease;
}

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

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

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge.online {
    background: rgba(34, 197, 94, 0.15);
    color: var(--sw-green);
}

.status-badge.offline {
    background: rgba(239, 68, 68, 0.15);
    color: var(--sw-red);
}

.status-badge.warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--sw-yellow);
}

.status-badge.info {
    background: rgba(34, 211, 238, 0.15);
    color: var(--sw-cyan);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 2s ease-in-out infinite;
}

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

/* ============================================
   ALERT TYPES
   ============================================ */

.alert-type {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-type-icon {
    font-size: 1rem;
}

.alert-type.critical { color: var(--sw-red); }
.alert-type.warning { color: var(--sw-yellow); }
.alert-type.info { color: var(--sw-cyan); }

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: rgba(148, 163, 184, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--sw-cyan), var(--sw-blue));
    border: none;
    color: #030712;
    font-weight: 600;
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 20px var(--sw-cyan-dim);
}

.btn-danger {
    color: var(--sw-red);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--sw-red);
}

.btn-success {
    color: var(--sw-green);
    border-color: rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--sw-green);
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* ============================================
   GRID LAYOUTS
   ============================================ */

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 1200px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ============================================
   AGENT CARDS
   ============================================ */

.agent-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.agent-card:hover {
    transform: translateY(-2px);
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: var(--shadow-lg);
}

.agent-card.offline {
    border-color: rgba(239, 68, 68, 0.2);
}

.agent-card.offline:hover {
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.15);
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.agent-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.agent-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.agent-detail {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.agent-detail-label {
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.agent-detail-value {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   SNAPSHOT CARDS
   ============================================ */

.snapshot-card {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.snapshot-card:hover {
    border-color: rgba(148, 163, 184, 0.2);
    background: var(--bg-elevated);
}

.snapshot-info { flex: 1; }

.snapshot-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.snapshot-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.snapshot-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--glass-border);
    border-top-color: var(--sw-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

.loading-text {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.empty-state-text {
    font-size: 0.875rem;
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--sw-cyan);
    box-shadow: 0 0 0 3px var(--sw-cyan-dim);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.modal {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    max-width: 560px;
    width: 90%;
    max-height: 80vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .main-content {
        padding: 1.5rem 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .page-title {
        font-size: 1.375rem;
    }
    
    .character-panel {
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-success { color: var(--sw-green); }
.text-danger { color: var(--sw-red); }
.text-warning { color: var(--sw-yellow); }
.text-info { color: var(--sw-cyan); }
.text-muted { color: var(--text-muted); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.hidden { display: none; }
.mono { font-family: 'JetBrains Mono', monospace; }
