/**
 * FL Teknik - Kiosk Mode Styles
 * v1.14.0 - PIN-pad removed, subtask styles removed,
 *           added correction modals, deviation modal, absence-flow, fravaer-kort-knap
 *
 * @package FL_Teknik_Tidsregistrering
 * @author Sascha Marc Rahn - KodeStudio
 */

/* ========================================
   KIOSK LAYOUT
   ======================================== */

.flt-kiosk-body {
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.flt-kiosk-screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
}

.flt-kiosk-screen.active {
    display: flex;
}

/* ========================================
   HEADER
   ======================================== */

.flt-kiosk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    background: var(--flt-bg-secondary);
    border-bottom: 1px solid var(--flt-border);
    flex-shrink: 0;
}

.flt-kiosk-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.flt-kiosk-logo img {
    height: 42px;
    width: auto;
    display: block;
}

.flt-kiosk-clock {
    font-family: var(--flt-font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--flt-text-primary);
    letter-spacing: 2px;
}

.flt-kiosk-date {
    font-size: 14px;
    color: var(--flt-text-secondary);
}

.flt-employee-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flt-employee-name {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ========================================
   CONTENT
   ======================================== */

.flt-kiosk-content {
    flex: 1;
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.flt-kiosk-title {
    text-align: center;
    font-size: 1.3rem;
    color: var(--flt-text-secondary);
    margin-bottom: 32px;
    font-weight: 500;
}

/* ========================================
   EMPLOYEE GRID (selection screen)
   v1.14.0: each grid-item is now a wrapper (.flt-employee-cell) containing the
   clickable card PLUS a full-width "Meld fravaer"-pill beneath it.
   ======================================== */

.flt-employee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

/* Wrapper for each employee cell - stacks card (flexing to fill row height)
   + absence-button (fixed height) vertically. Using grid with auto 1fr rows
   means all cards in the grid-row align to the tallest card, and the absence-
   buttons below them all align because they share the same fixed track height. */
.flt-employee-cell {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 8px;
    align-items: stretch;
}

.flt-employee-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 20px;
    background: var(--flt-bg-secondary);
    border: 2px solid var(--flt-border);
    border-radius: var(--flt-radius-lg);
    cursor: pointer;
    transition: all var(--flt-transition);
    text-align: center;
    min-height: 160px;   /* raised from 120px so the card looks balanced even when
                             the mechanic has no status text below the name */
    height: 100%;         /* stretch to fill the grid row so all cards in a row match */
    box-sizing: border-box;
}

.flt-employee-card:hover {
    background: var(--flt-bg-tertiary);
    border-color: var(--flt-border-light);
    transform: translateY(-2px);
    box-shadow: var(--flt-shadow-md);
}

.flt-employee-card:active {
    transform: translateY(0);
}

.flt-employee-card .flt-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--flt-bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--flt-text-secondary);
    border: 2px solid var(--flt-border-light);
}

.flt-employee-card .flt-emp-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--flt-text-primary);
}

.flt-employee-card.clocked-in {
    border-color: var(--flt-clocked-in);
}

.flt-employee-card.clocked-in .flt-avatar {
    border-color: var(--flt-clocked-in);
    box-shadow: 0 0 12px rgba(74, 157, 110, 0.3);
}

.flt-employee-card.on-break {
    border-color: var(--flt-on-break);
}

.flt-employee-card.on-break .flt-avatar {
    border-color: var(--flt-on-break);
}

.flt-emp-status-text {
    font-size: 11px;
    color: var(--flt-text-muted);
    font-weight: 500;
}

/* v1.14.0 J.1 (revised): absence-button rendered BELOW the card as a full-width
   pill, not inside the card. This avoids any risk of accidentally clock-in-triggering
   when the mechanic aims for the absence-button, and gives the pill more room for
   a clear label on narrow screens. The pill uses a muted red tint so it's visually
   recognised as a secondary "report illness/time off" action. */
.flt-emp-card-absence-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 14px;
    background: rgba(230, 57, 70, 0.08);
    border: 1px solid rgba(230, 57, 70, 0.35);
    color: var(--flt-danger);
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--flt-transition);
    font-family: inherit;
    box-sizing: border-box;
}

