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

:root {
    --bg-base: hsl(224, 71%, 4%);
    --bg-surface: hsla(222, 47%, 9%, 0.65);
    --bg-surface-opaque: hsl(222, 47%, 9%);
    --border-color: hsla(222, 47%, 20%, 0.5);
    --border-hover: hsla(180, 100%, 50%, 0.4);
    
    --text-primary: hsl(210, 40%, 98%);
    --text-secondary: hsl(215, 20%, 75%);
    --text-muted: hsl(215, 12%, 55%);
    
    /* Neon themed state colors */
    --color-primary: hsl(180, 100%, 50%); /* Neon Cyan */
    --color-primary-rgb: 0, 255, 255;
    --color-secondary: hsl(270, 95%, 68%); /* Purple */
    --color-accent: hsl(315, 95%, 60%); /* Pink */
    
    --state-success: hsl(145, 85%, 50%); /* Neon Green */
    --state-warning: hsl(38, 95%, 55%); /* Amber */
    --state-danger: hsl(355, 90%, 60%); /* Coral Red */
    --state-info: hsl(200, 95%, 55%); /* Ice Blue */
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.7);
    --shadow-neon: 0 0 15px rgba(var(--color-primary-rgb), 0.25);
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --border-radius: 12px;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 0% 0%, hsla(270, 95%, 15%, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(180, 100%, 10%, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: hsl(222, 47%, 18%);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: hsl(222, 47%, 25%);
}

/* ─── Layouts & Typography ────────────────────────────────────────────────── */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}
a:hover {
    text-shadow: var(--shadow-neon);
    opacity: 0.9;
}

h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.5px;
}

/* ─── Glassmorphism Cards ─────────────────────────────────────────────────── */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}
.glass-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md), var(--shadow-neon);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-weight: 550;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), hsl(195, 100%, 45%));
    color: hsl(224, 71%, 4%);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgba(0, 255, 255, 0.4);
    filter: brightness(1.1);
}
.btn-secondary {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: hsla(222, 47%, 20%, 0.3);
    border-color: var(--text-secondary);
}
.btn-danger {
    background: hsla(355, 90%, 60%, 0.15);
    border-color: hsla(355, 90%, 60%, 0.4);
    color: var(--state-danger);
}
.btn-danger:hover {
    background: var(--state-danger);
    color: white;
    box-shadow: 0 0 15px rgba(255, 75, 75, 0.3);
}
.btn-warning {
    background: hsla(38, 95%, 55%, 0.15);
    border-color: hsla(38, 95%, 55%, 0.4);
    color: var(--state-warning);
}
.btn-warning:hover {
    background: var(--state-warning);
    color: var(--bg-base);
    box-shadow: 0 0 15px rgba(255, 175, 0, 0.3);
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Inputs ─────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}
.input-control {
    width: 100%;
    padding: 12px 16px;
    background: hsla(222, 47%, 5%, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}
.input-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-neon);
}
.select-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    padding-right: 40px;
}

/* ─── Header Navigation ───────────────────────────────────────────────────── */
header {
    background: hsla(224, 71%, 3%, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-logo {
    width: 128px;
    height: 128px;
    object-fit: contain;
}
.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}
.nav-item {
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.nav-item:hover, .nav-item.active {
    color: var(--color-primary);
    background: hsla(180, 100%, 50%, 0.08);
}
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: hsla(222, 47%, 20%, 0.4);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}
.user-badge-role {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: var(--color-secondary);
    color: var(--bg-base);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer {
    margin-top: auto;
    padding: 24px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* ─── Notifications / Banners ────────────────────────────────────────────── */
.banner {
    padding: 12px 24px;
    text-align: center;
    font-weight: 550;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.banner-warning {
    background: hsla(38, 95%, 55%, 0.15);
    border-bottom: 1px solid var(--state-warning);
    color: var(--state-warning);
}
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 8px;
    background: var(--bg-surface-opaque);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}
.toast.success { border-color: var(--state-success); color: var(--state-success); }
.toast.error { border-color: var(--state-danger); color: var(--state-danger); }
.toast.warning { border-color: var(--state-warning); color: var(--state-warning); }

/* ─── Micro-animations ───────────────────────────────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    animation: spin 1s linear infinite;
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
}
.fade-in {
    animation: fadeIn 0.4s ease forwards;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Modal Dialogs ──────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 8, 15, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: var(--bg-surface-opaque);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 30px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-md), var(--shadow-neon);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}
.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text-primary);
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ─── Service Grouping Collapsible Styles ─────────────────────────────────── */
.service-row {
    cursor: pointer;
}
.service-row td {
    border-bottom: 2px solid hsla(222, 47%, 20%, 0.7) !important;
}
.service-row:hover {
    background-color: hsla(180, 100%, 50%, 0.04) !important;
}
.instance-row {
    background-color: hsla(222, 47%, 5%, 0.4);
    display: none;
}
.instance-row.active {
    display: table-row;
}
.instance-row td {
    font-size: 0.88rem !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    color: var(--text-secondary);
}
.instance-name-cell {
    padding-left: 36px !important;
    position: relative;
}
.instance-name-cell::before {
    content: "└─";
    position: absolute;
    left: 16px;
    color: var(--text-muted);
}
.expand-toggle-icon {
    display: inline-block;
    margin-right: 8px;
    color: var(--color-primary);
    font-size: 0.75rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg);
}
.expand-toggle-icon.expanded {
    transform: rotate(90deg);
}

