/* ===========================================
   shadcn/ui-inspired Bootstrap Theme
   =========================================== */

/* CSS Custom Properties (Design Tokens) */
:root {
    /* Colors - shadcn/ui inspired neutral palette */
    --background: hsl(0, 0%, 100%);
    --foreground: hsl(240, 10%, 3.9%);
    --card: hsl(0, 0%, 100%);
    --card-foreground: hsl(240, 10%, 3.9%);
    --popover: hsl(0, 0%, 100%);
    --popover-foreground: hsl(240, 10%, 3.9%);
    --primary: hsl(240, 5.9%, 10%);
    --primary-foreground: hsl(0, 0%, 98%);
    --secondary: hsl(240, 4.8%, 95.9%);
    --secondary-foreground: hsl(240, 5.9%, 10%);
    --muted: hsl(240, 4.8%, 95.9%);
    --muted-foreground: hsl(240, 3.8%, 40%);
    --accent: hsl(240, 4.8%, 95.9%);
    --accent-foreground: hsl(240, 5.9%, 10%);
    --destructive: hsl(0, 84.2%, 60.2%);
    --destructive-foreground: hsl(0, 0%, 98%);
    --border: hsl(240, 5.9%, 90%);
    --input: hsl(240, 5.9%, 90%);
    --ring: hsl(240, 5.9%, 10%);

    /* Semantic colors */
    --success: hsl(142, 76%, 36%);
    --success-foreground: hsl(0, 0%, 100%);
    --warning: hsl(38, 92%, 50%);
    --warning-foreground: hsl(0, 0%, 0%);
    --info: hsl(199, 89%, 48%);
    --info-foreground: hsl(0, 0%, 100%);

    /* Radius */
    --radius: 0.5rem;
    --radius-sm: 0.375rem;
    --radius-lg: 0.75rem;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* Base Styles */
body {
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    background-color: var(--muted);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Override Bootstrap's small class for better readability */
.small, small {
    font-size: 0.9rem !important;
}

/* ===========================================
   Card Styles - Clean, minimal borders
   =========================================== */
.card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: none;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

.card-title {
    font-size: 1.1875rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.025em;
}

.card-body {
    padding: 1.25rem;
}

/* Remove Bootstrap's shadow utilities in favor of clean borders */
.shadow-sm, .shadow {
    box-shadow: none !important;
    border: 1px solid var(--border);
}

/* ===========================================
   Button Styles - shadcn/ui inspired
   =========================================== */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5rem;
    transition: all 150ms ease;
    border: 1px solid transparent;
}

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

.btn-lg {
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
}

/* Primary button - Dark */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover {
    background-color: hsl(240, 5.9%, 20%);
    border-color: hsl(240, 5.9%, 20%);
}

.btn-primary:focus {
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

/* Secondary button - Light background */
.btn-secondary, .btn-outline-secondary {
    background-color: var(--secondary);
    border-color: var(--border);
    color: var(--secondary-foreground);
}

.btn-secondary:hover, .btn-outline-secondary:hover {
    background-color: hsl(240, 4.8%, 90%);
    border-color: var(--border);
    color: var(--secondary-foreground);
}

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

.btn-outline-primary:hover {
    background-color: var(--accent);
    border-color: var(--border);
    color: var(--accent-foreground);
}

/* Destructive button */
.btn-danger, .btn-outline-danger {
    background-color: var(--destructive);
    border-color: var(--destructive);
    color: var(--destructive-foreground);
}

.btn-danger:hover {
    background-color: hsl(0, 84.2%, 50%);
}

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

.btn-outline-danger:hover {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
}

/* Success button */
.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: var(--success-foreground);
}

.btn-success:hover {
    background-color: hsl(142, 76%, 30%);
}

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

.btn-outline-success:hover {
    background-color: var(--success);
    color: var(--success-foreground);
}

/* Ghost button (no border) */
.btn-ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--foreground);
}

.btn-ghost:hover {
    background-color: var(--accent);
    color: var(--accent-foreground);
}