.flt-emp-card-absence-btn:hover {
    background: rgba(230, 57, 70, 0.16);
    border-color: var(--flt-danger);
}

.flt-emp-card-absence-btn:active {
    transform: scale(0.98);
}

.flt-emp-card-absence-icon {
    font-size: 14px;
    line-height: 1;
}

.flt-emp-card-absence-text {
    white-space: nowrap;
}

/* ========================================
   DIALOG OVERLAY (generic - used by all modals)
   v1.14.0: this class name is kept for backwards-compat with the existing
   markup. Originally used for the PIN overlay; now used for all modals.
   ======================================== */

.flt-kiosk-pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.flt-pin-dialog {
    background: var(--flt-bg-secondary);
    border: 1px solid var(--flt-border);
    border-radius: var(--flt-radius-xl);
    padding: 40px;
    text-align: center;
    box-shadow: var(--flt-shadow-lg);
    min-width: 340px;
}

.flt-pin-dialog h3 {
    font-size: 1.2rem;
    margin-bottom: 24px;
    color: var(--flt-text-primary);
}

/* ========================================
   CLOCK CONTROLS
   ======================================== */

.flt-kiosk-clock-controls {
    text-align: center;
    padding: 24px 0;
}

/* ========================================
   JOB LIST (kiosk)
   ======================================== */

.flt-job-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flt-job-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--flt-bg-secondary);
    border: 1px solid var(--flt-border);
    border-radius: var(--flt-radius-md);
    transition: all var(--flt-transition);
}

.flt-job-item:hover {
    border-color: var(--flt-border-light);
    background: var(--flt-bg-tertiary);
}

.flt-job-item-info {
    flex: 1;
}

.flt-job-item-number {
    font-family: var(--flt-font-mono);
    font-size: 13px;
    color: var(--flt-text-muted);
}

.flt-job-item-title {
    font-weight: 600;
    font-size: 16px;
    margin-top: 2px;
}

.flt-job-item-meta {
    font-size: 13px;
    color: var(--flt-text-secondary);
    margin-top: 4px;
}

.flt-job-item-actions {
    flex-shrink: 0;
    margin-left: 16px;
}

/* ========================================
   KIOSK DIALOG (create job etc.)
   ======================================== */

.flt-kiosk-dialog {
    background: var(--flt-bg-secondary);
    border: 1px solid var(--flt-border);
    border-radius: var(--flt-radius-lg);
    padding: 32px;
    width: 90vw;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

.flt-kiosk-dialog-wide {
    max-width: 620px;
}

.flt-kiosk-dialog h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

/* Wizard steps indicator */
.flt-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.flt-step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--flt-text-muted);
    background: var(--flt-bg-tertiary);
}

.flt-step.active {
    color: #fff;
    background: var(--flt-accent);
}

.flt-step.done {
    color: var(--flt-success);
    background: var(--flt-bg-tertiary);
}

.flt-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255,255,255,0.15);
}

/* Wizard step panels */
.flt-wizard-step {
    display: none;
}

.flt-wizard-step.active {
    display: block;
}

.flt-wizard-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
}

/* Form rows for kiosk */
.flt-kiosk-dialog .flt-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Divider */
.flt-divider {
    display: flex;
    align-items: center;
    margin: 20px 0 16px;
    gap: 12px;
}

.flt-divider::before,
.flt-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--flt-border);
}

