/* ===========================
   WorkForce Pro — Global Styles
   =========================== */

:root {
    --primary: #0f172a;
    --secondary: #1e293b;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-light: #f8fafc;
    --text-dim: #94a3b8;
    --border: #334155;
    --card-bg: #1e293b;
    --bg-body: #020617;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg-body);
    color: var(--text-light);
    min-height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ---- LOGIN ---- */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-body);
}

.login-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 380px;
}

.login-logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.login-sub {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 28px;
}

.login-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 6px;
    display: block;
}

.login-input {
    width: 100%;
    background: var(--secondary);
    border: 1px solid var(--border);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.login-input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-btn {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.login-btn:hover {
    background: var(--accent-hover);
}

.login-hint {
    margin-top: 18px;
    padding: 12px;
    background: var(--secondary);
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.7;
}

.login-error {
    color: var(--danger);
    font-size: 0.82rem;
    margin-bottom: 10px;
    display: none;
}

/* ---- APP SHELL ---- */
#app-shell {
    display: none;
    flex: 1;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    flex-direction: column;
}

.top-nav {
    background: var(--primary);
    border-bottom: 1px solid var(--border);
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    justify-content: space-between;
    flex-shrink: 0;
}

.brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
}

.logout-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.app-body {
    display: flex;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

/* ---- SIDEBAR ---- */
aside {
    width: 240px;
    background: var(--primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    flex-shrink: 0;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 12px 10px 4px;
}

nav button {
    background: none;
    border: none;
    color: var(--text-dim);
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    margin-bottom: 2px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 9px;
    transition: all 0.2s;
}

nav button:hover {
    background: var(--secondary);
    color: var(--text-light);
}

nav button.active {
    background: var(--secondary);
    color: var(--text-light);
    border-left: 3px solid var(--accent);
}

nav button .nav-icon {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

/* ---- MAIN ---- */
main {
    flex: 1 1 auto;
    width: calc(100vw - 240px);
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-body);
}

.view-section {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 14px;
}

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--card-bg);
    padding: 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat-card h3 {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.stat-card .val {
    font-size: 1.9rem;
    font-weight: 700;
}

.stat-card .val.accent {
    color: var(--accent);
}

.stat-card .val.success {
    color: var(--success);
}

.stat-card .val.warning {
    color: var(--warning);
}

.stat-card .val.danger {
    color: var(--danger);
}

.stat-delta {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.shift-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-dim);
    font-size: 0.72rem;
    margin-top: 8px;
}

.shift-progress {
    height: 8px;
    margin-top: 7px;
    margin-bottom: 0;
}

/* ---- CARDS ---- */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 18px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- GRID HELPERS ---- */
.grid-2 {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.grid-3 {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

/* ---- BADGES ---- */
.badge {
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-accent {
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent);
}

.badge-dim {
    background: var(--secondary);
    color: var(--text-dim);
}

/* ---- BUTTONS ---- */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

/* ---- TABLE ---- */
.table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead th {
    background: var(--secondary);
    color: var(--text-dim);
    padding: 10px 14px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

tbody td {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    vertical-align: middle;
}

tbody tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* ---- PROGRESS BAR ---- */
.progress-bar {
    height: 6px;
    background: var(--secondary);
    border-radius: 3px;
    overflow: hidden;
    margin: 6px 0;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .4s;
    background: var(--accent);
}

.progress-fill.warn {
    background: var(--warning);
}

.progress-fill.full {
    background: var(--danger);
}

/* ---- MISC COMPONENTS ---- */
.skill-tag {
    background: var(--secondary);
    color: var(--text-dim);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.75rem;
    display: inline-block;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 18px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
}

.profile-info h2 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.profile-info p {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.profile-detail {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 0;
    border-top: 1px solid var(--secondary);
    font-size: 0.86rem;
}

.profile-detail span {
    color: var(--text-dim);
}

.profile-detail strong {
    text-align: right;
    font-weight: 600;
}

.profile-skill {
    background: rgba(14, 165, 233, .15);
    color: var(--accent);
    padding: 5px 10px;
}

/* ---- NOTIFICATIONS ---- */
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.notif-text {
    font-size: 0.85rem;
}

.notif-time {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.alert-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 13px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    margin-bottom: 10px;
}

.alert-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 800;
}

.alert-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.alert-desc {
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.45;
}

.alert-urgent {
    border-color: rgba(239, 68, 68, .42);
    background: rgba(239, 68, 68, .075);
}

.alert-urgent .alert-icon {
    background: rgba(239, 68, 68, .18);
    color: var(--danger);
}

.alert-urgent .alert-title {
    color: #fecaca;
}

.alert-warning {
    border-color: rgba(245, 158, 11, .42);
    background: rgba(245, 158, 11, .08);
}

.alert-warning .alert-icon {
    background: rgba(245, 158, 11, .18);
    color: var(--warning);
}

.alert-warning .alert-title {
    color: #fde68a;
}

.alert-info {
    border-color: rgba(14, 165, 233, .38);
    background: rgba(14, 165, 233, .075);
}

.alert-info .alert-icon {
    background: rgba(14, 165, 233, .18);
    color: var(--accent);
}

.alert-info .alert-title {
    color: #bae6fd;
}

/* ---- TASKS ---- */
.task-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--secondary);
    font-size: 0.85rem;
}

.task-row:last-child {
    border-bottom: none;
}

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* ---- TOGGLE SWITCH ---- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--secondary);
    transition: .3s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background: var(--success);
}

