:root {
    --primary: 198 51% 47%;      /* #2563eb */
    --primary-hover: 198 51% 42%; /* #1d4ed8 */
    --secondary: 210 11% 71%;     /* #9ca3af */
    --success: 142 76% 36%;       /* #16a34a */
    --danger: 0 84% 60%;          /* #dc2626 */
    --warning: 45 93% 47%;        /* #ca8a04 */
    --info: 195 100% 50%;         /* #0ea5e9 */
    --purple: 259 94% 51%;        /* #7c3aed */
    --light: 210 11% 98%;         /* #f8fafc */
    --dark: 220 26% 14%;          /* #1e293b */
    --background: 210 11% 98%;    /* #f8fafc */
    --surface: 0 0% 100%;         /* #ffffff */
    --text: 220 26% 14%;          /* #1e293b */
    --text-muted: 210 11% 71%;    /* #64748b */
    --border: 210 11% 91%;        /* #e2e8f0 */
}

body {
    background-color: hsl(var(--background));
    color: hsl(var(--text));
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    padding-top: 60px; /* Account for fixed navbar */
}

/* Navigation Styles */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.nav-link {
    font-weight: 500;
    border-radius: 0.375rem;
    margin: 0 0.25rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Cards */
.card {
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: hsl(var(--light));
    border-bottom: 1px solid hsl(var(--border));
    border-radius: 0.75rem 0.75rem 0 0 !important;
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Statistics Cards */
.card.bg-primary {
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary-hover)) 100%) !important;
    border: none;
}

.card.bg-success {
    background: linear-gradient(135deg, hsl(var(--success)) 0%, #15803d 100%) !important;
    border: none;
}

.card.bg-info {
    background: linear-gradient(135deg, hsl(var(--info)) 0%, #0284c7 100%) !important;
    border: none;
}

.card.bg-warning {
    background: linear-gradient(135deg, hsl(var(--warning)) 0%, #a16207 100%) !important;
    border: none;
}

.card.bg-danger {
    background: linear-gradient(135deg, hsl(var(--danger)) 0%, #b91c1c 100%) !important;
    border: none;
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.btn-primary:hover {
    background-color: hsl(var(--primary-hover));
    border-color: hsl(var(--primary-hover));
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Tables */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 0;
}

.table thead th {
    background-color: hsl(var(--light));
    border-bottom: 2px solid hsl(var(--border));
    font-weight: 600;
    padding: 1rem 0.75rem;
}

.table tbody tr:hover {
    background-color: hsl(var(--light) / 0.5);
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
}

/* Forms */
.form-control {
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 0.2rem hsl(var(--primary) / 0.25);
}

.form-label {
    font-weight: 600;
    color: hsl(var(--text));
    margin-bottom: 0.5rem;
}

/* Modals */
.modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.modal-header {
    background-color: hsl(var(--light));
    border-bottom: 1px solid hsl(var(--border));
    border-radius: 0.75rem 0.75rem 0 0;
}

.modal-title {
    font-weight: 600;
    color: hsl(var(--text));
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.alert-success {
    background-color: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
}

.alert-danger {
    background-color: hsl(var(--danger) / 0.1);
    color: hsl(var(--danger));
}

.alert-warning {
    background-color: hsl(var(--warning) / 0.1);
    color: hsl(var(--warning));
}

.alert-info {
    background-color: hsl(var(--info) / 0.1);
    color: hsl(var(--info));
}

/* Purple Badge Support */
.bg-purple {
    background-color: hsl(var(--purple)) !important;
    color: white !important;
}

.text-purple {
    color: hsl(var(--purple)) !important;
}

.border-purple {
    border-color: hsl(var(--purple)) !important;
}

.btn-purple {
    background-color: hsl(var(--purple));
    border-color: hsl(var(--purple));
    color: white;
}

.btn-purple:hover {
    background-color: hsl(259 94% 46%);
    border-color: hsl(259 94% 46%);
    color: white;
}

/* Footer */
.footer {
    background-color: hsl(var(--surface));
    border-top: 1px solid hsl(var(--border));
    margin-top: auto;
}

/* Loading States */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.table-loading {
    position: relative;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        border-radius: 0.5rem;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0.25rem;
    }
}

/* Custom Components */
.stat-card {
    background: linear-gradient(135deg, hsl(var(--surface)) 0%, hsl(var(--light)) 100%);
    border: 1px solid hsl(var(--border));
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: hsl(var(--primary));
    margin-bottom: 0.5rem;
}

.stat-label {
    color: hsl(var(--text-muted));
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: hsl(var(--text-muted));
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h5 {
    margin-bottom: 0.5rem;
    color: hsl(var(--text));
}

/* Progress Bars */
.progress {
    height: 0.5rem;
    border-radius: 0.25rem;
    background-color: hsl(var(--light));
}

.progress-bar {
    border-radius: 0.25rem;
}

/* Status Indicators */
.status-online {
    color: hsl(var(--success));
}

.status-offline {
    color: hsl(var(--text-muted));
}

.status-pending {
    color: hsl(var(--warning));
}

.status-error {
    color: hsl(var(--danger));
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .modal {
        display: none !important;
    }
    
    .main-content {
        padding-top: 0;
    }
    
    .card {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    .table {
        border-collapse: collapse;
    }
    
    .table th,
    .table td {
        border: 1px solid #000;
    }
}

/* Dark mode support (for future implementation) */
@media (prefers-color-scheme: dark) {
    :root {
        --background: 220 26% 14%;
        --surface: 220 26% 18%;
        --text: 210 11% 98%;
        --text-muted: 210 11% 71%;
        --border: 220 26% 22%;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus-visible:focus {
    outline: 2px solid hsl(var(--primary));
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border-width: 2px;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .form-control {
        border-width: 2px;
    }
}
