/* =========================================================
   NexusIT — Application Stylesheet
   ========================================================= */

/* -------------------------------------------------------
   Layout
   ------------------------------------------------------- */
html, body { height: 100%; }

.nx-admin-body {
    margin: 0;
    background: #f8fafc;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: .9rem;
}

.nx-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* -------------------------------------------------------
   Sidebar
   ------------------------------------------------------- */
.nx-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--nx-sidebar-bg, #1e293b);
    color: var(--nx-sidebar-fg, #cbd5e1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform .3s;
    z-index: 100;
}

.nx-sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.nx-brand-logo { max-height: 36px; object-fit: contain; }
.nx-brand-name { color: #f1f5f9; }

/* Nav */
.nx-nav {
    list-style: none;
    margin: .5rem 0;
    padding: 0;
    flex: 1;
}

.nx-nav-section {
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.28);
    padding: 1rem 1.25rem .35rem;
}

.nx-nav-link {
    display: flex;
    align-items: center;
    padding: .5rem 1.25rem;
    color: var(--nx-sidebar-fg, #94a3b8);
    text-decoration: none;
    border-radius: 0;
    transition: background .15s, color .15s;
    font-size: .875rem;
}

.nx-nav-link:hover {
    background: var(--nx-sidebar-hover);
    color: #f1f5f9;
}

.nx-nav-link.nx-nav-active {
    background: var(--nx-sidebar-active-bg, #2563eb);
    color: var(--nx-sidebar-active-fg, #fff) !important;
    font-weight: 500;
}

/* User block */
.nx-sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.nx-user-info { display: flex; align-items: center; gap: .75rem; }

.nx-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--nx-primary, #2563eb);
    color: #fff; font-size: .8rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.nx-user-name { font-size: .85rem; font-weight: 500; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-user-role { font-size: .72rem; color: rgba(255,255,255,.4); }

.nx-btn-sidebar {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.1);
    color: rgba(255,255,255,.6);
    font-size: .8rem;
}
.nx-btn-sidebar:hover { background: rgba(255,255,255,.12); color: #fff; border-color: transparent; }

/* -------------------------------------------------------
   Main area
   ------------------------------------------------------- */
.nx-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 0;
}

.nx-topbar {
    background: #fff;
    border-bottom: 1px solid #e8edf2;
    min-height: 52px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.nx-content { padding-top: 1.5rem; }

/* -------------------------------------------------------
   Impersonation banner
   ------------------------------------------------------- */
.nx-impersonate-bar {
    background: #f59e0b;
    color: #1c1917;
    font-size: .85rem;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 200;
}

/* -------------------------------------------------------
   Stat cards
   ------------------------------------------------------- */
.nx-stat-card {
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
}

.nx-stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: .75rem;
}

.nx-stat-label { font-size: .78rem; color: #64748b; margin-bottom: .2rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.nx-stat-value { font-size: 1.4rem; font-weight: 600; color: #0f172a; }

/* -------------------------------------------------------
   Quick links
   ------------------------------------------------------- */
.nx-quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: 1rem .75rem;
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 12px;
    text-decoration: none;
    color: #374151;
    font-size: .8rem;
    font-weight: 500;
    transition: border-color .15s, box-shadow .15s;
    text-align: center;
}

.nx-quick-link:hover {
    border-color: var(--nx-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
    color: #374151;
}

.nx-quick-link i { font-size: 1.4rem; }

/* -------------------------------------------------------
   Empty state
   ------------------------------------------------------- */
.nx-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

/* -------------------------------------------------------
   Tables
   ------------------------------------------------------- */
.nx-table { width: 100%; border-collapse: collapse; }
.nx-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #64748b; font-weight: 600; border-bottom: 2px solid #e8edf2; padding: .6rem .75rem; background: #f8fafc; }
.nx-table td { padding: .75rem; border-bottom: 1px solid #f1f5f9; font-size: .875rem; color: #1e293b; vertical-align: middle; }
.nx-table tr:hover td { background: #f8fafc; }
.nx-table tr:last-child td { border-bottom: none; }

/* Status badges */
.nx-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.nx-badge-success { background: #dcfce7; color: #15803d; }
.nx-badge-warning { background: #fef9c3; color: #a16207; }
.nx-badge-danger  { background: #fee2e2; color: #b91c1c; }
.nx-badge-info    { background: #dbeafe; color: #1d4ed8; }
.nx-badge-muted   { background: #f1f5f9; color: #475569; }

/* -------------------------------------------------------
   Cards
   ------------------------------------------------------- */
.nx-card {
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 12px;
    overflow: hidden;
}

.nx-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nx-card-title { font-size: .95rem; font-weight: 600; color: #0f172a; margin: 0; }
.nx-card-body  { padding: 1.25rem; }

/* -------------------------------------------------------
   Forms
   ------------------------------------------------------- */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #e2e8f0;
    font-size: .875rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--nx-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-label { font-size: .82rem; font-weight: 500; color: #374151; }

/* -------------------------------------------------------
   Buttons
   ------------------------------------------------------- */
.btn-primary { background: var(--nx-primary, #2563eb); border-color: var(--nx-primary, #2563eb); }
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }

/* -------------------------------------------------------
   Mobile sidebar toggle
   ------------------------------------------------------- */
@media (max-width: 991.98px) {
    .nx-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0,0,0,.15);
    }
    .nx-sidebar.nx-sidebar-open { transform: translateX(0); }
    .nx-layout { overflow: unset; }
    .nx-main   { height: 100vh; }
}

/* -------------------------------------------------------
   Alerts (override Bootstrap for consistency)
   ------------------------------------------------------- */
.alert { border-radius: 10px; border: none; font-size: .875rem; }
