/* ============================================================
   BP Admin — Custom Stylesheet
   ============================================================ */

:root {
    --sidebar-bg: #1e293b;
    --sidebar-text: #e2e8f0;
    --sidebar-hover: #334155;
    --sidebar-active-bg: #334155;
    --sidebar-active-border: var(--accent);
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --content-bg: #f8fafc;
    --accent: #0ea5e9;
    --brand-nexus: #0ea5e9;
    --brand-software: #6366f1;
    --brand-crypto: #f59e0b;
    --card-radius: 12px;
    --input-radius: 8px;
}

/* ---- Sidebar ---- */

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}

.admin-sidebar .sidebar-logo {
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: .02em;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: .6rem;
    white-space: nowrap;
}

.admin-sidebar .sidebar-logo i {
    font-size: 1.4rem;
    color: var(--accent);
}

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

.sidebar-nav .nav-section {
    padding: .5rem 1.5rem .25rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    margin-top: .5rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem 1.5rem;
    color: var(--sidebar-text);
    font-size: .9rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, border-color .15s;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.3rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
    color: #fff;
    font-weight: 500;
}

.sidebar-footer {
    padding: .85rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: .78rem;
    color: rgba(255,255,255,.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-footer a {
    color: rgba(255,255,255,.55);
    text-decoration: none;
    font-size: .78rem;
}

.sidebar-footer a:hover {
    color: #fff;
}

/* ---- Main wrapper ---- */

.admin-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Topbar ---- */

.admin-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.admin-topbar .topbar-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

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

.admin-topbar .btn-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #475569;
    padding: .25rem .4rem;
    cursor: pointer;
}

/* Brand switcher */
.brand-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.brand-switcher .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
    font-weight: 500;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: var(--input-radius);
    padding: .35rem .85rem;
    background: #fff;
}

.brand-switcher .dropdown-toggle:hover,
.brand-switcher .dropdown-toggle:focus {
    border-color: var(--accent);
    color: #1e293b;
}

.brand-switcher .dropdown-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
    padding: .45rem 1rem;
}

.brand-switcher .dropdown-item.active,
.brand-switcher .dropdown-item:active {
    background-color: #f1f5f9;
    color: #1e293b;
}

/* User menu */
.user-menu .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .88rem;
    color: #475569;
    text-decoration: none;
}

.user-menu .dropdown-toggle::after {
    margin-left: .15rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    color: #64748b;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---- Content area ---- */

.admin-content {
    flex: 1;
    background: var(--content-bg);
    padding: 1.75rem 2rem;
}

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

.admin-content .page-header h2 {
    font-size: 1.45rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.admin-content .page-header p {
    color: #64748b;
    font-size: .9rem;
    margin: .25rem 0 0;
}

/* ---- Cards ---- */

.card-admin {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    background: #fff;
}

.card-admin .card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: .95rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.card-admin.brand-accent {
    border-left: 4px solid var(--accent);
}

.card-admin.brand-accent-nexus   { border-left-color: var(--brand-nexus); }
.card-admin.brand-accent-software { border-left-color: var(--brand-software); }
.card-admin.brand-accent-crypto  { border-left-color: var(--brand-crypto); }

.card-admin .card-body {
    padding: 1.25rem;
}

/* Stat cards */
.stat-card {
    text-align: center;
    padding: 1.5rem 1rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: .82rem;
    color: #64748b;
    margin-top: .3rem;
}

.stat-card .stat-icon {
    font-size: 1.6rem;
    margin-bottom: .5rem;
    color: var(--accent);
}

/* ---- Tables ---- */

.table-admin {
    font-size: .88rem;
}

.table-admin thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    padding: .7rem .85rem;
    white-space: nowrap;
}

.table-admin tbody td {
    padding: .7rem .85rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table-admin tbody tr:hover {
    background: #f8fafc;
}

/* Status & priority badges */
.badge-status-new        { background: #dbeafe; color: #1e40af; }
.badge-status-open       { background: #e0f2fe; color: #0369a1; }
.badge-status-in_progress { background: #fef3c7; color: #92400e; }
.badge-status-waiting    { background: #fae8ff; color: #86198f; }
.badge-status-resolved   { background: #dcfce7; color: #166534; }
.badge-status-closed     { background: #f1f5f9; color: #475569; }

.badge-priority-low      { background: #f1f5f9; color: #475569; }
.badge-priority-medium   { background: #fef3c7; color: #92400e; }
.badge-priority-high     { background: #fed7aa; color: #9a3412; }
.badge-priority-urgent   { background: #fecaca; color: #991b1b; }

/* ---- Forms ---- */

.form-control,
.form-select {
    border-radius: var(--input-radius);
    font-size: .9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem rgba(14,165,233,.18);
}

.form-label {
    font-weight: 500;
    font-size: .85rem;
    color: #334155;
    margin-bottom: .3rem;
}

/* ---- Sidebar overlay (mobile) ---- */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* ---- Responsive ---- */

@media (max-width: 767.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

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

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

    .admin-topbar .btn-sidebar-toggle {
        display: block;
    }

    .admin-content {
        padding: 1.25rem 1rem;
    }
}

/* ---- Login page (no sidebar) ---- */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--content-bg);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: var(--card-radius);
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    border: none;
}

.login-card .card-body {
    padding: 2rem 2rem 1.5rem;
}

.login-card .login-logo {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: .25rem;
}

.login-card .login-logo i {
    color: var(--accent);
}

.login-card .login-subtitle {
    font-size: .85rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

/* ---- Utilities ---- */

.text-brand-nexus    { color: var(--brand-nexus) !important; }
.text-brand-software { color: var(--brand-software) !important; }
.text-brand-crypto   { color: var(--brand-crypto) !important; }

.bg-brand-nexus    { background-color: var(--brand-nexus) !important; }
.bg-brand-software { background-color: var(--brand-software) !important; }
.bg-brand-crypto   { background-color: var(--brand-crypto) !important; }

/* Confirm delete modal */
.modal-confirm .modal-header {
    background: #fef2f2;
    border-bottom: none;
}

.modal-confirm .modal-title {
    color: #991b1b;
    font-weight: 600;
}

.modal-confirm .btn-danger {
    border-radius: var(--input-radius);
}

/* ---- Audit log ---- */

.audit-action-badge {
    background: #e0f2fe;
    color: #0369a1;
    font-size: .78rem;
    font-weight: 500;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    padding: .25em .55em;
}

/* ---- Settings inline edit ---- */

tr td input.form-control-sm[form],
tr td select.form-select-sm[form] {
    min-width: 0;
}
