/* ----------------------------------------------------------
   Base
---------------------------------------------------------- */
body {
    margin: 0;
    background-color: #f0f2f5;
}

/* ----------------------------------------------------------
   App chrome � topbar + main content card
---------------------------------------------------------- */
.app-topbar {
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    padding: .5rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-brand {
    font-size: 1.3rem;
    color: #212529;
    text-decoration: none;
    line-height: 1;
}

.app-brand:hover {
    color: #555;
    text-decoration: none;
}

/* Remove default form margin on the logout form inside the topbar */
.topbar-logout {
    margin: 0;
}

/* Username label � hidden on mobile */
.topbar-username {
    display: inline;
}

.app-content {
    background: #fff;
    border-radius: .4rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    padding: 1.75rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

/* ----------------------------------------------------------
   Page layout primitives
---------------------------------------------------------- */

/* Narrow centred wrappers */
.page-narrow   { max-width: 400px; margin: 0 auto; }
.page-form     { max-width: 500px; margin: 0 auto; }
.page-centered { max-width: 420px; margin: 0 auto; text-align: center; }

/* Title row: heading left, action buttons right */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1.25rem;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}

/* Page h2 � scales down on mobile */
.page-heading {
    margin: 0;
    font-size: 1.5rem;    font-weight: 600;}

/* Secondary quick-nav row (Schedule / Records / Unavailability �)
   Hidden on mobile � those items appear in the bottom nav bar. */
.page-quicknav {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1rem;
}

/* Week prev / current / next navigation bar */
.week-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1.5rem;
}