.flt-divider span {
    font-size: 12px;
    color: var(--flt-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Selected card (customer/vehicle chosen) */
.flt-selected-card {
    background: var(--flt-bg-elevated);
    border: 1px solid var(--flt-success);
    border-radius: var(--flt-radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.flt-selected-name {
    font-weight: 700;
    font-size: 15px;
    flex: 1;
}

.flt-selected-details {
    font-size: 12px;
    color: var(--flt-text-muted);
    flex: 1;
}

/* Summary bar */
.flt-summary-bar {
    background: var(--flt-bg-elevated);
    border: 1px solid var(--flt-border-light);
    border-radius: var(--flt-radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.flt-summary-bar strong {
    color: var(--flt-text-primary);
}

.flt-kiosk-dialog .flt-form-group,
.flt-pin-dialog .flt-form-group {
    margin-bottom: 16px;
}

.flt-kiosk-dialog .flt-label,
.flt-pin-dialog .flt-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    color: var(--flt-text-secondary);
    text-align: left;
}

.flt-kiosk-dialog .flt-input,
.flt-kiosk-dialog .flt-select,
.flt-pin-dialog .flt-input,
.flt-pin-dialog .flt-select {
    font-size: 16px;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
}

/* Search dropdown */
.flt-search-wrapper {
    position: relative;
}

.flt-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--flt-bg-elevated);
    border: 1px solid var(--flt-border-light);
    border-radius: 0 0 var(--flt-radius-sm) var(--flt-radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--flt-shadow-lg);
}

.flt-search-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--flt-border);
    font-size: 15px;
    transition: background var(--flt-transition);
}

.flt-search-item:hover {
    background: var(--flt-bg-tertiary);
}

.flt-search-item:last-child {
    border-bottom: none;
}

.flt-search-item .flt-search-sub {
    font-size: 12px;
    color: var(--flt-text-muted);
    margin-top: 2px;
}

.flt-search-item.flt-search-create {
    color: var(--flt-success);
    font-weight: 600;
}

/* ========================================
   TIMEOUT BAR (inactivity warning)
   ======================================== */

.flt-timeout-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--flt-bg-tertiary);
    z-index: 9998;
}

.flt-timeout-progress {
    height: 100%;
    width: 100%;
    background: var(--flt-warning);
    transition: width 0.1s linear;
}

/* ========================================
   CLOCK BUTTONS CENTER
   ======================================== */

.flt-clock-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ========================================
   HEADER RIGHT
   ======================================== */

.flt-header-right {
    text-align: right;
}

/* ========================================
   ASSIGNMENT NOTIFICATION BANNER
   ======================================== */

.flt-assign-banner {
    background: var(--flt-warning-bg);
    border-bottom: 2px solid var(--flt-warning);
    padding: 12px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    color: var(--flt-warning);
    animation: flt-slide-down 0.3s ease;
}

@keyframes flt-slide-down {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes flt-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* ========================================
   AUTO-EXIT COUNTDOWN BANNER (v1.12.0)
   ======================================== */

.flt-autoexit-banner {
    background: rgba(59, 130, 246, 0.12);
    border-bottom: 2px solid var(--flt-accent);
    padding: 12px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--flt-accent);
    animation: flt-slide-down 0.3s ease;
}

.flt-autoexit-banner .flt-autoexit-text {
    flex: 1;
}

.flt-autoexit-banner .flt-autoexit-text strong {
    font-family: var(--flt-font-mono);
    font-size: 17px;
    padding: 0 4px;
    color: var(--flt-warning);
    min-width: 24px;
    display: inline-block;
    text-align: center;
}

.flt-autoexit-banner .flt-btn-sm {
    padding: 8px 18px;
    font-size: 13px;
    flex-shrink: 0;
}

.flt-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.flt-btn-outline {
    background: transparent;
    border: 2px solid var(--flt-border);
    color: var(--flt-text-primary);
}
.flt-btn-outline:hover {
    border-color: var(--flt-accent);
    color: var(--flt-accent);
    background: rgba(59, 130, 246, 0.05);
}

/* ========================================
   v1.10.0 - Next-action modal + Job-picker modal
   ======================================== */

.flt-nextaction-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 8px;
}
@media (min-width: 720px) {
    .flt-nextaction-grid { grid-template-columns: repeat(2, 1fr); }
}

.flt-nextaction-btn {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 16px !important;
    min-height: 140px;
    text-align: center;
    line-height: 1.3;
    border-radius: 14px !important;
}
.flt-na-icon {
    font-size: 38px;
    line-height: 1;
    margin-bottom: 4px;
}
.flt-na-label {
    font-size: 18px;
    font-weight: 700;
}
.flt-na-sub {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 2px;
}

