/*
|--------------------------------------------------------------------------
| Dunk River Industries Timesheet Kiosk
|--------------------------------------------------------------------------
*/

:root {
    --accent: #00b7ff;
    --accent-dark: #0095cc;

    --background: #0d0f12;
    --panel: #181b20;
    --panel-light: #22262d;
    --panel-hover: #292e36;

    --text: #f4f4f4;
    --text-muted: #a9afb8;
    --border: #363b44;

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #dc2626;
    --danger-dark: #991b1b;

    --shadow:
        0 18px 45px
        rgba(0, 0, 0, 0.28);

    --radius-small: 6px;
    --radius: 10px;
    --radius-large: 16px;

    --transition: 160ms ease;
}

/*
|--------------------------------------------------------------------------
| Reset
|--------------------------------------------------------------------------
*/

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background:
        radial-gradient(
            circle at top right,
            rgba(255, 255, 255, 0.04),
            transparent 35%
        ),
        var(--background);

    color: var(--text);
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

/*
|--------------------------------------------------------------------------
| Main application shell
|--------------------------------------------------------------------------
*/

.kiosk-app {
    display: flex;
    flex-direction: column;

    min-height: 100vh;
}

.kiosk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;

    padding: 1rem 1.5rem;

    background:
        linear-gradient(
            180deg,
            #20242a,
            var(--panel)
        );

    border-bottom:
        2px solid var(--accent);

    box-shadow:
        0 4px 24px
        rgba(0, 0, 0, 0.35);
}

.brand-area {
    min-width: 0;
}

.brand-title {
    margin: 0;

    font-size: clamp(
        1.5rem,
        3vw,
        2.2rem
    );

    color: var(--accent);

    text-shadow:
        0 0 10px
        color-mix(
            in srgb,
            var(--accent) 65%,
            transparent
        );

    letter-spacing: 0.01em;
}

.brand-subtitle {
    margin:
        0.25rem 0 0;

    color: var(--text-muted);

    font-size: 0.98rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;

    flex-shrink: 0;
}

.kiosk-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-end;

    color: var(--text-muted);

    font-size: 0.84rem;
}

.kiosk-name {
    color: var(--text);

    font-weight: 700;
}

.clock {
    min-width: 145px;

    color: var(--accent);

    font-family:
        "Courier New",
        monospace;

    font-size: clamp(
        1.25rem,
        2.5vw,
        1.8rem
    );

    font-weight: 700;

    text-align: right;

    text-shadow:
        0 0 10px
        color-mix(
            in srgb,
            var(--accent) 65%,
            transparent
        );
}

/*
|--------------------------------------------------------------------------
| Connection banner
|--------------------------------------------------------------------------
*/

.connection-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    padding:
        0.7rem
        1.5rem;

    border-bottom:
        1px solid transparent;

    transition:
        background var(--transition),
        border-color var(--transition);
}

.connection-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;

    min-width: 0;
}

.connection-dot {
    width: 13px;
    height: 13px;

    flex-shrink: 0;

    border-radius: 50%;

    background: currentColor;

    box-shadow:
        0 0 12px
        currentColor;
}

.connection-copy {
    min-width: 0;
}

.connection-title {
    display: block;

    font-weight: 800;
}

.connection-detail {
    display: block;

    margin-top: 0.12rem;

    font-size: 0.84rem;

    opacity: 0.88;
}

.pending-badge {
    min-width: 34px;

    padding:
        0.35rem
        0.7rem;

    border-radius: 999px;

    background:
        rgba(0, 0, 0, 0.28);

    font-weight: 800;

    text-align: center;
}

.connection-banner.status-online {
    color: #b8ffd0;

    background:
        rgba(34, 197, 94, 0.16);

    border-color:
        rgba(34, 197, 94, 0.42);
}

.connection-banner.status-warning {
    color: #ffe2a8;

    background:
        rgba(245, 158, 11, 0.17);

    border-color:
        rgba(245, 158, 11, 0.45);
}

.connection-banner.status-offline {
    color: #ffd2d2;

    background:
        rgba(220, 38, 38, 0.2);

    border-color:
        rgba(220, 38, 38, 0.55);
}

/*
|--------------------------------------------------------------------------
| Main layout
|--------------------------------------------------------------------------
*/

.kiosk-main {
    display: grid;

    grid-template-columns:
        minmax(320px, 480px)
        minmax(420px, 1fr);

    gap: 1rem;

    width: 100%;

    flex: 1;

    padding: 1rem;
}

