/* ClockIn: PortalRH brand palette (login.less), white background, phone first. */

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/montserrat-v18-latin-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/montserrat-v18-latin-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/montserrat-v18-latin-700.woff2') format('woff2');
}

:root {
    --brand: #1B4E9B;
    --brand-dark: #153d7a;
    --accent: #00A0E3;
    --ink: #3a3a3a;
    --muted: #7d8892;
    --line: #e2e7ec;
    --field: #f6f9fb;
    --danger: #d64545;
    --success: #28a745;
    --key-size: clamp(64px, 20vw, 80px);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: #ffffff;
}

body {
    font-family: Montserrat, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button {
    font-family: inherit;
}

.clockin {
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 380px;
    margin: 0 auto;
    padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header: logo + clock */

.clockin-header {
    text-align: center;
    margin-bottom: 24px;
}

.clockin-logo {
    display: block;
    max-width: 180px;
    max-height: 56px;
    margin: 0 auto 20px;
    object-fit: contain;
}

.clockin-clock {
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.clockin-date {
    margin-top: 4px;
    font-size: .875rem;
    color: var(--muted);
}

/* Steps */

.clockin-step {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: step-in .25s ease-out;
}

.clockin-step[hidden] {
    display: none;
}

@keyframes step-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.clockin-label {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
}

.nif-display {
    display: block;
    width: 100%;
    min-height: 52px;
    margin: 6px 0 4px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--line);
    text-align: center;
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: 3px;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    transition: border-color .2s;
}

.nif-display.is-complete {
    border-bottom-color: var(--accent);
}

.nif-display .placeholder {
    color: var(--line);
}

.clockin-message {
    min-height: 1.25rem;
    margin: 6px 0 10px;
    font-size: .875rem;
    font-weight: 600;
    text-align: center;
    color: var(--danger);
}

.shake {
    animation: shake .35s;
}

@keyframes shake {
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Dialpad */

.dialpad {
    display: grid;
    grid-template-columns: repeat(3, var(--key-size));
    gap: 14px 22px;
    justify-content: center;
    margin-bottom: 24px;
}

.dial-key {
    width: var(--key-size);
    height: var(--key-size);
    border: 0;
    border-radius: 50%;
    background: var(--field);
    color: var(--brand);
    font-size: 1.75rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    transition: background-color .12s, transform .12s;
}

.dial-key:active {
    background: #e3edf6;
    transform: scale(.94);
}

.dial-key:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-link:focus-visible {
    outline: 3px solid rgba(0, 160, 227, .45);
    outline-offset: 2px;
}

.dial-key-icon {
    background: transparent;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dial-key-icon svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Buttons */

.btn-primary,
.btn-secondary {
    position: relative;
    width: 100%;
    height: 54px;
    border-radius: 27px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color .15s, opacity .15s;
}

.btn-primary {
    border: 0;
    background: var(--brand);
    color: #ffffff;
}

.btn-primary:active:not(:disabled) {
    background: var(--brand-dark);
}

.btn-primary:disabled {
    opacity: .35;
    cursor: default;
}

.btn-secondary {
    border: 2px solid var(--line);
    background: #ffffff;
    color: var(--brand);
}

.btn-link {
    margin-top: 14px;
    padding: 8px 16px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-link:disabled {
    opacity: .4;
}

.spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid rgba(255, 255, 255, .35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.is-loading .btn-text {
    visibility: hidden;
}

.is-loading .spinner {
    display: block;
}

.btn-primary.is-loading:disabled {
    opacity: 1;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Step 2 */

.avatar {
    width: 88px;
    height: 88px;
    margin-top: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #85CEE4, var(--accent) 45%, var(--brand));
    color: #ffffff;
    font-size: 1.875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clockin-greeting {
    margin: 18px 0 4px;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: var(--ink);
}

#step-confirm .clockin-message {
    margin-bottom: 24px;
}

/* Step 3 */

.success-mark svg {
    width: 88px;
    height: 88px;
    margin-top: 12px;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.success-mark circle {
    stroke: var(--success);
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
    animation: draw .5s ease-out forwards;
}

.success-mark path {
    stroke: var(--success);
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    animation: draw .3s .45s ease-out forwards;
}

@keyframes draw {
    to { stroke-dashoffset: 0; }
}

.done-sequence {
    margin: 4px 0 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--brand);
}

.done-time {
    margin: 4px 0 32px;
    font-size: .9375rem;
    color: var(--muted);
}

.reset-bar {
    width: 100%;
    height: 3px;
    margin-top: 16px;
    border-radius: 2px;
    background: var(--line);
    overflow: hidden;
}

.reset-bar span {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--accent);
    transform-origin: left;
}

.reset-bar span.is-running {
    animation: countdown var(--reset-ms, 6000ms) linear forwards;
}

@keyframes countdown {
    to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

@media (max-height: 640px) {
    .clockin-header { margin-bottom: 12px; }
    .clockin-logo { margin-bottom: 10px; max-height: 40px; }
    .clockin-clock { font-size: 2rem; }
    .dialpad { gap: 10px 22px; margin-bottom: 16px; }
    :root { --key-size: clamp(56px, 17vw, 72px); }
}