/* Link button */
.btn-link {
    color: var(--foreground);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.btn-link:hover {
    color: var(--muted-foreground);
}

/* ===========================================
   Form Controls - Clean inputs
   =========================================== */
.form-control, .form-select {
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5rem;
    background-color: var(--background);
    color: var(--foreground);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px hsl(240, 5.9%, 10%, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--muted-foreground);
}

.form-control-sm, .form-select-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.9375rem;
}

.form-label {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--foreground);
}

.form-text {
    font-size: 0.9375rem;
    color: var(--muted-foreground);
}

/* Input groups */
.input-group-text {
    background-color: var(--muted);
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* ===========================================
   Status Badges - Subtle, consistent
   =========================================== */
.badge {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    line-height: 1;
}

.status-badge {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* Status dot indicator */
.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-active, .status-connected {
    background-color: hsl(142, 76%, 94%);
    color: hsl(142, 76%, 26%);
}
.status-active::before, .status-connected::before {
    background-color: hsl(142, 76%, 36%);
}

.status-completed {
    background-color: hsl(142, 76%, 94%);
    color: hsl(142, 76%, 26%);
}
.status-completed::before {
    background-color: hsl(142, 76%, 36%);
}

.status-failed, .status-disconnected {
    background-color: hsl(0, 84%, 95%);
    color: hsl(0, 84%, 40%);
}
.status-failed::before, .status-disconnected::before {
    background-color: hsl(0, 84%, 60%);
}

.status-pending, .status-starting {
    background-color: hsl(38, 92%, 94%);
    color: hsl(38, 92%, 30%);
}
.status-pending::before, .status-starting::before {
    background-color: hsl(38, 92%, 50%);
}

.status-provisioning {
    background-color: hsl(25, 95%, 94%);
    color: hsl(25, 95%, 35%);
}
.status-provisioning::before {
    background-color: hsl(25, 95%, 53%);
}

.status-browser_launched, .status-unknown {
    background-color: var(--muted);
    color: var(--muted-foreground);
}
.status-browser_launched::before, .status-unknown::before {
    background-color: var(--muted-foreground);
}

.status-logging_in {
    background-color: hsl(199, 89%, 94%);
    color: hsl(199, 89%, 32%);
}
.status-logging_in::before {
    background-color: hsl(199, 89%, 48%);
}

.provisioning-note {
    color: hsl(25, 95%, 45%);
    font-size: 0.8125rem;
    font-style: normal;
}

/* ===========================================
   Alerts - Clean, subtle
   =========================================== */
.alert {
    border-radius: var(--radius);
    border: 1px solid;
    padding: 1rem;
    font-size: 0.9375rem;
}

.alert-info {
    background-color: hsl(199, 89%, 96%);
    border-color: hsl(199, 89%, 85%);
    color: hsl(199, 89%, 28%);
}

.alert-warning {
    background-color: hsl(38, 92%, 96%);
    border-color: hsl(38, 92%, 80%);
    color: hsl(38, 92%, 25%);
}

.alert-danger {
    background-color: hsl(0, 84%, 96%);
    border-color: hsl(0, 84%, 85%);
    color: hsl(0, 84%, 35%);
}

.alert-success {
    background-color: hsl(142, 76%, 96%);
    border-color: hsl(142, 76%, 80%);
    color: hsl(142, 76%, 25%);
}

/* ===========================================
   Tables - Clean, minimal
   =========================================== */
.table {
    font-size: 0.9375rem;
    border-color: var(--border);
}

.table thead th {
    font-weight: 500;
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    background-color: var(--muted);
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

/* ===========================================
   Modals - Clean, centered
   =========================================== */
.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

/* ===========================================
   Navigation - Clean header
   =========================================== */
.navbar {
    background-color: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.025em;
}

.nav-link {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 150ms ease;
}

.nav-link:hover {
    color: var(--foreground);
    background-color: var(--accent);
}

.nav-link.active {
    color: var(--foreground);
}

/* ===========================================
   Dropdowns - Clean, minimal
   =========================================== */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    padding: 0.25rem;
}

.dropdown-item {
    font-size: 0.9375rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--foreground);
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: var(--accent);
    color: var(--accent-foreground);
}

/* ===========================================
   Metric Cards - Dashboard stats
   =========================================== */
.metric-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    letter-spacing: -0.025em;
    line-height: 1;
}

