/* Control Manager Theme CSS */
/* Dark Mode First Design with Light Mode Support */

:root {
    /* Dark Theme (Default) */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --bg-hover: #475569;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #475569;

    /* Status Colors */
    --status-success: #22c55e;
    --status-success-rgb: 34, 197, 94;
    --status-warning: #f59e0b;
    --status-warning-rgb: 245, 158, 11;
    --status-danger: #ef4444;
    --status-danger-rgb: 239, 68, 68;
    --status-info: #3b82f6;
    --status-info-rgb: 59, 130, 246;

    /* Accent */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-secondary);
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 40;
    transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar-collapsed {
    width: 72px;
}

.sidebar-collapsed .nav-text,
.sidebar-collapsed .sidebar-header h1,
.sidebar-collapsed .sidebar-footer-text {
    display: none;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header .logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sidebar-header h1 {
    font-size: 1.125rem;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.sidebar-collapsed .nav-section-title {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    cursor: pointer;
    gap: 0.75rem;
    position: relative;
}

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

.nav-item.active {
    background-color: var(--accent-primary);
    color: white;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: white;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
}

.nav-badge {
    margin-left: auto;
    background-color: var(--status-danger);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--status-info), var(--accent-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.sidebar-collapsed + .main-content {
    margin-left: 72px;
}

/* Header */
.main-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

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

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--text-primary);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    position: relative;
    transition: all 0.2s;
}

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

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background-color: var(--status-danger);
    border-radius: 50%;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

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

/* Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

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

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

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

/* Server Cards */
.server-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s;
    cursor: pointer;
}

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

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

.server-name {
    font-size: 1.125rem;
    font-weight: 700;
}

