/* ============================================================
   ORBE Nebula — Premium Dark Theme
   resources/css/orbe-theme.css

   Design system for ORBE Solutions CRM
   ============================================================ */

/* ===== 1. DESIGN TOKENS ===== */
:root {
    /* Nebula Palette */
    --nebula-void: #06060e;
    --nebula-surface: #0d0d1a;
    --nebula-elevated: #13132b;
    --nebula-border: rgba(108, 99, 255, 0.12);
    --nebula-glass: rgba(255, 255, 255, 0.03);
    --nebula-glass-hover: rgba(255, 255, 255, 0.06);

    /* Brand */
    --orbe-violet: #6c63ff;
    --orbe-violet-dim: rgba(108, 99, 255, 0.15);
    --orbe-violet-glow: rgba(108, 99, 255, 0.35);
    --orbe-cyan: #00d4aa;
    --orbe-cyan-dim: rgba(0, 212, 170, 0.15);
    --orbe-pink: #ff6b9d;
    --orbe-amber: #fbbf24;

    /* Text */
    --text-primary: #e8e8f0;
    --text-secondary: #7a7a9e;
    --text-muted: #4a4a6a;

    /* Sidebar */
    --sidebar-width: 64px;
    --sidebar-width-expanded: 220px;
    --sidebar-bg: var(--nebula-surface);
    --sidebar-gradient-start: #0d0d1a;
    --sidebar-gradient-end: #0d0d1a;
    --sidebar-link-color: var(--text-secondary);
    --sidebar-link-hover: var(--orbe-cyan);
    --sidebar-active-bg: var(--orbe-violet-dim);
    --sidebar-active-color: var(--orbe-violet);

    /* Topbar */
    --topbar-bg: rgba(13, 13, 26, 0.85);
    --topbar-border: var(--nebula-border);
    --topbar-height: 64px;
    --topbar-link-color: var(--text-primary);

    /* Content */
    --content-top-gap: 16px;

    /* Misc */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Override SKC defaults */
    --primary-color: var(--orbe-violet);
    --primary-dark: #5a52e0;
    --sidebar-width-collapsed: 64px;

    /* Override Bootstrap dark-incompatible defaults */
    --bs-body-bg: var(--nebula-void);
    --bs-body-color: var(--text-primary);
    --bs-emphasis-color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--nebula-border);
    --bs-table-hover-bg: rgba(108, 99, 255, 0.06);
    --bs-table-hover-color: var(--text-primary);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-striped-color: var(--text-primary);
    --bs-border-color: var(--nebula-border);
}


/* ===== 2. GLOBAL BASE ===== */

body {
    background: var(--nebula-void) !important;
    color: var(--text-primary) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ambient light — radial glow behind content */
.content-area {
    background:
        radial-gradient(ellipse 60% 50% at 50% 30%, rgba(108, 99, 255, 0.04) 0%, transparent 70%),
        var(--nebula-void) !important;
    color: var(--text-primary);
}

/* Headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--text-primary) !important;
}

/* Labels */
label, .form-label {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-secondary) !important;
}

/* ===== Bootstrap Light-Class Dark Overrides ===== */
/* Neutralise Bootstrap utility classes that assume a light background */

.bg-light {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

.bg-white {
    background-color: var(--nebula-elevated) !important;
}

.bg-body {
    background-color: var(--nebula-void) !important;
}

.text-dark {
    color: var(--text-primary) !important;
}

.text-black {
    color: var(--text-primary) !important;
}

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

/* Badge overrides for dark theme */
.badge.bg-light {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-primary) !important;
}

.badge.bg-light.text-dark {
    color: var(--text-primary) !important;
}

/* Table light header override */
.table-light,
thead.table-light,
tr.table-light,
th.table-light,
td.table-light {
    background-color: rgba(108, 99, 255, 0.06) !important;
    color: var(--text-secondary) !important;
    --bs-table-bg: rgba(108, 99, 255, 0.06);
    --bs-table-color: var(--text-secondary);
}

/* Card header/footer with bg-white */
.card-header.bg-white,
.card-footer.bg-white {
    background-color: var(--nebula-elevated) !important;
    border-color: var(--nebula-border) !important;
}

/* Form inputs with bg-light override */
.form-control.bg-light,
.form-select.bg-light,
.input-group-text.bg-light {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-primary) !important;
    border-color: var(--nebula-border) !important;
}

.text-dark {
    color: var(--text-primary) !important;
}

/* Links */
a:not(.btn):not(.nav-link):not(.dropdown-item) {
    color: var(--orbe-violet);
}

a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: var(--orbe-cyan);
}


/* ===== 3. SIDEBAR — Slim + Expand on Hover ===== */

