/* Orion Assessor — Global Styles */
:root {
    --orion-red: #dc2626;
    --orion-red-dark: #b91c1c;
    --orion-dark: #1e293b;
    --orion-darker: #0f172a;
    --sidebar-width: 260px;
}

body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f1f5f9; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--orion-dark);
    color: #e2e8f0;
    position: fixed;
    top: 0; left: 0;
    z-index: 1040;
    transition: transform .25s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.sidebar-nav { padding: 12px 0; flex: 1 1 auto; overflow-y: auto; min-height: 0; }

/* Wide dark scrollbar for sidebar nav */
.sidebar-nav {
    scrollbar-width: auto;
    scrollbar-color: rgba(255,255,255,.35) var(--orion-darker);
}
.sidebar-nav::-webkit-scrollbar { width: 14px !important; }
.sidebar-nav::-webkit-scrollbar-track { background: var(--orion-darker) !important; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.3) !important;
    border: 3px solid var(--orion-darker) !important;
    border-radius: 7px !important;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.5) !important; }
.sidebar-nav::-webkit-scrollbar-button { display: none !important; }
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 16px 16px;
    font-size: 1.1rem;
    flex-shrink: 0;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo { height: 36px; width: auto; border-radius: 4px; }
.sidebar-brand-divider { width: 2px; align-self: stretch; background: rgba(255,255,255,.3); flex-shrink: 0; margin: 2px 4px; }
.sidebar-brand-app { font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; color: #fff; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #94a3b8;
    text-decoration: none;
    font-size: .9rem;
    transition: all .15s;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-link.active { color: #fff; background: var(--orion-red); border-radius: 0; }
.sidebar-link i { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-badge { font-size: .65rem; min-width: 20px; }
.sidebar-divider { border-color: rgba(255,255,255,.08); margin: 8px 20px; }

/* Sidebar submenu */
.sidebar-submenu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #94a3b8;
    text-decoration: none;
    font-size: .9rem;
    transition: all .15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.sidebar-submenu-toggle:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-submenu-toggle.active { color: #fff; }
.sidebar-submenu-toggle i.bi-chevron-down { font-size: .7rem; margin-left: auto; transition: transform .2s; }
.sidebar-submenu-toggle[aria-expanded="true"] i.bi-chevron-down { transform: rotate(180deg); }
.sidebar-submenu { list-style: none; padding: 0; margin: 0; background: rgba(0,0,0,.15); }
.sidebar-submenu .sidebar-link { padding-left: 52px; font-size: .85rem; }

/* Page content */
.page-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease, width .25s ease;
}
.sidebar.collapsed ~ .page-content { margin-left: 0; width: 100%; }

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.main-content { padding: 24px; flex: 1; }

/* Avatar */
.avatar-sm {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--orion-red);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700;
}

/* Footer */
.app-footer {
    padding: 12px 24px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: #64748b;
}

/* Cards */
.stat-card { border: none; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.stat-card-clickable { transition: transform .15s, box-shadow .15s; cursor: pointer; }
.stat-card-clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }

/* Tables */
.table th { font-weight: 600; font-size: .85rem; color: #64748b; text-transform: uppercase; letter-spacing: .5px; }
.table td { vertical-align: middle; }

/* Badges */
.badge-active   { background: #dcfce7; color: #166534; }
.badge-inactive { background: #f1f5f9; color: #64748b; }
.badge-suspended{ background: #fef2f2; color: #991b1b; }
.badge-pending     { background: #fef3c7; color: #92400e; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-completed   { background: #dcfce7; color: #166534; }

/* Buttons */
.btn-orion { background: var(--orion-red); border-color: var(--orion-red); color: #fff; }
.btn-orion:hover { background: var(--orion-red-dark); border-color: var(--orion-red-dark); color: #fff; }

/* Auth pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--orion-dark) 0%, #0f172a 100%);
    padding: 20px;
}
.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.auth-logo { height: 50px; margin-bottom: 20px; }

/* ===== Calendar Shared ===== */
.calendar-container { min-height: 400px; }

/* Job blocks */
.job-block {
    background: #40e0d0; color: #000; font-size: .75rem; padding: 1px 4px; margin-bottom: 1px;
    cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border-left: 3px solid #20b2aa; line-height: 1.4;
}
.job-block:hover { background: #38cfc0; }
.job-block-timed { white-space: normal; overflow: visible; }
.job-time { font-size: .65rem; color: #333; }

/* Weekend & today */
.cal-weekend { background: #fce4e4 !important; }
th.cal-weekend { background: #f5d0d0 !important; }
.cal-today { background: #fff8e1 !important; }
.cal-today-hdr { color: #dc2626 !important; font-weight: 700; }

/* ===== Month View ===== */
.cal-month {
    width: 100%; border-collapse: collapse; background: #fff;
    table-layout: fixed;
}
.cal-month th {
    border: 1px solid #ddd; padding: 6px; text-align: center;
    font-size: .85rem; font-weight: 700; color: #333; background: #f0f0f0;
}
.cal-month td.cal-cell {
    border: 1px solid #ddd; vertical-align: top; padding: 2px 4px;
    min-height: 100px; height: 120px; width: 14.28%; cursor: pointer;
}
.cal-month td.cal-cell:hover { background: #f5f5f5; }
.cal-month td.cal-empty { background: #fafafa; cursor: default; }
.cal-date-num { font-size: .8rem; font-weight: 600; color: #555; text-align: right; padding-bottom: 2px; }

/* ===== Week View ===== */
.cal-week {
    width: 100%; border-collapse: collapse; background: #fff;
    table-layout: fixed;
}
.cal-week th {
    border: 1px solid #ddd; padding: 8px 4px; text-align: center;
    font-size: .8rem; font-weight: 700; color: #333; background: #f0f0f0;
}
.cal-week th.cal-time-col { width: 50px; }
.cal-week td.cal-time-label {
    border: 1px solid #ddd; border-right: 2px solid #ccc;
    padding: 2px 6px; font-size: .75rem; color: #999;
    text-align: right; vertical-align: top; white-space: nowrap;
    width: 50px; background: #fafafa;
}
.cal-week td.cal-slot {
    border: 1px solid #eee; border-bottom: 1px dashed #e0e0e0;
    vertical-align: top; padding: 1px 2px; height: 40px; cursor: pointer;
    position: relative;
}
.cal-week td.cal-slot:hover { background: #f0f0f0; }

/* ===== Day View ===== */
.cal-day-table {
    width: 100%; border-collapse: collapse; background: #fff;
    table-layout: fixed;
}
.cal-day-table th {
    border: 1px solid #ddd; padding: 10px; text-align: center;
    font-size: .95rem; font-weight: 700; color: #333; background: #f0f0f0;
}
.cal-day-table th.cal-time-col { width: 60px; }
.cal-day-table td.cal-time-label {
    border: 1px solid #ddd; border-right: 2px solid #ccc;
    padding: 4px 8px; font-size: .8rem; color: #999;
    text-align: right; vertical-align: top; white-space: nowrap;
    width: 60px; background: #fafafa;
}
.cal-day-table td.cal-slot {
    border: 1px solid #eee; border-bottom: 1px dashed #e0e0e0;
    vertical-align: top; padding: 2px 6px; height: 40px; cursor: pointer;
}
.cal-day-table td.cal-slot:hover { background: #f0f0f0; }

/* ===== Year View ===== */
.cal-year { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 991px) { .cal-year { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px) { .cal-year { grid-template-columns: 1fr; } }

.cal-year-block { background: #fff; border: 1px solid #ddd; }
.cal-year-title {
    text-align: center; font-weight: 700; font-size: .9rem; color: #333;
    padding: 6px; border-bottom: 1px solid #ddd; cursor: pointer;
}
.cal-year-title:hover { color: #dc2626; background: #fafafa; }
.cal-year-tbl {
    width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .65rem;
}
.cal-year-tbl th {
    border: 1px solid #eee; padding: 2px; text-align: center;
    font-weight: 600; color: #666; background: #f5f5f5; font-size: .6rem;
}
.cal-year-tbl td.cal-ycell {
    border: 1px solid #eee; vertical-align: top; padding: 1px 2px;
    height: 38px; cursor: default;
}
.cal-year-tbl td.cal-empty { background: #fafafa; }
.cal-ydate { font-size: .6rem; font-weight: 600; color: #666; text-align: right; }
.cal-yjob {
    background: #40e0d0; color: #000; font-size: .5rem; padding: 0 2px;
    margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border-left: 2px solid #20b2aa; line-height: 1.3;
}
.cal-yjob-more { font-size: .5rem; color: #999; }

/* Job hover popover */
.job-popover {
    position: fixed;
    z-index: 1060;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    padding: 12px 16px;
    min-width: 240px;
    max-width: 300px;
    font-size: .85rem;
    pointer-events: none;
}
.job-popover-ref { font-weight: 700; color: var(--orion-red); margin-bottom: 4px; }
.job-popover-title { margin-bottom: 6px; color: #222; }
.job-popover-row { margin-bottom: 2px; color: #555; }
.job-popover-label { font-weight: 600; color: #333; }
.job-popover .badge { font-size: .7rem; }

/* Responsive */
@media (max-width: 991px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
    .sidebar.show { transform: translateX(0); }
    .page-content { margin-left: 0; width: 100%; }
}