.panel {
    min-width: 0;

    background:
        linear-gradient(
            180deg,
            var(--panel-light),
            var(--panel)
        );

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-large);

    box-shadow:
        var(--shadow);
}

.input-panel {
    align-self: start;

    padding: 1.25rem;
}

.active-panel {
    display: flex;
    flex-direction: column;

    min-height: 0;

    padding: 1.25rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    margin-bottom: 1rem;
}

.panel-title {
    margin: 0;

    font-size: 1.35rem;
}

.active-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 36px;
    height: 36px;

    padding: 0 0.75rem;

    border:
        1px solid
        color-mix(
            in srgb,
            var(--accent) 60%,
            transparent
        );

    border-radius: 999px;

    color: var(--accent);

    background:
        color-mix(
            in srgb,
            var(--accent) 12%,
            transparent
        );

    font-weight: 800;
}

/*
|--------------------------------------------------------------------------
| Form fields
|--------------------------------------------------------------------------
*/

.form-row {
    position: relative;

    margin-bottom: 1.25rem;
}

.form-label {
    display: block;

    margin-bottom: 0.42rem;

    color: var(--text);

    font-size: 1rem;
    font-weight: 700;
}

.dropdown-wrap {
    position: relative;
}

.form-input {
    width: 100%;

    min-height: 54px;

    padding:
        0.85rem
        3.2rem
        0.85rem
        0.9rem;

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-small);

    background:
        #111419;

    color: var(--text);

    font-size: 1.05rem;

    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        background var(--transition);
}

.form-input::placeholder {
    color: #747b86;
}

.form-input:hover {
    background: #15191f;
}

.form-input:focus {
    outline: none;

    border-color:
        var(--accent);

    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--accent) 24%,
            transparent
        );
}

.form-input[data-selected="true"] {
    border-color:
        color-mix(
            in srgb,
            var(--accent) 70%,
            white 5%
        );
}

.dropdown-toggle {
    position: absolute;

    top: 50%;
    right: 0.45rem;

    width: 42px;
    height: 42px;

    transform:
        translateY(-50%);

    border: 0;

    border-radius:
        var(--radius-small);

    background: transparent;

    color: var(--text-muted);

    cursor: pointer;

    transition:
        color var(--transition),
        background var(--transition);
}

.dropdown-toggle:hover,
.dropdown-toggle:focus-visible {
    color: var(--accent);

    background:
        rgba(255, 255, 255, 0.06);

    outline: none;
}

/*
|--------------------------------------------------------------------------
| Dropdown lists
|--------------------------------------------------------------------------
*/

.dropdown-list {
    position: absolute;

    z-index: 1000;

    top: calc(100% + 6px);
    left: 0;
    right: 0;

    max-height: 280px;

    overflow-y: auto;

    padding: 0.35rem;

    border:
        1px solid
        color-mix(
            in srgb,
            var(--accent) 45%,
            var(--border)
        );

    border-radius:
        var(--radius);

    background:
        #171b21;

    box-shadow:
        0 16px 36px
        rgba(0, 0, 0, 0.48);
}

.dropdown-list:not(.is-open) {
    display: none;
}

.dropdown-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    width: 100%;

    padding:
        0.72rem
        0.8rem;

    border: 0;

    border-radius:
        var(--radius-small);

    background: transparent;

    color: var(--text);

    text-align: left;

    cursor: pointer;
}

.dropdown-item:hover,
.dropdown-item:focus-visible {
    outline: none;

    background:
        color-mix(
            in srgb,
            var(--accent) 14%,
            var(--panel-hover)
        );
}

.dropdown-item-label {
    font-weight: 700;
}

.dropdown-item-secondary {
    margin-top: 0.14rem;

    color: var(--text-muted);

    font-size: 0.8rem;
}

.dropdown-empty {
    padding: 1rem;

    color: var(--text-muted);

    text-align: center;
}

/*
|--------------------------------------------------------------------------
| Buttons
|--------------------------------------------------------------------------
*/

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 48px;

    padding:
        0.75rem
        1.15rem;

    border:
        1px solid transparent;

    border-radius:
        var(--radius-small);

    color: white;

    font-weight: 800;

    cursor: pointer;

    transition:
        transform var(--transition),
        opacity var(--transition),
        box-shadow var(--transition),
        background var(--transition);
}

.button:hover:not(:disabled) {
    transform:
        translateY(-1px);
}

.button:focus-visible {
    outline:
        3px solid
        color-mix(
            in srgb,
            var(--accent) 35%,
            transparent
        );

    outline-offset: 2px;
}

