/* =============================================
   VTBAGLA – Premium Design System
   Palette: Deep Navy + Electric Indigo + Amber
   ============================================= */

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

/* ── Reset & Root ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --navy-950: #05080f;
    --navy-900: #0b1120;
    --navy-800: #111827;
    --navy-700: #1c2739;
    --navy-600: #273348;

    --indigo: #6366f1;
    --indigo-d: #4f46e5;
    --indigo-l: #818cf8;
    --indigo-xl: #e0e7ff;

    --amber: #f59e0b;
    --amber-l: #fcd34d;

    --emerald: #10b981;
    --rose: #ef4444;
    --rose-l: #fca5a5;

    --text-1: #f1f5f9;
    --text-2: #94a3b8;
    --text-3: #64748b;

    --border: rgba(255, 255, 255, 0.07);
    --border-h: rgba(255, 255, 255, 0.14);

    --glass: rgba(17, 24, 39, 0.75);
    --glass-b: rgba(99, 102, 241, 0.12);

    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;

    --s-glow: 0 0 20px rgba(99, 102, 241, 0.35);
    --s-card: 0 4px 24px rgba(0, 0, 0, 0.45);
    --s-btn: 0 4px 14px rgba(99, 102, 241, 0.5);

    --sidebar-w: 270px;
    --transition: 0.22s cubic-bezier(.4, 0, .2, 1);
}

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--navy-950);
    color: var(--text-1);
    font-size: 15px;
    line-height: 1.6;
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, .4);
    border-radius: 99px;
}

/* ── Glow background blobs ── */
.glow-blob {
    position: fixed;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .22;
    z-index: 0;
}

.glow-blob-1 {
    width: 600px;
    height: 600px;
    background: var(--indigo);
    top: -200px;
    left: -100px;
}

.glow-blob-2 {
    width: 400px;
    height: 400px;
    background: var(--amber);
    bottom: -150px;
    right: -100px;
}

/* ── AUTH ── */
.auth-root {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 60% 20%, rgba(99, 102, 241, .18) 0%, transparent 65%),
        radial-gradient(ellipse at 10% 90%, rgba(245, 158, 11, .12) 0%, transparent 55%),
        var(--navy-950);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--navy-800);
    border: 1px solid var(--border-h);
    border-radius: var(--r-xl);
    padding: 3rem 2.75rem;
    box-shadow: var(--s-card);
    position: relative;
    z-index: 1;
    animation: floatIn .55s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(28px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 2.25rem;
}

.auth-brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--indigo), var(--indigo-d));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: var(--s-btn);
}

.auth-brand-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    color: var(--text-1);
    letter-spacing: -.5px;
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: .4rem;
}

.auth-sub {
    color: var(--text-2);
    font-size: .95rem;
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    font-size: .83rem;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: .55rem;
}

.form-group input {
    width: 100%;
    padding: .8rem 1.1rem;
    background: var(--navy-700);
    border: 1.5px solid var(--border-h);
    border-radius: var(--r-sm);
    color: var(--text-1);
    font-size: .98rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

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

.form-group input:focus {
    border-color: var(--indigo-l);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .18);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    padding: .9rem 1.5rem;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--indigo), var(--indigo-d));
    color: #fff;
    font-size: 1rem;
    box-shadow: var(--s-btn);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(99, 102, 241, .65);
}

.btn-primary:active {
    transform: translateY(0);
}

.error-alert {
    background: rgba(239, 68, 68, .12);
    border: 1px solid rgba(239, 68, 68, .28);
    border-radius: var(--r-sm);
    padding: .8rem 1rem;
    color: #fca5a5;
    font-size: .9rem;
    margin-bottom: 1.35rem;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── DASHBOARD SHELL ── */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--navy-900);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.75rem 1.25rem;
    position: relative;
    z-index: 20;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: .5rem .6rem 2rem;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--indigo), var(--indigo-d));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: var(--s-btn);
}

.sidebar-brand-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    color: var(--text-1);
    letter-spacing: -.3px;
}