/* Web week-nav range: day stacked over date, dash between */
.week-nav-range {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.week-nav-from,
.week-nav-to {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.week-nav-day {
    font-size: .78rem;
    font-weight: 700;
}

.week-nav-date {
    font-size: .78rem;
    font-weight: 400;
    color: #6c757d;
}

.week-nav-dash {
    display: block;
    width: 1.05rem;
    height: 1.5px;
    background: #212529;
    border-radius: 1px;
    flex-shrink: 0;
    align-self: center;
}

/* ----------------------------------------------------------
   Component: Clock in / out button
---------------------------------------------------------- */
.clock-btn {
    padding: 18px;
    font-size: 1.2rem;
}

/* Tiny coloured dot beside "Clocked in since �" */
.clocked-dot {
    font-size: .5rem;
    vertical-align: middle;
}

/* ----------------------------------------------------------
   Component: Link-code display (large monospace code)
---------------------------------------------------------- */
.link-code {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: .3em;
    font-family: monospace;
}

/* ----------------------------------------------------------
   Component: Large icons
---------------------------------------------------------- */
.icon-xl          { font-size: 2.5rem; }
.icon-placeholder { font-size: 3rem; color: #adb5bd; }
.icon-qr-result   { font-size: 3.5rem; }

/* ----------------------------------------------------------
   Component: Time display � AM/PM superscript
---------------------------------------------------------- */
.time-ampm { font-size: .65em; }

/* ----------------------------------------------------------
   Component: Shift-assignment badges row
---------------------------------------------------------- */
.shift-assignments {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: .5rem;
}

/* ----------------------------------------------------------
   Component: Availability grid (employer day-by-day overview)
---------------------------------------------------------- */
.avail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.avail-day {
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    min-width: 110px;
    flex: 1;
}

.avail-day-header {
    border-bottom: 1px solid #dee2e6;
    padding: .4rem .75rem;
    background: #f8f9fa;
    border-radius: .375rem .375rem 0 0;
}

.avail-day-body {
    padding: .5rem .75rem;
    min-height: 2.5rem;
}

/* ----------------------------------------------------------
   Component: Shift-request approve / deny action column
---------------------------------------------------------- */
.shift-request-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 200px;
}

/* ----------------------------------------------------------
   Component: Large role buttons (choose_role page)
---------------------------------------------------------- */
.role-btn {
    padding: 16px;
    font-size: 1.15rem;
}

/* ----------------------------------------------------------
   Utility: flex gap  (Bootstrap 4 has no gap utilities)
---------------------------------------------------------- */
.flex-gap-xs { gap: .35rem; }
.flex-gap-sm { gap: .5rem; }
.flex-gap-md { gap: 1rem; }

/* ----------------------------------------------------------
   Component: Assignment badge (employee name pill in schedule)
---------------------------------------------------------- */
.assignment-badge {
    display: inline-flex;
    align-items: center;
    background-color: #6c757d;
    color: #fff;
    border-radius: 2rem;
    font-size: .78rem;
    padding: .2rem .3rem .2rem .65rem;
    gap: .25rem;
    line-height: 1.4;
}

.assignment-badge form {
    display: contents;
}

.assignment-badge .remove-btn {
    background: rgba(0,0,0,.18);
    border: none;
    border-radius: 50%;
    width: 1.2rem;
    height: 1.2rem;
    padding: 0;
    color: #fff;
    cursor: pointer;
    font-size: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.assignment-badge .remove-btn:hover {
    background: rgba(0,0,0,.35);
}

/* ----------------------------------------------------------
   Component: Role selection cards (signup page)
---------------------------------------------------------- */
.role-card {
    cursor: pointer;
    flex: 1;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    transition: border-color .15s, background .15s;
}

.role-card:hover {
    border-color: #adb5bd;
    background: #f8f9fa;
}

input[type=radio]:checked + .role-card,
.role-card:has(input[type=radio]:checked) {
    border-color: #007bff;
    background: #e8f0fe;
}

.role-card-icon { font-size: 1.4rem; }
.role-card-hint { font-size: .8rem; }

/* ----------------------------------------------------------
   Form inputs rendered by allauth without explicit CSS classes
---------------------------------------------------------- */
input[type=text]:not([class]),
input[type=password]:not([class]),
input[type=email]:not([class]) {
    display: block;
    width: 100%;
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .375rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

input[type=text]:not([class]):focus,
input[type=password]:not([class]):focus,
input[type=email]:not([class]):focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 .2rem rgba(0,123,255,.25);
}

/* ----------------------------------------------------------
   Phone mode  (body.mode-phone added by JS on user choice)
   All phone-specific layout lives here.
---------------------------------------------------------- */
body.mode-phone .app-content {
    padding: 1.1rem;
    margin-top: .75rem;
    margin-bottom: 1rem;
}

body.mode-phone .container {
    padding-left: .75rem;
    padding-right: .75rem;
}

body.mode-phone .card-header.d-flex {
    flex-wrap: wrap;
    gap: .3rem;
}

/* Scale down page headings */
body.mode-phone .page-heading { font-size: 1.05rem !important; font-weight: 600; }

/* Any element flagged as desktop-only */
body.mode-phone .d-mobile-none { display: none !important; }

/* Shift-request actions stack full-width */
body.mode-phone .shift-request-actions {
    align-items: stretch;
    min-width: 0;
    width: 100%;
    margin-top: .75rem;
}

/* Week navigation: Prev | [date centred] | Next — no wrapping */
body.mode-phone .week-nav {
    justify-content: space-between;
    flex-wrap: nowrap;
    align-items: center;
    gap: .25rem;
}
/* Hide Current button — no room */
body.mode-phone .week-nav-current { display: none; }
/* Date block grows to fill the middle */
body.mode-phone .week-nav-range {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
}
/* Each date side stacks day-name over date-number */
body.mode-phone .week-nav-from,
body.mode-phone .week-nav-to {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}
body.mode-phone .week-nav-day {
    font-size: .78rem;
    font-weight: 700;
}
body.mode-phone .week-nav-date {
    font-size: .72rem;
    font-weight: 400;
    color: #6c757d;
}
body.mode-phone .week-nav-dash {
    display: block;
    width: 1.05rem;
    height: 1.5px;
    background: #212529;
    border-radius: 1px;
    flex-shrink: 0;
    align-self: center;
}

/* Table cells: prevent wrapping inside cells.
   table-responsive handles horizontal scroll cleanly. */
body.mode-phone .table-responsive td,
body.mode-phone .table-responsive th {
    white-space: nowrap;
    font-size: .82rem;
    padding: .35rem .5rem;
}

/* Card headers with date + controls: let the date shrink, don't let it wrap */
body.mode-phone .card-header strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

/* ----------------------------------------------------------
   Responsive � large screens (= 1400 px)
   Widen the Bootstrap 4 container cap.
---------------------------------------------------------- */
@media (min-width: 1400px) {
    .container { max-width: 1320px; }
}

/* ----------------------------------------------------------
   Toast notifications
---------------------------------------------------------- */
#msg-toast-wrap {
    position: fixed;
    bottom: 5.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    pointer-events: none;
}

.msg-toast {
    padding: .55rem 1.1rem;
    border-radius: 2rem;
    font-size: .875rem;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
    opacity: 1;
    transition: opacity .35s ease;
    white-space: nowrap;
    pointer-events: none;
}

/* tag classes Django adds */
.msg-toast-success  { background: #198754; color: #fff; }
.msg-toast-info     { background: #0dcaf0; color: #000; }
.msg-toast-warning  { background: #ffc107; color: #000; }
.msg-toast-error    { background: #dc3545; color: #fff; }
/* allauth uses plain class names without prefix */
.msg-toast-         { background: #6c757d; color: #fff; }

@media (max-width: 767px) {
    /* Topbar: hide username text and "Log out" label — just show the icon */
    .topbar-username { display: none; }
    .topbar-logout-label { display: none; }
}

@media (min-width: 1700px) {
    .container { max-width: 1600px; }
}

/* ----------------------------------------------------------
   Bottom nav - hidden by default; shown only in phone mode
---------------------------------------------------------- */
.bottom-nav { display: none; }

/* ----------------------------------------------------------
   Phone mode  (body.mode-phone added by JS on page load)
   All phone-specific layout lives here.
---------------------------------------------------------- */
body.mode-phone .app-content {
    padding: 1.1rem;
    margin-top: .75rem;
    margin-bottom: 1rem;
}

body.mode-phone .container {
    padding-left: .75rem;
    padding-right: .75rem;
    /* Clear the fixed bottom nav (56px tab area + 8px padding + safe area) */
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

body.mode-phone .card-header.d-flex {
    flex-wrap: wrap;
    gap: .3rem;
}

/* Scale down page headings */
body.mode-phone .page-heading { font-size: 1.05rem !important; font-weight: 600; }

/* Quick-nav row hidden - its links live in the bottom nav */
body.mode-phone .page-quicknav { display: none; }

/* Any element flagged as desktop-only */
body.mode-phone .d-mobile-none { display: none !important; }

/* Shift-request actions stack full-width */
body.mode-phone .shift-request-actions {
    align-items: stretch;
    min-width: 0;
    width: 100%;
    margin-top: .75rem;
}

/* Week navigation: Prev | [date centred] | Next — no wrapping */
body.mode-phone .week-nav {
    justify-content: space-between;
    flex-wrap: nowrap;
    align-items: center;
    gap: .25rem;
}
/* Hide Current button — no room */
body.mode-phone .week-nav-current { display: none; }
/* Date block grows to fill the middle */
body.mode-phone .week-nav-range {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
}
/* Each date side stacks day-name over date-number */
body.mode-phone .week-nav-from,
body.mode-phone .week-nav-to {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}
body.mode-phone .week-nav-day {
    font-size: .78rem;
    font-weight: 700;
}
body.mode-phone .week-nav-date {
    font-size: .72rem;
    font-weight: 400;
    color: #6c757d;
}
body.mode-phone .week-nav-dash {
    display: block;
    width: 1.05rem;
    height: 1.5px;
    background: #212529;
    border-radius: 1px;
    flex-shrink: 0;
    align-self: center;
}

/* Table cells: prevent wrapping inside cells */
body.mode-phone .table-responsive td,
body.mode-phone .table-responsive th {
    white-space: nowrap;
    font-size: .82rem;
    padding: .35rem .5rem;
}

/* Card headers with date + controls: let the date shrink, don't wrap */
body.mode-phone .card-header strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

/* Bottom navigation bar
   Standard mobile tab bar: 56px touch area, icon + label, accent on active. */
body.mode-phone .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: 6px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: #ffffff;
    box-shadow: 0 -1px 0 rgba(0,0,0,.1), 0 -4px 16px rgba(0,0,0,.06);
    z-index: 1000;
    align-items: stretch;
}

body.mode-phone .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 4px 0;
    text-decoration: none;
    color: #868e96;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    border-top: 2px solid transparent;
    transition: color .12s ease, border-color .12s ease;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
}

body.mode-phone .bottom-nav-item i {
    font-size: 22px;
    line-height: 1;
    display: block;
}

body.mode-phone .bottom-nav-item span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

body.mode-phone .bottom-nav-item.active {
    color: #0d6efd;
    border-top-color: #0d6efd;
    font-weight: 700;
    text-decoration: none;
}

body.mode-phone .bottom-nav-item:active {
    color: #0d6efd;
    text-decoration: none;
}