.button:disabled {
    opacity: 0.48;

    cursor: not-allowed;

    transform: none;
}

.button-primary {
    width: 100%;

    min-height: 58px;

    background:
        var(--accent);

    border-color:
        color-mix(
            in srgb,
            var(--accent) 80%,
            white 10%
        );

    color: #071015;

    font-size: 1.15rem;

    box-shadow:
        0 0 18px
        color-mix(
            in srgb,
            var(--accent) 38%,
            transparent
        );
}

.button-primary:hover:not(:disabled) {
    background:
        color-mix(
            in srgb,
            var(--accent) 88%,
            white 12%
        );

    box-shadow:
        0 0 26px
        color-mix(
            in srgb,
            var(--accent) 48%,
            transparent
        );
}

.button-danger {
    background:
        var(--danger);

    border-color:
        #ef4444;

    box-shadow:
        0 0 12px
        rgba(220, 38, 38, 0.28);
}

.button-danger:hover:not(:disabled) {
    background:
        var(--danger-dark);
}

.button.is-busy {
    position: relative;

    pointer-events: none;
}

/*
|--------------------------------------------------------------------------
| Message box
|--------------------------------------------------------------------------
*/

.message {
    margin-top: 1rem;

    padding:
        0.85rem
        1rem;

    border:
        1px solid transparent;

    border-radius:
        var(--radius-small);

    font-weight: 700;

    text-align: center;
}

.message-info {
    color: #ccefff;

    background:
        rgba(0, 183, 255, 0.12);

    border-color:
        rgba(0, 183, 255, 0.35);
}

.message-success {
    color: #caffda;

    background:
        rgba(34, 197, 94, 0.13);

    border-color:
        rgba(34, 197, 94, 0.4);
}

.message-warning {
    color: #ffe6b3;

    background:
        rgba(245, 158, 11, 0.14);

    border-color:
        rgba(245, 158, 11, 0.42);
}

.message-error {
    color: #ffd1d1;

    background:
        rgba(220, 38, 38, 0.17);

    border-color:
        rgba(220, 38, 38, 0.48);
}

/*
|--------------------------------------------------------------------------
| Active users
|--------------------------------------------------------------------------
*/

.active-users {
    display: flex;
    flex-direction: column;

    gap: 0.7rem;

    min-height: 0;

    overflow-y: auto;

    padding-right: 0.2rem;
}

.active-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    padding: 0.9rem;

    border:
        1px solid var(--border);

    border-radius:
        var(--radius);

    background:
        #15191e;

    transition:
        border-color var(--transition),
        background var(--transition),
        transform var(--transition);
}

.active-row:hover {
    border-color:
        color-mix(
            in srgb,
            var(--accent) 35%,
            var(--border)
        );

    background:
        #191e24;

    transform:
        translateY(-1px);
}

.active-row.session-warning {
    border-color:
        rgba(245, 158, 11, 0.65);

    box-shadow:
        inset 4px 0 0
        var(--warning);
}

.active-info {
    min-width: 0;
}

.active-name {
    color: var(--accent);

    font-size: 1.05rem;
    font-weight: 800;

    text-shadow:
        0 0 8px
        color-mix(
            in srgb,
            var(--accent) 38%,
            transparent
        );
}

.active-assignment {
    margin-top: 0.25rem;

    color: var(--text);

    font-size: 0.94rem;

    overflow-wrap: anywhere;
}

.active-activity {
    color: var(--text-muted);
}

.active-metadata {
    margin-top: 0.25rem;

    color: #7f8792;

    font-size: 0.78rem;
}

.active-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;

    flex-shrink: 0;
}

.active-elapsed {
    min-width: 86px;

    color: #e5e7eb;

    font-family:
        "Courier New",
        monospace;

    font-size: 1rem;
    font-weight: 800;

    text-align: right;
}

.clock-out-button {
    min-height: 42px;

    padding:
        0.6rem
        0.85rem;

    font-size: 0.9rem;
}

.active-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 220px;

    padding: 2rem;

    border:
        1px dashed
        var(--border);

    border-radius:
        var(--radius);

    color: var(--text-muted);

    text-align: center;
}

.active-empty strong {
    color: var(--text);

    font-size: 1.05rem;
}

.active-empty span {
    margin-top: 0.45rem;

    font-size: 0.9rem;
}

/*
|--------------------------------------------------------------------------
| Footer
|--------------------------------------------------------------------------
*/