.sidebar {
    width: var(--sidebar-width) !important;
    background: var(--nebula-surface) !important;
    border-right: 1px solid var(--nebula-border);
    box-shadow: 1px 0 24px rgba(108, 99, 255, 0.06);
    transition: width var(--transition-base) !important;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Expand on hover (desktop only) */
@media (min-width: 769px) {
    .sidebar:hover {
        width: var(--sidebar-width-expanded) !important;
    }

    /* When collapsed (default on desktop) hide text */
    .sidebar:not(:hover) .nav-link span,
    .sidebar:not(:hover) .nav-link .fw-bold,
    .sidebar:not(:hover) .submenu-caret,
    .sidebar:not(:hover) .submenu,
    .sidebar:not(:hover) .text-uppercase,
    .sidebar:not(:hover) .orbe-logo-full {
        opacity: 0;
        width: 0;
        overflow: hidden;
        white-space: nowrap;
        transition: opacity 0.15s ease;
    }

    .sidebar:hover .nav-link span,
    .sidebar:hover .nav-link .fw-bold,
    .sidebar:hover .submenu-caret,
    .sidebar:hover .orbe-logo-full {
        opacity: 1;
        width: auto;
        transition: opacity 0.25s ease 0.1s;
    }

    /* Submenu only on hover */
    .sidebar:hover .submenu.show {
        display: block;
    }

    .sidebar:not(:hover) .submenu {
        display: none !important;
    }
}

/* Also handle the JS-toggled collapsed state */
.sidebar.collapsed {
    width: var(--sidebar-width) !important;
}

/* Logo area */
.sidebar .logo {
    padding: 16px 0 !important;
    border-bottom: 1px solid var(--nebula-border) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    background: transparent !important;
}

.sidebar .logo a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar .logo h4 {
    display: none !important;
}

/* Animated O logo */
.orbe-logo-orb {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    background: var(--nebula-void);
}

.orbe-logo-orb::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--orbe-violet), var(--orbe-cyan), var(--orbe-violet));
    z-index: 0;
    animation: orbe-spin 8s linear infinite;
}

.orbe-logo-orb::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--nebula-void);
    z-index: 1;
}

.orbe-logo-orb span {
    position: relative;
    z-index: 2;
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 900;
    font-size: 16px;
    color: var(--orbe-violet);
    line-height: 1;
}

@keyframes orbe-spin {
    to { transform: rotate(360deg); }
}

/* Full logo text (shown on hover) */
.orbe-logo-full {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    white-space: nowrap;
}

.orbe-logo-full .orbe-name {
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 900;
    font-size: 17px;
    color: var(--orbe-violet);
    letter-spacing: 2px;
}

.orbe-logo-full .orbe-sub {
    font-size: 10px;
    color: var(--orbe-cyan);
    letter-spacing: 1px;
    font-weight: 500;
}

/* Nav items */
.sidebar .nav-item {
    margin: 2px 8px !important;
}

.sidebar .nav-link {
    color: var(--sidebar-link-color) !important;
    padding: 10px 12px !important;
    border-radius: var(--radius-sm) !important;
    transition: all var(--transition-fast) !important;
    transform: none !important;
    gap: 10px;
    position: relative;
}

.sidebar .nav-link i {
    color: var(--text-muted) !important;
    width: 20px !important;
    margin-right: 0 !important;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
    transition: color var(--transition-fast);
}

.sidebar .nav-link span {
    color: var(--sidebar-link-color) !important;
    transition: color var(--transition-fast);
}

/* Hover */
.sidebar .nav-link:hover {
    background: var(--nebula-glass-hover) !important;
    transform: none !important;
}

.sidebar .nav-link:hover i {
    color: var(--orbe-cyan) !important;
}

.sidebar .nav-link:hover span {
    color: var(--text-primary) !important;
}

/* Active — left accent bar */
.sidebar .nav-link.active {
    background: var(--sidebar-active-bg) !important;
    transform: none !important;
}

.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--orbe-violet);
}

.sidebar .nav-link.active i {
    color: var(--orbe-violet) !important;
}

.sidebar .nav-link.active span {
    color: var(--text-primary) !important;
}

/* Submenu */
.sidebar .submenu {
    padding-left: 8px !important;
}

.sidebar .submenu .nav-link {
    color: var(--text-muted) !important;
    font-size: 0.82rem !important;
    padding: 7px 12px !important;
}

.sidebar .submenu .nav-link:hover {
    color: var(--orbe-cyan) !important;
}

.sidebar .submenu .nav-link:hover i,
.sidebar .submenu .nav-link:hover span {
    color: var(--orbe-cyan) !important;
}

.sidebar .submenu .nav-link.active {
    background: rgba(108, 99, 255, 0.1) !important;
}

