/* ============================================================
   STARLIGHT DESIGN SYSTEM — CORE THEME LAYER
   Clean, unified, Bootstrap‑native styling for the entire site
   ============================================================ */


/* ------------------------------------------------------------
   1. Global Variables (colours, spacing, radii, typography)
   ------------------------------------------------------------ */
:root {
    /* Radii */
    --starlight-radius: 0.5rem;

    /* Spacing */
    --starlight-padding: 0.75rem;

    /* Typography */
    --starlight-header-weight: 600;
    --starlight-header-size: 0.8rem;
    --starlight-header-spacing: 0.05em;

    /* Hover colours */
    --starlight-hover-light: rgba(0, 0, 0, 0.03);
    --starlight-hover-dark: rgba(255, 255, 255, 0.05);
}


/* ------------------------------------------------------------
   2. Dark Mode (Bootstrap 5.3 native)
   ------------------------------------------------------------ */
[data-bs-theme="dark"] {
    --starlight-hover-light: rgba(255, 255, 255, 0.05);
}


/* ------------------------------------------------------------
   3. Smooth Theme Transitions (scoped)
   ------------------------------------------------------------ */
html, body, .table-starlight, .card, .navbar {
    transition: background-color .25s ease,
                color .25s ease,
                border-color .25s ease;
}


/* ------------------------------------------------------------
   4. Shake Animation (kept from original)
   ------------------------------------------------------------ */
@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
    100% { transform: translateX(0); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}


/* ------------------------------------------------------------
   5. Admin‑only elements (hidden until JS enables them)
   ------------------------------------------------------------ */
.admin-only {
    display: none;
}


/* ------------------------------------------------------------
   6. Unified Table Component — TABLE STARLIGHT
   Applies to Devices + Users + future tables
   ------------------------------------------------------------ */
.table-starlight-wrapper {
    width: 100%;
    overflow: hidden;
    overflow-x: auto;
    border-radius: var(--starlight-radius);
}

.table-starlight {
    width: max-content !important;
    min-width: 100%;
    border-collapse: collapse;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-collapse: collapse;
}

.table-starlight thead th {
    font-weight: var(--starlight-header-weight);
    text-transform: uppercase;
    font-size: var(--starlight-header-size);
    letter-spacing: var(--starlight-header-spacing);
}

.table-starlight tbody tr:hover {
    background-color: var(--starlight-hover-light);
}

[data-bs-theme="dark"] .table-starlight tbody tr:hover {
    background-color: var(--starlight-hover-dark);
}


.table-starlight td,
.table-starlight th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.5rem 0.75rem;
}

/* Ensure table cells don't clip dropdowns */
.table-starlight td,
.table-starlight tr,
.table-starlight tbody {
    overflow: visible;
}

/* ------------------------------------------------------------
   7. Current User Highlight (Users page)
   ------------------------------------------------------------ */
.current-user-row {
    background-color: rgba(13, 110, 253, 0.05);
}


/* ------------------------------------------------------------
   8. Unified Link Style (Usernames, device names, etc.)
   ------------------------------------------------------------ */
.link-starlight {
    color: var(--bs-primary);
    text-decoration: none;
    font-weight: 500;
    padding: 2px 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.link-starlight:hover {
    border-bottom-color: var(--bs-primary);
}


/* ------------------------------------------------------------
   9. Theme Selector (dropdown checkmark)
   ------------------------------------------------------------ */
.theme-option {
    display: flex !important;
    align-items: center;
    position: relative;
    padding-left: 2.5rem !important;
    gap: 0.5rem;
}

.theme-option.active-theme::before {
    content: "✓";
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: var(--bs-primary-text-emphasis);
}


/* ------------------------------------------------------------
   10. Modal polish (Bootstrap‑native)
   ------------------------------------------------------------ */
.modal-content {
    border-radius: var(--starlight-radius);
}

/* ------------------------------------------------------------
   11. Admin mode navbar styles
   ------------------------------------------------------------ */
   body .navbar {
    border-bottom: 1px solid currentColor;
   }

   body nav.navbar {
    box-shadow: 0 0 6px currentColor !important;
}

body.admin-mode .navbar {
    border-bottom: 4px solid var(--bs-danger);
}

body.admin-mode nav.navbar {
    box-shadow: 0 0 12px rgba(220, 53, 69, 0.6) !important;
}

#adminBadge .badge {
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

#navbar-user-area .dropdown-toggle {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* ------------------------------------------------------------
   12. Navbar — Light & Dark Mode Harmonisation
   ------------------------------------------------------------ */

/* Default navbar polish (keeps Bootstrap behaviour but unifies transitions) */
.navbar {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* Dark mode override — ensures navbar follows dark palette */
[data-bs-theme="dark"] .navbar {
    background-color: var(--bs-dark) !important;
    color: var(--bs-light) !important;
}

/* Ensure nav links remain visible in dark mode */
[data-bs-theme="dark"] .navbar .nav-link,
[data-bs-theme="dark"] .navbar .navbar-brand {
    color: var(--bs-light) !important;
}

/* Hover state for links in dark mode */
[data-bs-theme="dark"] .navbar .nav-link:hover {
    color: var(--bs-primary) !important;
}

/* ------------------------------------------------------------
   13. Actions Menu Button Style
   ------------------------------------------------------------ */

.action-menu-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--starlight-radius);
}

/* ------------------------------------------------------------
   14. Allow dropdown menus inside tables to escape clipping
   ------------------------------------------------------------ */

.table-starlight {
    overflow: visible;
}

.table-starlight tbody {
    overflow: visible;
}

.table-starlight tr {
    overflow: visible;
}

.table-starlight td {
    overflow: visible;
}