.nav-section-label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-3);
    padding: .25rem .8rem .75rem;
    margin-top: .5rem;
}

.nav-item {
    margin-bottom: 3px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: .72rem .9rem;
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-weight: 500;
    font-size: .95rem;
    text-decoration: none;
    transition: all var(--transition);
}

.nav-link .nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    font-size: .95rem;
    transition: all var(--transition);
}

.nav-link:hover {
    color: var(--text-1);
    background: rgba(255, 255, 255, .04);
}

.nav-link:hover .nav-icon {
    background: rgba(99, 102, 241, .15);
    color: var(--indigo-l);
}

.nav-link.active {
    color: var(--text-1);
    background: rgba(99, 102, 241, .13);
}

.nav-link.active .nav-icon {
    background: var(--indigo);
    color: #fff;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: .65rem .8rem;
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, .04);
}

.sidebar-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--indigo), var(--indigo-d));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-username {
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-1);
}

.sidebar-role {
    font-size: .77rem;
    color: var(--text-3);
}

.sidebar-logout {
    margin-top: .75rem;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: .65rem;
    border-radius: var(--r-sm);
    background: rgba(239, 68, 68, .09);
    border: 1px solid rgba(239, 68, 68, .16);
    color: #fca5a5;
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    transition: all var(--transition);
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, .18);
    color: #fff;
}

/* ── MAIN AREA ── */
.main-area {
    flex: 1;
    overflow-y: auto;
    background: radial-gradient(ellipse at 80% 0%, rgba(99, 102, 241, .07) 0%, transparent 60%),
        var(--navy-950);
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2.5rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(5, 8, 15, .7);
    backdrop-filter: blur(14px);
}

.topbar-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-1);
}

.topbar-sub {
    color: var(--text-3);
    font-size: .85rem;
    margin-top: 1px;
}

.page-body {
    padding: 2rem 2.5rem;
    flex: 1;
}

/* ── CARDS ── */
.card {
    background: var(--navy-800);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
    border-color: var(--border-h);
    box-shadow: 0 0 0 1px var(--border-h);
}

.card-header {
    padding: 1.35rem 1.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(99, 102, 241, .17);
    color: var(--indigo-l);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-1);
}

.card-body {
    padding: 1.75rem;
}

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

/* ── STAT CHIPS ── */
.stat-chips {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.stat-chip {
    flex: 1;
    min-width: 160px;
    background: var(--navy-800);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    transition: all var(--transition);
}

.stat-chip:hover {
    border-color: var(--border-h);
    transform: translateY(-2px);
}

.stat-chip-val {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-1);
    font-family: 'Space Grotesk', sans-serif;
}

.stat-chip-label {
    font-size: .82rem;
    color: var(--text-3);
    font-weight: 500;
}

.stat-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--indigo);
    display: inline-block;
    margin-right: 5px;
}

/* ── FORMS ── */
.form-row {
    margin-bottom: 1.2rem;
}

.form-row label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--text-3);
    margin-bottom: .5rem;
}

.form-row input,
.form-row select {
    width: 100%;
    padding: .78rem 1rem;
    background: var(--navy-700);
    border: 1.5px solid var(--border-h);
    border-radius: var(--r-sm);
    color: var(--text-1);
    font-size: .95rem;
    outline: none;
    transition: all var(--transition);
}

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

.form-row input:focus,
.form-row select:focus {
    border-color: var(--indigo-l);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .18);
}

.btn-accent {
    padding: .78rem 1.4rem;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--indigo), var(--indigo-d));
    color: #fff;
    font-size: .92rem;
    width: 100%;
    box-shadow: var(--s-btn);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: all var(--transition);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(99, 102, 241, .65);
}

.btn-sm {
    padding: .4rem .85rem;
    border-radius: var(--r-sm);
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition);
}

.btn-connect {
    background: rgba(99, 102, 241, .15);
    color: var(--indigo-l);
    border: 1px solid rgba(99, 102, 241, .25);
}