.sidebar .submenu .nav-link.active i,
.sidebar .submenu .nav-link.active span {
    color: var(--orbe-violet) !important;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 3px !important;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent !important;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(108, 99, 255, 0.2) !important;
    border-radius: 10px !important;
}

/* Override collapsed styles from admin.blade */
.sidebar.collapsed .nav-link {
    justify-content: center !important;
    width: auto !important;
    height: auto !important;
    padding: 10px 12px !important;
    border-radius: var(--radius-sm) !important;
}

.sidebar.collapsed .nav-link:hover {
    background: var(--nebula-glass-hover) !important;
    transform: none !important;
}

.sidebar.collapsed .nav-item {
    margin: 2px 8px !important;
    display: block !important;
}

/* Sidebar SaaS management link override */
.sidebar .nav-item a[href*="tenants"] {
    width: auto !important;
}


/* ===== 4. MAIN CONTENT AREA ===== */

.main-content {
    margin-left: var(--sidebar-width) !important;
    transition: margin-left var(--transition-base) !important;
}

/* When sidebar hovers open, don't shift content — content stays still, sidebar overlays */
.main-content.expanded {
    margin-left: var(--sidebar-width) !important;
}


/* ===== 5. TOPBAR ===== */

.top-navbar {
    background: var(--topbar-bg) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--nebula-border) !important;
    box-shadow: none !important;
    height: var(--topbar-height) !important;
    left: var(--sidebar-width) !important;
    transition: backdrop-filter var(--transition-base), box-shadow var(--transition-base);
    padding: 0 20px !important;
}

/* Scroll state — enhanced blur (toggled via JS) */
.top-navbar.scrolled {
    backdrop-filter: blur(32px) saturate(1.2);
    -webkit-backdrop-filter: blur(32px) saturate(1.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4) !important;
    border-bottom-color: rgba(108, 99, 255, 0.18) !important;
}

.main-content.expanded .top-navbar {
    left: var(--sidebar-width) !important;
}

/* Toggle button */
.toggle-btn {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
    transition: all var(--transition-fast) !important;
}

.toggle-btn:hover {
    background: var(--orbe-violet-dim) !important;
    color: var(--text-primary) !important;
}

/* Topbar text colors */
.top-navbar,
.top-navbar .text-dark,
.top-navbar #userDropdown,
.top-navbar #userDropdown span,
.top-navbar .dropdown-toggle {
    color: var(--text-primary) !important;
}

.top-navbar .work-control .status-text {
    color: var(--text-secondary) !important;
}

/* Icon buttons */
.navbar-icon-btn {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
    transition: all var(--transition-fast) !important;
    width: 40px !important;
    height: 40px !important;
}

.navbar-icon-btn:hover {
    background: var(--orbe-violet-dim) !important;
    color: var(--text-primary) !important;
    transform: scale(1.05);
}

.navbar-icon-img {
    border-radius: var(--radius-sm) !important;
}