.flt-jobpicker-list {
    border: 1px solid var(--flt-border);
    border-radius: 10px;
    background: var(--flt-bg-tertiary);
    padding: 8px;
    margin-top: 8px;
    margin-bottom: 12px;
    max-height: 50vh;
}
.flt-jobpicker-item {
    transition: background 0.12s, transform 0.08s;
    border: 1px solid transparent;
}
.flt-jobpicker-item:hover {
    background: var(--flt-bg-elevated);
    border-color: var(--flt-accent);
}
.flt-jobpicker-item:active {
    transform: scale(0.98);
}
.flt-jp-pick-arrow {
    font-size: 24px;
    color: var(--flt-accent);
    padding: 0 12px;
    font-weight: 700;
}

/* ========================================
   v1.14.0 - CORRECTION DIALOGS
   Shared styles for missed-clockout + missing-day + deviation modals.
   ======================================== */

.flt-correction-dialog {
    text-align: left;
}
.flt-correction-dialog h3 {
    text-align: center;
}

.flt-correction-field {
    margin-bottom: 12px;
}

.flt-correction-quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.flt-correction-quick-grid .flt-btn {
    padding: 10px 8px;
    font-family: var(--flt-font-mono);
    font-size: 15px;
    font-weight: 600;
}

/* ========================================
   v1.14.0 - MISSING-DAY 3-CHOICE GRID
   ======================================== */

.flt-md-choice-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 8px;
}

.flt-md-choice-btn {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 18px 16px !important;
    min-height: 100px;
    text-align: center;
    line-height: 1.25;
    border-radius: 12px !important;
}

.flt-md-choice-icon {
    font-size: 32px;
    line-height: 1;
    margin-bottom: 2px;
}

.flt-md-choice-label {
    font-size: 17px;
    font-weight: 700;
}

.flt-md-choice-sub {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
}

/* ========================================
   v1.14.0 - ABSENCE FLOW (3 steps)
   ======================================== */

.flt-absence-dialog {
    position: relative;
    text-align: left;
}

.flt-absence-dialog h3 {
    text-align: center;
}

.flt-af-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--flt-border);
    background: var(--flt-bg-elevated);
    color: var(--flt-text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--flt-transition);
}

.flt-af-close-btn:hover {
    background: var(--flt-danger);
    color: #fff;
    border-color: var(--flt-danger);
}

.flt-af-type-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 8px;
    max-height: 55vh;
    overflow-y: auto;
}
@media (min-width: 520px) {
    .flt-af-type-grid { grid-template-columns: 1fr 1fr; }
}

.flt-af-type-btn {
    text-align: left !important;
    padding: 16px 20px !important;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px !important;
    justify-content: flex-start !important;
}

.flt-af-field-group {
    margin-bottom: 16px;
}

.flt-af-field-group .flt-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--flt-text-secondary);
}

.flt-af-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--flt-bg-elevated);
    border: 1px solid var(--flt-border);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: all var(--flt-transition);
}

.flt-af-radio:hover {
    background: var(--flt-bg-tertiary);
    border-color: var(--flt-border-light);
}

.flt-af-radio input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.flt-af-summary-box {
    background: var(--flt-bg-elevated);
    border: 1px solid var(--flt-border-light);
    border-radius: 10px;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 8px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .flt-kiosk-header {
        padding: 16px 20px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .flt-kiosk-clock {
        font-size: 1.5rem;
    }

    .flt-kiosk-content {
        padding: 20px 16px;
    }

    .flt-employee-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .flt-employee-card {
        padding: 20px 16px;
        min-height: 100px;
    }

    .flt-emp-card-absence-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .flt-btn-xl {
        padding: 18px 24px;
        font-size: 18px;
        min-height: 60px;
    }

    .flt-timer-lg {
        font-size: 2.5rem;
    }

    .flt-pin-dialog {
        min-width: auto;
        width: 92vw;
        padding: 24px;
    }

    .flt-correction-quick-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .flt-employee-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