.kiosk-footer {
    padding:
        0.7rem
        1rem;

    border-top:
        1px solid var(--border);

    background:
        var(--panel);

    color: var(--text-muted);

    font-size: 0.8rem;

    text-align: center;
}

/*
|--------------------------------------------------------------------------
| Scrollbars
|--------------------------------------------------------------------------
*/

* {
    scrollbar-width: thin;

    scrollbar-color:
        color-mix(
            in srgb,
            var(--accent) 55%,
            #555
        )
        #111419;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: #111419;
}

*::-webkit-scrollbar-thumb {
    border:
        2px solid #111419;

    border-radius: 999px;

    background:
        color-mix(
            in srgb,
            var(--accent) 55%,
            #555
        );
}

/*
|--------------------------------------------------------------------------
| Tablets and smaller screens
|--------------------------------------------------------------------------
*/

@media (max-width: 980px) {
    .kiosk-main {
        grid-template-columns: 1fr;
    }

    .input-panel {
        align-self: stretch;
    }
}

@media (max-width: 700px) {
    .kiosk-header {
        align-items: flex-start;

        padding:
            0.9rem
            1rem;
    }

    .header-right {
        flex-direction: column;
        align-items: flex-end;

        gap: 0.4rem;
    }

    .kiosk-identity {
        display: none;
    }

    .connection-banner {
        align-items: flex-start;

        padding:
            0.7rem
            1rem;
    }

    .kiosk-main {
        padding: 0.6rem;
    }

    .panel {
        border-radius:
            var(--radius);
    }

    .input-panel,
    .active-panel {
        padding: 0.9rem;
    }

    .active-row {
        align-items: stretch;
        flex-direction: column;
    }

    .active-controls {
        justify-content: space-between;
    }

    .active-elapsed {
        text-align: left;
    }

    .clock-out-button {
        min-width: 125px;
    }
}

@media (max-width: 460px) {
    .brand-subtitle {
        display: none;
    }

    .brand-title {
        font-size: 1.35rem;
    }

    .clock {
        min-width: auto;

        font-size: 1.15rem;
    }

    .connection-detail {
        font-size: 0.76rem;
    }

    .form-input {
        min-height: 58px;

        font-size: 1rem;
    }

    .button-primary {
        min-height: 60px;
    }
}

/*
|--------------------------------------------------------------------------
| Reduced motion
|--------------------------------------------------------------------------
*/

@media (
    prefers-reduced-motion: reduce
) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        transition-duration:
            0.01ms !important;

        animation-duration:
            0.01ms !important;

        animation-iteration-count:
            1 !important;
    }
}

/* ==========================================================
   Employee History Drawer
========================================================== */

.history-backdrop {

    position: fixed;

    inset: 0;

    background: rgba(0,0,0,.45);

    z-index: 998;

}

.history-panel {

    position: fixed;

    top: 0;
    right: 0;

    width: 420px;
    max-width: 95vw;

    height: 100vh;

    background: #181b20;

    border-left: 2px solid var(--accent);

    box-shadow:
        -10px 0 40px rgba(0,0,0,.4);

    transform: translateX(100%);

    transition: transform .25s ease;

    z-index: 999;

    display: flex;

    flex-direction: column;

}

.history-panel.open {

    transform: translateX(0);

}

.history-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 20px;

    border-bottom: 1px solid #333;

}

.history-label {

    font-size: 12px;

    color: #888;

    text-transform: uppercase;

    letter-spacing: 1px;

}

#history-title {

    margin-top: 4px;

    color: var(--accent);

    font-size: 24px;

}

.history-close {

    width: 42px;

    height: 42px;

    border: none;

    border-radius: 8px;

    background: #2b2f36;

    color: white;

    font-size: 22px;

    cursor: pointer;

}

.history-close:hover {

    background: #3a4048;

}

.history-summary {

    padding: 18px;

    border-bottom: 1px solid #333;

}

.history-total {

    display: flex;

    justify-content: space-between;

    font-size: 17px;

    font-weight: bold;

}

.history-content {

    flex: 1;

    overflow-y: auto;

    padding: 15px;

}

.history-row {

    background: #23272f;

    border-radius: 10px;

    padding: 14px;

    margin-bottom: 12px;

}

.history-row strong {

    display: block;

    color: white;

    font-size: 16px;

}

.history-row span {

    color: #999;

    font-size: 14px;

}

.history-time {

    margin-top: 8px;

    display: flex;

    justify-content: space-between;

    font-size: 14px;

    color: #ddd;

}

.history-empty {

    text-align: center;

    color: #888;

    margin-top: 40px;

    font-size: 16px;

}