/* Topbar dropdowns */
.top-navbar .dropdown-menu {
    background: var(--nebula-elevated) !important;
    border: 1px solid var(--nebula-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(20px);
}

.top-navbar .dropdown-menu .dropdown-item {
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.top-navbar .dropdown-menu .dropdown-item:hover {
    background: var(--orbe-violet-dim) !important;
    color: #fff !important;
}

.top-navbar .dropdown-menu .dropdown-divider {
    border-color: var(--nebula-border) !important;
}

.top-navbar .dropdown-menu .text-muted,
.top-navbar .dropdown-menu .fw-semibold,
.top-navbar .dropdown-menu .text-dark {
    color: var(--text-secondary) !important;
}

.top-navbar .user-dropdown-meta,
.top-navbar .user-dropdown-meta .meta-name {
    color: var(--text-secondary) !important;
}

.top-navbar .user-dropdown-meta .meta-access,
.top-navbar .user-dropdown-meta .meta-version {
    color: var(--text-muted) !important;
}

/* Logout button in dropdown */
.dropdown-logout {
    background: rgba(255, 59, 48, 0.15) !important;
    color: var(--orbe-pink) !important;
}

.dropdown-logout:hover {
    background: rgba(255, 59, 48, 0.25) !important;
    color: #fff !important;
}


/* ===== 6. CARDS — Glassmorphism ===== */

.card,
.summary-card {
    background: var(--nebula-glass) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--nebula-border) !important;
    border-radius: var(--radius-lg) !important;
    color: var(--text-primary);
    transition: all var(--transition-base);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.card:hover,
.summary-card:hover {
    border-color: var(--orbe-violet-glow) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(108, 99, 255, 0.12);
}

.card-header {
    background: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 1px solid var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.card-header h6,
.card-header .card-title {
    color: var(--text-primary) !important;
}

.card-body {
    color: var(--text-primary);
}

.card-footer {
    background: rgba(255, 255, 255, 0.01) !important;
    border-top: 1px solid var(--nebula-border) !important;
}

/* Summary card accent borders */
.summary-card.summary-accent {
    border-top: none !important;
}

.summary-card.summary-accent.summary-success { border-left: 3px solid var(--orbe-cyan) !important; border-top: none !important; }
.summary-card.summary-accent.summary-warning { border-left: 3px solid var(--orbe-amber) !important; border-top: none !important; }
.summary-card.summary-accent.summary-info    { border-left: 3px solid var(--orbe-violet) !important; border-top: none !important; }
.summary-card.summary-accent.summary-danger  { border-left: 3px solid var(--orbe-pink) !important; border-top: none !important; }
.summary-card.summary-accent.summary-primary { border-left: 3px solid var(--orbe-violet) !important; border-top: none !important; }


/* ===== 7. TABLES ===== */

.table {
    color: var(--text-primary) !important;
}

.table.table-clean thead th {
    background: rgba(108, 99, 255, 0.06) !important;
    color: var(--text-secondary) !important;
    border-bottom-color: var(--nebula-border) !important;
    border-top: none !important;
}

.table.table-clean tbody tr {
    transition: background var(--transition-fast) !important;
}

.table.table-clean tbody tr:hover {
    background: rgba(108, 99, 255, 0.06) !important;
}

.table.table-clean tbody td {
    border-bottom-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-primary) !important;
}

.table-bordered,
.table-bordered th,
.table-bordered td {
    border-color: var(--nebula-border) !important;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.015) !important;
    color: var(--text-primary);
}


/* ===== 8. FORMS ===== */

.form-control,
.form-select {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid var(--nebula-border) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    transition: all var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(255, 255, 255, 0.06) !important;
    border-color: var(--orbe-violet) !important;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2) !important;
    color: var(--text-primary) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
}

.form-check-input {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--nebula-border);
}

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

.input-group-text {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-secondary) !important;
}


/* ===== 9. BUTTONS ===== */

.btn {
    border-radius: var(--radius-sm) !important;
    font-weight: 500;
    transition: all var(--transition-fast) !important;
}

.btn:hover {
    transform: scale(1.02);
}

.btn-primary {
    background: var(--orbe-violet) !important;
    border-color: var(--orbe-violet) !important;
    color: #fff !important;
    box-shadow: 0 2px 12px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover,
.btn-primary:focus {
    background: #5a52e0 !important;
    border-color: #5a52e0 !important;
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4) !important;
}

.btn-success {
    background: var(--orbe-cyan) !important;
    border-color: var(--orbe-cyan) !important;
    color: #06060e !important;
}

.btn-success:hover {
    background: #00b894 !important;
    border-color: #00b894 !important;
}

.btn-danger {
    background: rgba(255, 107, 157, 0.15) !important;
    border-color: var(--orbe-pink) !important;
    color: var(--orbe-pink) !important;
}

.btn-danger:hover {
    background: var(--orbe-pink) !important;
    color: #fff !important;
}

.btn-outline-primary {
    color: var(--orbe-violet) !important;
    border-color: var(--orbe-violet) !important;
}

.btn-outline-primary:hover {
    background: var(--orbe-violet) !important;
    color: #fff !important;
}