input:checked+.slider:before {
    transform: translateX(18px);
}

/* ---- WORKLOAD ---- */
.workload-emp {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--secondary);
    font-size: 0.82rem;
}

.workload-emp:last-child {
    border-bottom: none;
}

.workload-name {
    width: 120px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workload-bar-wrap {
    flex: 1;
}

.workload-pct {
    width: 36px;
    text-align: right;
    color: var(--text-dim);
}

/* ---- LIVE MONITOR ---- */
.monitor-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.monitor-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .5;
        transform: scale(1.3);
    }
}

/* ---- TOAST ---- */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.toast {
    background: var(--card-bg);
    border-left: 4px solid var(--accent);
    color: var(--text-light);
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
    font-size: 0.85rem;
    min-width: 240px;
    animation: slideIn .3s;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ---- ATTENDANCE CALENDAR ---- */
.calendar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.attendance-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(74px, 1fr));
    gap: 8px;
}

.att-weekday {
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-align: center;
    padding: 4px 0;
}

.att-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.att-day {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: default;
}

.attendance-calendar .att-day {
    width: auto;
    height: auto;
    min-height: 66px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--secondary);
    padding: 8px;
    align-items: stretch;
    flex-direction: column;
    justify-content: space-between;
    font-size: inherit;
}

.attendance-calendar .att-day span {
    font-weight: 700;
    font-size: 0.88rem;
}

.attendance-calendar .att-day small {
    font-size: 0.67rem;
    color: var(--text-dim);
    text-transform: capitalize;
}

.att-empty {
    visibility: hidden;
}

.att-present {
    background: rgba(16, 185, 129, .28);
    border-color: rgba(16, 185, 129, .62);
    color: #6ee7b7;
}

.att-absent {
    background: rgba(239, 68, 68, .24);
    border-color: rgba(239, 68, 68, .58);
    color: #fecaca;
}

.att-weekend {
    background: rgba(148, 163, 184, .08);
    color: var(--text-dim);
    opacity: .78;
}

.att-leave {
    background: rgba(239, 68, 68, .24);
    border-color: rgba(239, 68, 68, .58);
    color: #fecaca;
}

.att-future {
    background: rgba(148, 163, 184, .08);
    color: var(--text-dim);
    opacity: .65;
}

.attendance-calendar .att-present {
    background: rgba(16, 185, 129, .28);
    border-color: rgba(16, 185, 129, .62);
    color: #6ee7b7;
}

.attendance-calendar .att-absent {
    background: rgba(239, 68, 68, .24);
    border-color: rgba(239, 68, 68, .58);
    color: #fecaca;
}

.attendance-calendar .att-weekend {
    background: rgba(148, 163, 184, .08);
    color: var(--text-dim);
    opacity: .78;
}

.attendance-calendar .att-future {
    background: rgba(148, 163, 184, .08);
    color: var(--text-dim);
    opacity: .65;
}

@media (max-width: 760px) {
    .calendar-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .attendance-calendar {
        grid-template-columns: repeat(7, minmax(38px, 1fr));
        gap: 5px;
    }

    .attendance-calendar .att-day {
        min-height: 48px;
        padding: 6px;
    }

    .attendance-calendar .att-day small {
        display: none;
    }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ---- FORM INPUTS ---- */
select,
input[type=text],
input[type=date] {
    background: var(--secondary);
    border: 1px solid var(--border);
    color: white;
    padding: 7px 11px;
    border-radius: 6px;
    font-size: 0.85rem;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ---- LAYOUT UTILS ---- */
.section-gap {
    margin-bottom: 20px;
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