.btn-connect:hover {
    background: var(--indigo);
    color: #fff;
}

.btn-delete {
    background: rgba(239, 68, 68, .12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, .22);
}

.btn-delete:hover {
    background: var(--rose);
    color: #fff;
}

.btn-edit {
    background: rgba(245, 158, 11, .12);
    color: var(--amber-l);
    border: 1px solid rgba(245, 158, 11, .22);
}

.btn-edit:hover {
    background: var(--amber);
    color: #000;
}

.btn-save {
    background: rgba(16, 185, 129, .15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, .25);
}

.btn-save:hover {
    background: var(--emerald);
    color: #fff;
}

.btn-cancel {
    background: rgba(255, 255, 255, .05);
    color: var(--text-2);
    border: 1px solid var(--border-h);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, .1);
    color: var(--text-1);
}

/* ── DB CARD ── */
.db-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.1rem;
}

.db-card {
    background: var(--navy-700);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1.35rem;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.db-card:hover {
    border-color: var(--indigo);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, .25), var(--s-card);
    transform: translateY(-3px);
}

.db-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.db-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--indigo), var(--indigo-d));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}

.db-card-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-1);
}

.db-card-host {
    font-size: .8rem;
    color: var(--text-3);
}

.db-card-meta p {
    font-size: .82rem;
    color: var(--text-2);
    line-height: 1.8;
}

.db-card-meta b {
    color: var(--text-1);
}

.db-card-actions {
    display: flex;
    gap: 8px;
}

.db-card-actions .btn-sm {
    flex: 1;
    justify-content: center;
}

/* ── TABLE ── */
.table-wrap {
    overflow-x: auto;
}

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

.premium-table thead th {
    padding: .85rem 1.1rem;
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.premium-table tbody td {
    padding: .85rem 1.1rem;
    color: var(--text-2);
    font-size: .9rem;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
    vertical-align: middle;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.premium-table tbody tr:hover {
    background: rgba(255, 255, 255, .025);
}

.premium-table tbody tr.editing {
    background: rgba(99, 102, 241, .06);
    border-left: 3px solid var(--indigo);
}

.edit-inp {
    width: 100%;
    padding: .4rem .65rem;
    background: var(--navy-600);
    border: 1.5px solid var(--indigo);
    border-radius: 6px;
    color: var(--text-1);
    font-size: .88rem;
    outline: none;
    display: none;
}

.editing .edit-inp {
    display: block;
}

.editing .view-text {
    display: none !important;
}

/* ── TABLE LIST (tables grid) ── */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .9rem;
}

.table-chip {
    background: var(--navy-700);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-1);
    text-decoration: none;
    font-weight: 500;
    font-size: .9rem;
    transition: all var(--transition);
}

.table-chip:hover {
    border-color: var(--indigo);
    background: rgba(99, 102, 241, .1);
    transform: translateY(-2px);
}

.table-chip-icon {
    color: var(--indigo-l);
    font-size: 1rem;
}

/* ── BADGE ── */
.badge {
    padding: .22rem .65rem;
    border-radius: 99px;
    font-size: .73rem;
    font-weight: 700;
}

.badge-indigo {
    background: rgba(99, 102, 241, .18);
    color: var(--indigo-l);
}

.badge-amber {
    background: rgba(245, 158, 11, .18);
    color: var(--amber-l);
}

/* ── ALERTS ── */
.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--r-sm);
    font-size: .9rem;
    display: flex;
    gap: 10px;
    margin-bottom: 1.25rem;
}

.alert-success {
    background: rgba(16, 185, 129, .12);
    border: 1px solid rgba(16, 185, 129, .25);
    color: #6ee7b7;
}

.alert-danger {
    background: rgba(239, 68, 68, .12);
    border: 1px solid rgba(239, 68, 68, .25);
    color: #fca5a5;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-body>* {
    animation: fadeUp .38s cubic-bezier(.4, 0, .2, 1) both;
}