.btn-outline-secondary,
.btn-secondary {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.btn-outline-secondary:hover,
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

.btn-light {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.btn-light:hover {
    background: rgba(255, 255, 255, 0.12) !important;
}

.btn-info {
    background: rgba(108, 99, 255, 0.15) !important;
    border-color: var(--orbe-violet) !important;
    color: var(--orbe-violet) !important;
}

.btn-info:hover {
    background: var(--orbe-violet) !important;
    color: #fff !important;
}

.btn-warning {
    background: rgba(251, 191, 36, 0.15) !important;
    border-color: var(--orbe-amber) !important;
    color: var(--orbe-amber) !important;
}

.btn-warning:hover {
    background: var(--orbe-amber) !important;
    color: #06060e !important;
}


/* ===== 10. MODALS ===== */

.modal-content {
    background: var(--nebula-elevated) !important;
    border: 1px solid var(--nebula-border) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.modal-header {
    background: transparent !important;
    border-bottom: 1px solid var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.modal-header .modal-title {
    color: var(--text-primary) !important;
}

.modal-header .btn-close {
    filter: invert(1) brightness(0.7);
}

.modal-body {
    color: var(--text-primary) !important;
}

.modal-footer {
    border-top: 1px solid var(--nebula-border) !important;
    background: transparent !important;
}

.modal-backdrop.show {
    backdrop-filter: blur(4px);
}


/* ===== 11. ALERTS & BADGES ===== */

.alert {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--nebula-border) !important;
}

.alert-success {
    background: rgba(0, 212, 170, 0.1) !important;
    color: var(--orbe-cyan) !important;
    border-color: rgba(0, 212, 170, 0.2) !important;
}

.alert-danger {
    background: rgba(255, 107, 157, 0.1) !important;
    color: var(--orbe-pink) !important;
    border-color: rgba(255, 107, 157, 0.2) !important;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1) !important;
    color: var(--orbe-amber) !important;
    border-color: rgba(251, 191, 36, 0.2) !important;
}

.alert-info {
    background: rgba(108, 99, 255, 0.1) !important;
    color: var(--orbe-violet) !important;
    border-color: rgba(108, 99, 255, 0.2) !important;
}

.badge {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge.bg-primary {
    background: var(--orbe-violet) !important;
}

.badge.bg-success {
    background: var(--orbe-cyan) !important;
    color: #06060e !important;
}

.badge.bg-danger {
    background: var(--orbe-pink) !important;
}

.badge.bg-warning {
    background: var(--orbe-amber) !important;
    color: #06060e !important;
}


/* ===== 12. PAGINATION ===== */

.page-item .page-link {
    background: transparent !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
}

.page-item.active .page-link {
    background: var(--orbe-violet) !important;
    border-color: var(--orbe-violet) !important;
    color: #fff !important;
}

.page-item .page-link:hover {
    background: var(--orbe-violet-dim) !important;
    color: var(--text-primary) !important;
}


/* ===== 13. TOASTS ===== */

.app-toast {
    background: var(--nebula-elevated) !important;
    border: 1px solid var(--nebula-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4) !important;
}

.app-toast .toast-header {
    background: transparent !important;
    color: var(--text-primary) !important;
}

.app-toast .toast-header .btn-close {
    filter: invert(1) brightness(0.7);
}

.app-toast-success { border-left-color: var(--orbe-cyan) !important; }
.app-toast-danger  { border-left-color: var(--orbe-pink) !important; }
.app-toast-warning { border-left-color: var(--orbe-amber) !important; }


/* ===== 14. OFFCANVAS (Reminders panel, etc.) ===== */

.offcanvas {
    background: var(--nebula-elevated) !important;
    color: var(--text-primary) !important;
    border-color: var(--nebula-border) !important;
}

.offcanvas-header {
    border-bottom-color: var(--nebula-border) !important;
}

.offcanvas .btn-close {
    filter: invert(1) brightness(0.7);
}

.reminder-card {
    background: var(--nebula-glass) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-primary) !important;
}


/* ===== 15. ASSISTANT MODAL ===== */

.assistant-sidebar {
    background: var(--nebula-surface) !important;
    border-right-color: var(--nebula-border) !important;
}

.assistant-messages {
    background: var(--nebula-void) !important;
}

.assistant-message.user {
    background: var(--orbe-violet-dim) !important;
    color: var(--text-primary) !important;
}

.assistant-message.assistant {
    background: var(--nebula-glass) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.assistant-input {
    background: var(--nebula-elevated) !important;
    border-top-color: var(--nebula-border) !important;
}

.assistant-conversation {
    background: var(--nebula-glass) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.assistant-conversation.active {
    border-color: var(--orbe-violet) !important;
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.15) !important;
}

.assistant-empty {
    border-color: var(--nebula-border) !important;
    background: var(--nebula-glass) !important;
    color: var(--text-secondary) !important;
}


/* ===== 16. MISC BOOTSTRAP OVERRIDES ===== */

/* Breadcrumbs */
.breadcrumb {
    background: transparent;
}

.breadcrumb-item,
.breadcrumb-item a {
    color: var(--text-secondary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
}

/* Nav tabs */
.nav-tabs {
    border-bottom-color: var(--nebula-border) !important;
}

.nav-tabs .nav-link {
    color: var(--text-secondary) !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    padding: 10px 16px;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary) !important;
    border-bottom-color: var(--text-muted) !important;
    background: transparent !important;
}

.nav-tabs .nav-link.active {
    color: var(--orbe-violet) !important;
    background: transparent !important;
    border-bottom-color: var(--orbe-violet) !important;
}

/* Nav pills */
.nav-pills .nav-link {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
}

.nav-pills .nav-link.active {
    background: var(--orbe-violet) !important;
    color: #fff !important;
}

/* List groups */
.list-group-item {
    background: var(--nebula-glass) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.list-group-item:hover {
    background: var(--nebula-glass-hover) !important;
}

/* Progress bars */
.progress {
    background: rgba(255, 255, 255, 0.06) !important;
    border-radius: var(--radius-sm) !important;
}

.progress-bar {
    background: var(--orbe-violet) !important;
}

/* Borders utility */
.border,
.border-bottom,
.border-top,
.border-start,
.border-end {
    border-color: var(--nebula-border) !important;
}

.border-left-primary {
    border-left-color: var(--orbe-violet) !important;
}

/* Background utility overrides */
.bg-white {
    background: var(--nebula-elevated) !important;
}

.bg-light {
    background: rgba(255, 255, 255, 0.03) !important;
}

.bg-primary {
    background: var(--orbe-violet) !important;
}

/* Text utilities */
.text-primary {
    color: var(--orbe-violet) !important;
}

.text-success {
    color: var(--orbe-cyan) !important;
}

.text-danger {
    color: var(--orbe-pink) !important;
}

.text-warning {
    color: var(--orbe-amber) !important;
}

/* Shadows — override Bootstrap white shadows */
.shadow, .shadow-sm, .shadow-lg {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25) !important;
}

/* Dropdown menus (global) */
.dropdown-menu {
    background: var(--nebula-elevated) !important;
    border: 1px solid var(--nebula-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4) !important;
}

.dropdown-item {
    color: var(--text-primary) !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--orbe-violet-dim) !important;
    color: #fff !important;
}

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


/* ===== 17. ANIMATIONS ===== */

/* Staggered fade-in for cards */
@keyframes nebula-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-area .card,
.content-area .summary-card {
    animation: nebula-fadeInUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.content-area .card:nth-child(1),
.content-area .summary-card:nth-child(1) { animation-delay: 0.05s; }
.content-area .card:nth-child(2),
.content-area .summary-card:nth-child(2) { animation-delay: 0.1s; }
.content-area .card:nth-child(3),
.content-area .summary-card:nth-child(3) { animation-delay: 0.15s; }
.content-area .card:nth-child(4),
.content-area .summary-card:nth-child(4) { animation-delay: 0.2s; }
.content-area .card:nth-child(5),
.content-area .summary-card:nth-child(5) { animation-delay: 0.25s; }
.content-area .card:nth-child(6),
.content-area .summary-card:nth-child(6) { animation-delay: 0.3s; }

/* Glow pulse for logo O */
@keyframes orbe-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(108, 99, 255, 0.2); }
    50%      { box-shadow: 0 0 20px rgba(108, 99, 255, 0.4), 0 0 40px rgba(0, 212, 170, 0.1); }
}

.orbe-logo-orb {
    animation: orbe-glow 4s ease-in-out infinite;
}


/* ===== 18. MOBILE ===== */

@media (max-width: 768px) {
    .sidebar {
        width: 250px !important;
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* Always show text on mobile (no collapse behavior) */
    .sidebar .nav-link span,
    .sidebar .orbe-logo-full {
        opacity: 1 !important;
        width: auto !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .top-navbar {
        left: 0 !important;
    }

    .overlay {
        background: rgba(6, 6, 14, 0.7) !important;
        backdrop-filter: blur(4px) !important;
    }
}


/* ===== 19. PWA THEME ===== */
/* Match PWA theme color with our theme */


/* ===== 20. LOGIN PAGE ===== */

.auth-screen .auth-overlay {
    background: linear-gradient(135deg, rgba(6, 6, 14, 0.9), rgba(13, 13, 26, 0.8)) !important;
}

.auth-card {
    background: var(--nebula-elevated) !important;
    border: 1px solid var(--nebula-border) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5) !important;
}

.auth-header {
    background: var(--nebula-surface) !important;
}

.auth-body {
    background: var(--nebula-elevated) !important;
    color: var(--text-primary) !important;
}

.auth-body .form-label {
    color: var(--text-secondary) !important;
}

.auth-body .form-control {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.auth-body .form-control:focus {
    border-color: var(--orbe-violet) !important;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2) !important;
}

.auth-body .form-check-label {
    color: var(--text-secondary) !important;
}

.auth-body a {
    color: var(--orbe-violet) !important;
}

.auth-body a:hover {
    color: var(--orbe-cyan) !important;
}

.auth-btn.btn-primary {
    background: var(--orbe-violet) !important;
    border-color: var(--orbe-violet) !important;
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.35);
}

.auth-btn.btn-primary:hover {
    background: #5a52e0 !important;
    box-shadow: 0 6px 28px rgba(108, 99, 255, 0.5) !important;
}

.auth-body .text-center p {
    color: var(--text-secondary) !important;
}


/* ===== 21. CHAT WIDGET ===== */

.chat-widget {
    border: 1px solid var(--nebula-border);
}


/* ===== 22. SPARKLINE — CSS-only decorative element for metric cards ===== */

.orbe-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 20px;
    margin-top: 8px;
    opacity: 0.5;
}