.server-ip {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background-color: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.badge-success {
    background-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.badge-secondary {
    background-color: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
}

.badge-sm {
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
}

.badge-lg {
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
}

/* Progress Bars */
.progress-bar {
    height: 6px;
    background-color: var(--bg-secondary);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s;
}

.progress-success { background-color: var(--status-success); }
.progress-warning { background-color: var(--status-warning); }
.progress-danger { background-color: var(--status-danger); }
.progress-info { background-color: var(--status-info); }

/* Gauge/Metric Cards */
.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Gauge */
.gauge {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.gauge svg {
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: var(--bg-secondary);
    stroke-width: 8;
}

.gauge-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.125rem;
    font-weight: 700;
}

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

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

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background-color: var(--bg-secondary);
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

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

/* Buttons - Standardized & Enhanced */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Primary Button - Main actions */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

/* Success Button - Positive actions */
.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

/* Warning Button - Caution actions */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #1f2937;
    border-color: transparent;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

/* Danger Button - Destructive actions */
.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

/* Secondary Button - Secondary actions */
.btn-secondary {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--border-color);
    border-color: var(--text-muted);
}

/* Ghost Button - Minimal emphasis */
.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Outline Variants */
.btn-outline-primary {
    background-color: transparent;
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

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

.btn-outline-success {
    background-color: transparent;
    color: var(--status-success);
    border-color: var(--status-success);
}

.btn-outline-success:hover:not(:disabled) {
    background-color: var(--status-success);
    color: white;
}

.btn-outline-warning {
    background-color: transparent;
    color: var(--status-warning);
    border-color: var(--status-warning);
}

.btn-outline-warning:hover:not(:disabled) {
    background-color: var(--status-warning);
    color: #1f2937;
}

.btn-outline-danger {
    background-color: transparent;
    color: var(--status-danger);
    border-color: var(--status-danger);
}

.btn-outline-danger:hover:not(:disabled) {
    background-color: var(--status-danger);
    color: white;
}

.btn-outline-secondary {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover:not(:disabled) {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* Size Variants */
.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    border-radius: 0.375rem;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: 0.375rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    border-radius: 0.625rem;
}

.btn-xl {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    border-radius: 0.75rem;
}

/* Icon Button */
.btn-icon {
    padding: 0.5rem;
    width: 40px;
    height: 40px;
}

.btn-icon.btn-sm {
    padding: 0.375rem;
    width: 32px;
    height: 32px;
}

.btn-icon.btn-xs {
    padding: 0.25rem;
    width: 26px;
    height: 26px;
}

/* Full Width Button */
.btn-block {
    width: 100%;
}

/* Button Group */
.btn-group {
    display: inline-flex;
    border-radius: 0.5rem;
    overflow: hidden;
}

.btn-group .btn {
    border-radius: 0;
    border-right-width: 1px;
}

.btn-group .btn:first-child {
    border-radius: 0.5rem 0 0 0.5rem;
}

.btn-group .btn:last-child {
    border-radius: 0 0.5rem 0.5rem 0;
    border-right-width: 2px;
}

.btn-group .btn:only-child {
    border-radius: 0.5rem;
}

/* Active State for Toggle Buttons */
.btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Loading State */
.btn-loading {
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Focus States for Accessibility */
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.btn-success:focus {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

.btn-warning:focus {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.btn-danger:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

/* Alerts/Toast */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-left: 4px solid var(--status-success);
}

.toast-warning {
    border-left: 4px solid var(--status-warning);
}

.toast-danger {
    border-left: 4px solid var(--status-danger);
}

.toast-info {
    border-left: 4px solid var(--status-info);
}

/* Log Viewer */
.log-viewer {
    background-color: #0d1117;
    color: #c9d1d9;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    padding: 1rem;
    border-radius: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

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

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

.modal-body {
    padding: 1.25rem;
}

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

/* Grid Helpers */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

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

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

/* Flex Helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

/* Spacing Helpers */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

/* Text Helpers */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--status-success); }
.text-warning { color: var(--status-warning); }
.text-danger { color: var(--status-danger); }
.text-info { color: var(--status-info); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

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

.status-dot-success { background-color: var(--status-success); }
.status-dot-warning { background-color: var(--status-warning); }
.status-dot-danger { background-color: var(--status-danger); }
.status-dot-info { background-color: var(--status-info); }

.status-dot-pulse {
    animation: pulse 2s infinite;
}

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

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--bg-hover);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Spin class for icons */
.spin {
    animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-collapsed + .main-content {
        margin-left: 0;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

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

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    display: none;
}

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

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

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Action Group */
.action-group {
    display: flex;
    gap: 0.375rem;
}

/* Custom Tooltips */
.has-tooltip {
    position: relative;
    cursor: help;
}

.has-tooltip::before,
.has-tooltip::after {
    position: absolute;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.has-tooltip::before {
    content: attr(data-tooltip);
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    max-width: 300px;
}

.has-tooltip::after {
    content: '';
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-color);
}

.has-tooltip:hover::before,
.has-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

.has-tooltip:hover::before {
    bottom: calc(100% + 10px);
}

.has-tooltip:hover::after {
    bottom: calc(100% + 4px);
}

/* MSSQL Server Card */
.mssql-server-card {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.mssql-server-card:hover {
    border-color: var(--accent-primary);
}

/* Metric Mini (for compact displays) */
.metric-mini {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 0.25rem;
}

/* View toggle buttons active state */
.mssql-view-btn.active,
.container-view-btn.active,
.system-view-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Traffic Light Indicator */
.traffic-light {
    width: 50px;
    height: 50px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.3);
    border: 3px solid #2a2a3e;
}

.traffic-bulb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.traffic-bulb.bulb-green {
    background: #1a3a1a;
    box-shadow: none;
}

.traffic-bulb.bulb-green.active {
    background: radial-gradient(circle at 30% 30%, #90EE90, #22c55e, #15803d);
    box-shadow: 0 0 20px #22c55e, 0 0 40px rgba(34, 197, 94, 0.5);
    animation: pulse-green 2s infinite;
}

.traffic-bulb.bulb-yellow {
    background: #3a3a1a;
    box-shadow: none;
}

.traffic-bulb.bulb-yellow.active {
    background: radial-gradient(circle at 30% 30%, #FFF176, #eab308, #a16207);
    box-shadow: 0 0 20px #eab308, 0 0 40px rgba(234, 179, 8, 0.5);
    animation: pulse-yellow 1.5s infinite;
}

.traffic-bulb.bulb-red {
    background: #3a1a1a;
    box-shadow: none;
}

.traffic-bulb.bulb-red.active {
    background: radial-gradient(circle at 30% 30%, #FFA07A, #ef4444, #b91c1c);
    box-shadow: 0 0 20px #ef4444, 0 0 40px rgba(239, 68, 68, 0.5);
    animation: pulse-red 1s infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 20px #22c55e, 0 0 40px rgba(34, 197, 94, 0.5); }
    50% { box-shadow: 0 0 25px #22c55e, 0 0 50px rgba(34, 197, 94, 0.6); }
}

@keyframes pulse-yellow {
    0%, 100% { box-shadow: 0 0 20px #eab308, 0 0 40px rgba(234, 179, 8, 0.5); }
    50% { box-shadow: 0 0 25px #eab308, 0 0 50px rgba(234, 179, 8, 0.6); }
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 20px #ef4444, 0 0 40px rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 30px #ef4444, 0 0 60px rgba(239, 68, 68, 0.7); }
}

/* Icon Box */
.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-box-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--status-success);
}

.icon-box-warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--status-warning);
}

.icon-box-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--status-danger);
}

.icon-box-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--status-info);
}

/* Application Cards */
.app-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.app-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.app-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.app-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-info {
    flex: 1;
}

.app-name {
    font-weight: 600;
    font-size: 1rem;
}

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

.app-card-body {
    padding: 1rem;
}

.app-servers {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.app-server {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.app-server-status {
    margin-left: auto;
    font-weight: 500;
    font-size: 0.75rem;
}

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

/* Server App Summary */
.server-app-summary {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.badge-sm {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
}

/* MSSQL Accent Bar */
.accent-bar {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
}

.accent-bar .bar-title {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
}

.accent-bar .bar-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.accent-bar .bar-badge {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 9999px;
}

.accent-bar .bar-badge-lg {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.accent-bar .bar-icon {
    width: 28px;
    height: 28px;
    color: white;
}

.accent-bar .bar-btn {
    background: white;
    color: var(--accent-primary);
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.accent-bar .bar-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Alert List Styles */
.alert-list {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.alert-list::-webkit-scrollbar {
    width: 4px;
}

.alert-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    border-left: 3px solid var(--border-color);
}

.alert-item.alert-critical {
    border-left-color: var(--status-danger);
    background: rgba(239, 68, 68, 0.1);
}

.alert-item.alert-warning {
    border-left-color: var(--status-warning);
    background: rgba(245, 158, 11, 0.1);
}

.alert-item .alert-server {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 40px;
}

.alert-item .alert-message {
    color: var(--text-secondary);
    flex: 1;
}

.alert-item .alert-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* DC3 Health Status */
.dc3-health-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.dc3-health-status.healthy {
    border-left: 3px solid var(--status-success);
}

.dc3-health-status.warning {
    border-left: 3px solid var(--status-warning);
}

.dc3-health-status.critical {
    border-left: 3px solid var(--status-danger);
}

.dc3-health-status .health-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.dc3-health-status.healthy .health-icon {
    background: rgba(34, 197, 94, 0.2);
    color: var(--status-success);
}

.dc3-health-status.warning .health-icon {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-warning);
}

.dc3-health-status.critical .health-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--status-danger);
}

.dc3-metrics {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.dc3-metric {
    display: flex;
    flex-direction: column;
}

.dc3-metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dc3-metric-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* =============================================================================
   AUTH PAGES (Login, MFA) - Shared Styles
   ============================================================================= */

/* Auth page body */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

/* Animated background pattern */
.auth-bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image:
        radial-gradient(circle at 25% 25%, var(--accent-primary) 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, var(--accent-secondary) 2px, transparent 2px);
    background-size: 60px 60px;
    animation: authBgMove 20s linear infinite;
}

@keyframes authBgMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

/* Glow effects */
.auth-glow-1 {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    animation: authFloat1 15s ease-in-out infinite;
}

.auth-glow-2 {
    position: fixed;
    bottom: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    animation: authFloat2 18s ease-in-out infinite;
}

@keyframes authFloat1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(50px, 50px); }
}

@keyframes authFloat2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-50px, -30px); }
}