.metric-label {
    font-size: 0.9rem;
    color: var(--muted-foreground);
    font-weight: 500;
    margin-top: 0.25rem;
}

/* ===========================================
   Progress Bars - Subtle
   =========================================== */
.progress {
    height: 0.5rem;
    background-color: var(--muted);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 9999px;
}

.progress-bar.bg-success { background-color: var(--success) !important; }
.progress-bar.bg-info { background-color: var(--info) !important; }
.progress-bar.bg-warning { background-color: var(--warning) !important; }
.progress-bar.bg-danger { background-color: var(--destructive) !important; }

/* ===========================================
   Lists - Clean spacing
   =========================================== */
.list-group {
    border-radius: var(--radius);
}

.list-group-item {
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    background-color: var(--card);
}

.list-group-item:first-child {
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.list-group-item:last-child {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.list-group-item + .list-group-item {
    border-top: none;
}

/* ===========================================
   Scrollable Containers
   =========================================== */
.event-list {
    max-height: 300px;
    overflow-y: auto;
}

.log-container {
    height: 400px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    background-color: var(--muted);
    border-radius: var(--radius);
    padding: 1rem;
}

.node-list {
    max-height: 200px;
    overflow-y: auto;
}

/* ===========================================
   Toast Notifications
   =========================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
}

.toast {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    animation: slideIn 200ms ease-out;
}

.toast.hiding {
    animation: slideOut 200ms ease-in forwards;
}

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

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

/* ===========================================
   Utility Classes
   =========================================== */
.text-muted {
    color: var(--muted-foreground) !important;
}

.bg-muted {
    background-color: var(--muted) !important;
}

.border {
    border-color: var(--border) !important;
}

.rounded {
    border-radius: var(--radius) !important;
}

.rounded-lg {
    border-radius: var(--radius-lg) !important;
}

/* Divider */
.divider {
    height: 1px;
    background-color: var(--border);
    margin: 1rem 0;
}

/* Section headers */
.section-header {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.section-description {
    font-size: 0.9rem;
    color: var(--muted-foreground);
    margin-bottom: 1rem;
}

/* ===========================================
   Form Switches - Toggle styles
   =========================================== */
.form-check-input {
    width: 2.25rem;
    height: 1.25rem;
    border: 1px solid var(--input);
    border-radius: 9999px;
    background-color: var(--muted);
    transition: all 150ms ease;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px hsl(240, 5.9%, 10%, 0.1);
}

.form-switch .form-check-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* ===========================================
   Responsive Adjustments
   =========================================== */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.5rem 0.875rem;
    }
}

/* ===========================================
   Spinner - Loading states
   =========================================== */
.spinner-border {
    color: var(--muted-foreground);
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

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

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

.empty-state-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    font-size: 0.9375rem;
}

/* ===========================================
   News Banner - Feature announcements
   =========================================== */
.news-banner {
    background: linear-gradient(135deg, hsl(199, 89%, 96%) 0%, hsl(199, 89%, 92%) 100%);
    border: 1px solid hsl(199, 89%, 80%);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.news-banner-icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    background-color: #ff0000;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.news-banner-content {
    flex-grow: 1;
}

.news-banner-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: hsl(199, 89%, 25%);
    margin-bottom: 0.125rem;
}

.news-banner-description {
    font-size: 0.875rem;
    color: hsl(199, 89%, 35%);
}

.news-banner-link {
    color: hsl(199, 89%, 30%);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.news-banner-link:hover {
    color: hsl(199, 89%, 20%);
}

.news-banner-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: hsl(199, 89%, 40%);
    padding: 0.25rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 150ms ease;
}

.news-banner-close:hover {
    background-color: hsl(199, 89%, 85%);
    color: hsl(199, 89%, 25%);
}