.orbe-sparkline span {
    display: block;
    width: 3px;
    border-radius: 2px;
    background: currentColor;
    animation: sparkline-grow 1.2s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@keyframes sparkline-grow {
    from { height: 0; }
}


/* ===== 23. COUNTER-UP ANIMATION ===== */

.orbe-counter {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--text-primary);
    line-height: 1;
}


/* ===== 24. DASHBOARD — KPI Cards (remove solid colored backgrounds) ===== */

.kpi-card {
    background: var(--nebula-glass) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--nebula-border) !important;
    border-radius: 14px !important;
    color: var(--text-primary) !important;
    transition: all var(--transition-base);
}

/* Kill the solid gradient backgrounds — glassmorphism + left accent only */
.kpi-card.kpi-colored {
    background: var(--nebula-glass) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--nebula-border) !important;
}

.kpi-card.kpi-blue {
    background: var(--nebula-glass) !important;
    border-left: 4px solid var(--orbe-violet) !important;
}

.kpi-card.kpi-cyan {
    background: var(--nebula-glass) !important;
    border-left: 4px solid var(--orbe-cyan) !important;
}

.kpi-card.kpi-yellow {
    background: var(--nebula-glass) !important;
    border-left: 4px solid var(--orbe-amber) !important;
}

.kpi-card.kpi-green {
    background: var(--nebula-glass) !important;
    border-left: 4px solid #1cc88a !important;
}

