/* ── Layout: Sidebar fixed, Navbar sticky, Content scrollable ── */
html, body {
    height: 100%;
    overflow: hidden;
}

#wrapper {
    height: 100vh;
    overflow: hidden;
}

/* Sidebar: fixed left, full height, scrollable independently */
.sidebar {
    min-width: 300px;
    max-width: 300px;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: min-width 0.3s ease, max-width 0.3s ease;
    flex-shrink: 0;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

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

/* Sidebar toggle button */
.sidebar-toggle {
    font-size: 1.1rem;
    transition: transform 0.3s;
    line-height: 1;
}

/* ── Collapsed sidebar: icons only ── */
.sidebar-collapsed .sidebar {
    min-width: 62px;
    max-width: 62px;
}

.sidebar-collapsed .sidebar .sidebar-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    display: inline-block;
    transition: opacity 0.2s;
}

.sidebar-collapsed .sidebar .sidebar-nav {
    padding: 0.75rem 0.4rem !important;
}

.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    padding: 0.6rem 0;
}

.sidebar-collapsed .sidebar .nav-link i {
    margin-right: 0 !important;
    font-size: 1.15rem;
}

.sidebar-collapsed .sidebar .sidebar-header {
    justify-content: center !important;
    padding: 0.75rem 0.4rem !important;
}

.sidebar-collapsed .sidebar .sidebar-brand {
    justify-content: center;
}

.sidebar-collapsed .sidebar .sidebar-brand i {
    margin-right: 0 !important;
}

/* Toggle icon flips */
.sidebar-collapsed .sidebar .sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    background: #343a40;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    border: 2px solid #495057;
    z-index: 10;
}

.sidebar-collapsed .sidebar .sidebar-toggle-icon::before {
    content: "\F285"; /* bi-chevron-bar-right */
}

/* Hide section labels completely when collapsed */
.sidebar-collapsed .sidebar .nav-section-label {
    display: none !important;
}

/* Content wrapper: takes remaining width */
#page-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: #f8f9fa;
}

/* Navbar: sticky at top, never scrolls */
#page-content-wrapper > nav {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Main content: scrollable area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Responsive sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: -300px;
        position: fixed;
        z-index: 1050;
    }
    .sidebar.show {
        margin-left: 0;
    }
    .sidebar-collapsed .sidebar {
        margin-left: -62px;
    }
}

/* ── Table rows clickable ── */
.cursor-pointer {
    cursor: pointer;
}

.cursor-pointer:hover {
    background-color: rgba(13, 110, 253, 0.04) !important;
}

/* ── Cards ── */
.card {
    border: none;
    border-radius: 0.5rem;
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* ── Badge subtle colors (role badges) ── */
.bg-admin-subtle { background-color: #cfe2ff; }
.text-admin { color: #084298; }
.bg-agent-subtle { background-color: #d1e7dd; }
.text-agent { color: #0f5132; }
.bg-editor-subtle { background-color: #fff3cd; }
.text-editor { color: #664d03; }
.bg-viewer-subtle { background-color: #e0cffc; }
.text-viewer { color: #3d1f8e; }
.bg-user-subtle { background-color: #e2e3e5; }
.text-user { color: #41464b; }

/* ── Priority badges ── */
.badge {
    font-weight: 500;
}

/* ── Scrollbar styling ── */
.sidebar::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.main-content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

/* ── Alerts ── */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* ── Tables ── */
.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    font-weight: 600;
}

/* ── Form controls ── */
.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* ── Ticket cards ── */
.ticket-card {
    transition: box-shadow 0.15s, transform 0.15s;
    border-left: 3px solid transparent;
}

.ticket-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px);
    border-left-color: var(--bs-primary);
}

.ticket-avatar {
    width: 38px;
    height: 38px;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* ── HTMX loading indicator ── */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}