/* Auth container */
.auth-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

/* Auth card */
.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

/* Auth logo */
.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.auth-logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.auth-logo-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* =============================================================================
   ALERT/DANGER BOXES - Reusable
   ============================================================================= */

.alert-box {
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 1rem;
}

.alert-box-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--status-danger);
}

.alert-box-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--status-warning);
}

.alert-box-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--status-success);
}

.alert-box-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--status-info);
}

/* =============================================================================
   ICON SIZE UTILITIES
   ============================================================================= */

.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 16px; height: 16px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }
.icon-2xl { width: 32px; height: 32px; }

/* ========================================
   SKELETON LOADING
   ======================================== */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg,
        var(--bg-tertiary) 25%,
        var(--bg-hover) 50%,
        var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 0.875rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.long { width: 90%; }

.skeleton-title {
    height: 1.25rem;
    width: 50%;
    margin-bottom: 0.75rem;
    border-radius: 4px;
}

.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
}

.skeleton-badge {
    display: inline-block;
    height: 1.25rem;
    width: 4rem;
    border-radius: 10px;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-table-row {
    display: grid;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

/* Grid skeletons */
.skeleton-grid {
    display: grid;
    gap: 1rem;
}

.skeleton-grid-2 { grid-template-columns: repeat(2, 1fr); }
.skeleton-grid-3 { grid-template-columns: repeat(3, 1fr); }
.skeleton-grid-4 { grid-template-columns: repeat(4, 1fr); }

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

/* Skeleton metric card */
.skeleton-metric {
    text-align: center;
    padding: 1.25rem;
}

.skeleton-metric .skeleton-value {
    height: 2rem;
    width: 4rem;
    margin: 0 auto 0.5rem;
    border-radius: 4px;
}

.skeleton-metric .skeleton-label {
    height: 0.75rem;
    width: 6rem;
    margin: 0 auto;
    border-radius: 4px;
}

/* ========================================
   ENHANCED EMPTY STATES
   ======================================== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    background: var(--bg-tertiary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon i,
.empty-state-icon svg {
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    opacity: 0.6;
}

.empty-state h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 360px;
    margin: 0 auto 1.25rem;
    line-height: 1.5;
}

.empty-state .btn {
    margin-top: 0.5rem;
}

/* Compact empty state for small containers */
.empty-state-compact {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-muted);
}

.empty-state-compact i {
    width: 24px;
    height: 24px;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

.empty-state-compact p {
    font-size: 0.8rem;
    margin: 0;
}