.kpi-card:hover {
    border-color: var(--orbe-violet-glow) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(108, 99, 255, 0.1);
}

/* Fix text colors inside KPI cards that expect white-on-color */
.kpi-card.kpi-colored .kpi-label,
.kpi-card.kpi-colored .kpi-sub {
    color: var(--text-secondary) !important;
}

.kpi-card .kpi-label {
    color: var(--text-secondary) !important;
}

.kpi-card .kpi-value {
    color: var(--text-primary) !important;
}

.kpi-card .kpi-sub {
    color: var(--text-secondary) !important;
}

.kpi-card .kpi-icon {
    opacity: 0.4 !important;
    color: var(--text-muted) !important;
}

/* Color the icon to match the left border */
.kpi-card.kpi-blue .kpi-icon  { color: var(--orbe-violet) !important; }
.kpi-card.kpi-cyan .kpi-icon  { color: var(--orbe-cyan) !important; }
.kpi-card.kpi-yellow .kpi-icon { color: var(--orbe-amber) !important; }
.kpi-card.kpi-green .kpi-icon { color: #1cc88a !important; }

/* Highlighted KPI card (nicho hero metric) */
.kpi-card.kpi-highlight {
    border: 1px solid var(--orbe-violet-glow) !important;
    box-shadow: 0 0 24px rgba(108, 99, 255, 0.12);
}

.kpi-card.kpi-highlight .kpi-value {
    font-size: 2.2rem !important;
    font-weight: 800;
}


/* ===== 25. DASHBOARD — Summary Cards ===== */

.summary-card {
    background: var(--nebula-glass) !important;
    border: 1px solid var(--nebula-border) !important;
}

.summary-card .card-header {
    background: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 1px solid var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.summary-card.summary-accent {
    border-top: none !important;
}

.summary-card.summary-accent.summary-primary { border-left: 4px solid var(--orbe-violet) !important; }
.summary-card.summary-accent.summary-success { border-left: 4px solid var(--orbe-cyan) !important; }
.summary-card.summary-accent.summary-danger  { border-left: 4px solid var(--orbe-pink) !important; }
.summary-card.summary-accent.summary-warning { border-left: 4px solid var(--orbe-amber) !important; }
.summary-card.summary-accent.summary-info    { border-left: 4px solid var(--orbe-violet) !important; }

.summary-pill {
    background: rgba(108, 99, 255, 0.1) !important;
    color: var(--text-secondary) !important;
}


/* ===== 26. DASHBOARD — Note Card (yellow block fix) ===== */

.note-card textarea {
    background: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-primary) !important;
    border: none !important;
    border-radius: 0 0 14px 14px !important;
}

.note-card textarea::placeholder {
    color: var(--text-muted) !important;
}

.note-card textarea:focus {
    background: rgba(255, 255, 255, 0.06) !important;
    box-shadow: inset 0 0 0 1px var(--orbe-violet) !important;
    border-color: transparent !important;
}


/* ===== 27. DASHBOARD — Calendar ===== */

.agenda-calendar-day {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.agenda-calendar-day.muted {
    background: rgba(255, 255, 255, 0.01) !important;
    color: var(--text-muted) !important;
}

.agenda-calendar-day.today {
    border-color: var(--orbe-cyan) !important;
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.15) !important;
}

.agenda-calendar-day-number {
    color: var(--text-primary) !important;
}

.agenda-calendar-day.muted .agenda-calendar-day-number {
    color: var(--text-muted) !important;
}

.agenda-calendar-weekdays span {
    color: var(--text-secondary) !important;
}

.agenda-calendar-event {
    background: rgba(108, 99, 255, 0.15) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(108, 99, 255, 0.25) !important;
}

.agenda-calendar-event:hover {
    filter: brightness(1.15) !important;
}

.agenda-calendar-more {
    color: var(--text-secondary) !important;
}

.agenda-calendar-empty {
    color: var(--text-secondary) !important;
}


/* ===== 28. DASHBOARD — Charts & Progress ===== */

.chart-card canvas {
    filter: brightness(0.95) saturate(1.1);
}

.project-stat::after {
    background: var(--nebula-border) !important;
}

.project-stat .stat-value {
    color: var(--text-primary) !important;
}

.project-stat .stat-label {
    color: var(--text-secondary) !important;
}

.project-progress-bar {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: var(--orbe-cyan) !important;
}

.project-progress-fill {
    background: rgba(0, 212, 170, 0.25) !important;
}

.project-progress-text {
    color: var(--text-primary) !important;
}


/* ===== 29. DASHBOARD — List items ===== */

.list-clean .list-group-item {
    border-top-color: var(--nebula-border) !important;
    background: transparent !important;
    color: var(--text-primary) !important;
}

.users-chart {
    border-top-color: var(--nebula-border) !important;
}

.users-role-list .list-group-item span:first-child {
    color: var(--text-primary) !important;
}


/* ===== 30. GLOBAL — Kill remaining white backgrounds ===== */

/* Any card-body or container that defaulted to white */
.card-body,
.tab-content,
.tab-pane {
    background: transparent !important;
    color: var(--text-primary) !important;
}

/* Ensure no white backgrounds leak through */
.bg-white,
.bg-body {
    background: var(--nebula-elevated) !important;
}

.bg-light {
    background: rgba(255, 255, 255, 0.03) !important;
}

/* Select2 and other third-party dropdowns */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-primary) !important;
}

.select2-dropdown {
    background: var(--nebula-elevated) !important;
    border-color: var(--nebula-border) !important;
}

.select2-results__option {
    color: var(--text-primary) !important;
}

.select2-results__option--highlighted {
    background: var(--orbe-violet-dim) !important;
}

/* Datepicker overrides */
.datepicker,
.flatpickr-calendar {
    background: var(--nebula-elevated) !important;
    border-color: var(--nebula-border) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4) !important;
}




.kpi-card.kpi-blue { border-left: 4px solid #6c63ff !important; border-top: 1px solid rgba(255,255,255,0.08) !important; border-right: 1px solid rgba(255,255,255,0.08) !important; border-bottom: 1px solid rgba(255,255,255,0.08) !important; }

/* ORBE Status Bar — bolinhas animadas */
.orbe-status-bar { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--nebula-border); margin-top: auto; }
.orbe-status-indicator { display: flex; align-items: center; gap: 8px; }
.orbe-status-label { font-size: 11px; color: var(--text-secondary); font-weight: 500; }
.orbe-ai-pulse { width: 8px; height: 8px; border-radius: 50%; display: inline-block; position: relative; flex-shrink: 0; }
.orbe-ai-pulse.pulse-green { background: #00d4aa; box-shadow: 0 0 6px #00d4aa; animation: pulseGreen 2s infinite; }
.orbe-ai-pulse.pulse-violet { background: #6c63ff; box-shadow: 0 0 6px #6c63ff; animation: pulseViolet 2s infinite; }
@keyframes pulseGreen { 0%,100% { box-shadow: 0 0 4px #00d4aa; transform: scale(1); } 50% { box-shadow: 0 0 12px #00d4aa; transform: scale(1.3); } }
@keyframes pulseViolet { 0%,100% { box-shadow: 0 0 4px #6c63ff; transform: scale(1); } 50% { box-shadow: 0 0 12px #6c63ff; transform: scale(1.3); } }



/* Fix: select option dark theme - all states */
select option,
select.form-select option,
.form-control option,
.form-select option,
.modal select option {
    background: #1a1a2e !important;
    color: #e2e8f0 !important;
    padding: 8px 12px;
}

select option:hover,
select option:focus {
    background: #2a2a4a !important;
    color: #ffffff !important;
}

select option:checked,
select option[selected] {
    background: #6c63ff !important;
    color: #ffffff !important;
}

select option:disabled {
    color: #888 !important;
}

/* Dark color-scheme for all form inputs */
select, input[type=date], input[type=time], input[type=datetime-local] {
    color-scheme: dark;
}
