/**
 * clock.css - MBF TimeClock
 * Mobile-first native app feel, desktop friendly
 * Colors: bg #333333, keys #666666, site bg #00802b, display #000000/#00FF00
 */

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== BASE - mobile app feel ===== */
html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    background-color: #00802b;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 Helvetica, Arial, sans-serif;
    text-align: center;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation; /* prevents 300ms tap delay on mobile */
}

/* ===== APP SHELL - fills screen on mobile like a real app ===== */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
    max-width: 480px;
    margin: 0 auto;
    padding: 0 0 env(safe-area-inset-bottom) 0; /* iPhone notch/home bar */
}

/* ===== LOGO ===== */
.logo-wrap {
    padding: 16px 20px 8px 20px;
    flex-shrink: 0;
}

.logo-wrap img {
    max-width: 75%;
    max-height: 80px;
    margin: 0 auto;
    display: block;
}

/* ===== KEYPAD CONTAINER ===== */
#keypad-wrap {
    background-color: #333333;
    border-radius: 16px;
    padding: 16px 16px 20px 16px;
    margin: 8px 12px;
    flex-shrink: 0;
}

#keypad-wrap h4 {
    color: yellow;
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

#keypad-wrap h5 {
    color: #888888;
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 400;
}

/* ===== KEYPAD TABLE ===== */
table#keypad {
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 6px;
}

table#keypad tr td {
    vertical-align: middle;
    text-align: center;
    border: 2px solid #1a1a1a;
    font-size: 28px;
    font-weight: 700;
    width: 76px;
    height: 60px;
    cursor: pointer;
    background-color: #555555;
    color: #DDDDDD;
    border-radius: 10px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.08s, transform 0.08s;
    /* Native app button feel */
    -webkit-touch-callout: none;
}

table#keypad tr td:active {
    background-color: #777777;
    transform: scale(0.94);
}

/* ===== DISPLAY ===== */
.display {
    text-align: center;
    width: 240px;
    margin: 10px auto 4px auto;
    background-color: #000000;
    color: #00FF00;
    font-size: 42px;
    font-family: 'Courier New', Courier, monospace;
    border: 2px solid #555555;
    border-radius: 8px;
    display: block;
    padding: 6px 8px;
    letter-spacing: 6px;
}

/* ===== MESSAGE ===== */
#message {
    text-align: center;
    color: #888888;
    font-size: 13px;
    min-height: 18px;
    margin: 4px 0 0 0;
}

/* ===== ACTION BUTTONS ===== */
.btn-clock {
    display: block;
    width: calc(100% - 24px);
    max-width: 440px;
    margin: 6px 12px;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    letter-spacing: 0.3px;
    /* Native feel */
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.1s, transform 0.1s;
    -webkit-touch-callout: none;
    user-select: none;
}

.btn-clock:active {
    opacity: 0.8;
    transform: scale(0.97);
}

.btn-primary-clock  { background-color: #0a84ff; color: #ffffff; }
.btn-hours          { background-color: #ff9500; color: #ffffff; }
.btn-reload         { background-color: #3a3a3c; color: #ebebf5; }
.btn-success-clock  { background-color: #30d158; color: #ffffff; }
.btn-danger-clock   { background-color: #ff3b30; color: #ffffff; }
.btn-done           { background-color: #ff6b00; color: #ffffff; }

/* ===== CONFIRMATION SCREEN ===== */
.confirm-box {
    background-color: #1c1c1e;
    border-radius: 16px;
    padding: 24px 20px;
    margin: 8px 12px;
    color: #ffffff;
}

.confirm-box .emp-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #00FF00;
    margin: 0 auto 12px auto;
    display: block;
}

.confirm-box .emp-name {
    font-size: 26px;
    font-weight: 700;
    color: #00FF00;
    margin: 4px 0 2px 0;
}

.confirm-box .status-badge {
    font-size: 18px;
    font-weight: 700;
    padding: 6px 22px;
    border-radius: 20px;
    display: inline-block;
    margin: 8px 0;
    letter-spacing: 1px;
}

.status-in  { background-color: #30d158; color: #000000; }
.status-out { background-color: #ff3b30; color: #ffffff; }

.confirm-box .hours-display {
    font-size: 22px;
    font-weight: 700;
    color: #ffd60a;
    margin: 10px 0 4px 0;
}

.confirm-box .detail-row {
    font-size: 14px;
    color: #8e8e93;
    margin: 4px 0;
}

/* ===== TASK SELECTION ===== */
.task-box {
    background-color: #1c1c1e;
    border-radius: 16px;
    padding: 20px 16px;
    margin: 8px 12px;
    color: #ffffff;
}

.task-box h3 {
    color: #ffd60a;
    margin: 0 0 14px 0;
    font-size: 20px;
    font-weight: 700;
}

.task-box label {
    display: block;
    text-align: left;
    font-size: 13px;
    color: #8e8e93;
    margin-bottom: 5px;
    margin-top: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-box select {
    width: 100%;
    padding: 12px 10px;
    font-size: 16px;
    background-color: #2c2c2e;
    color: #ffffff;
    border: 1px solid #3a3a3c;
    border-radius: 10px;
    -webkit-appearance: none;
    appearance: none;
}

.task-box select:focus {
    border-color: #0a84ff;
    outline: none;
}

/* ===== H2A MULTI-SCAN ===== */
.h2a-session-box {
    background-color: #1c1c1e;
    border-radius: 16px;
    padding: 16px;
    margin: 8px 12px;
    color: #ffffff;
}

.h2a-session-box h3 {
    color: #ffd60a;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.h2a-session-info {
    background-color: #2c2c2e;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #30d158;
    text-align: left;
    border-left: 3px solid #30d158;
}

.scan-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.scan-list li {
    background-color: #2c2c2e;
    border-left: 4px solid #30d158;
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    font-size: 14px;
    text-align: left;
    color: #ffffff;
}

.scan-list li .scan-time {
    color: #8e8e93;
    font-size: 12px;
    float: right;
}

/* ===== HOURS VIEW ===== */
.hours-box {
    background-color: #1c1c1e;
    border-radius: 16px;
    padding: 16px;
    margin: 8px 12px;
    color: #ffffff;
}

.hours-box h3 {
    color: #ffd60a;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px 0;
}

.week-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.week-nav button {
    background-color: #2c2c2e;
    color: #0a84ff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.week-nav .week-label {
    color: #30d158;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.hours-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.hours-table th {
    background-color: #2c2c2e;
    color: #ffd60a;
    padding: 8px 4px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.hours-table td {
    padding: 8px 4px;
    border-bottom: 1px solid #2c2c2e;
    color: #ffffff;
    text-align: center;
}

.hours-table tr:nth-child(even) td {
    background-color: #242426;
}

.total-row td {
    background-color: #003d14 !important;
    color: #30d158 !important;
    font-weight: 700;
    font-size: 14px;
    border-top: 2px solid #30d158;
}

/* ===== LOGIN SCREEN ===== */
.login-box {
    background-color: #1c1c1e;
    border-radius: 16px;
    padding: 28px 20px;
    margin: 20px 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.login-box h2 {
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px 0;
}

.login-box p {
    color: #8e8e93;
    font-size: 14px;
    margin: 0 0 20px 0;
}

.login-box input[type="password"] {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    background-color: #2c2c2e;
    color: #ffffff;
    border: 1px solid #3a3a3c;
    border-radius: 10px;
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 4px;
    -webkit-appearance: none;
}

.login-box input[type="submit"] {
    width: 100%;
    padding: 14px;
    font-size: 17px;
    font-weight: 600;
    background-color: #30d158;
    color: #000000;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.login-box input[type="submit"]:active {
    opacity: 0.8;
}

.error-msg {
    color: #ff3b30;
    font-size: 14px;
    margin-top: 8px;
}

/* ===== GPS ALERT ===== */
.alert-gps {
    background-color: #ff3b30;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin: 10px 0 0 0;
    font-weight: 600;
}

/* ===== INSTALL BANNER (PWA prompt) ===== */
.install-banner {
    background-color: #1c1c1e;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 6px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    border: 1px solid #3a3a3c;
}

.install-banner img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
}

.install-banner .install-text {
    flex: 1;
}

.install-banner .install-text strong {
    display: block;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

.install-banner .install-text span {
    color: #8e8e93;
    font-size: 12px;
}

.install-banner button {
    background-color: #0a84ff;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ===== DESKTOP OVERRIDE ===== */
/* On screens wider than 600px restore normal web layout */
@media (min-width: 600px) {
    body {
        font-family: Verdana, Arial, Helvetica, sans-serif;
    }

    .app-shell {
        max-width: 500px;
        padding-bottom: 20px;
    }

    #keypad-wrap {
        margin: 10px auto;
        max-width: 340px;
        border-radius: 10px;
    }

    table#keypad tr td {
        width: 80px;
        height: 65px;
        font-size: 32px;
        border-radius: 5px;
    }

    .btn-clock {
        max-width: 320px;
        margin: 6px auto;
        border-radius: 6px;
        padding: 13px;
    }

    .confirm-box, .task-box, .h2a-session-box,
    .hours-box, .login-box {
        margin: 10px auto;
        max-width: 440px;
        border-radius: 10px;
    }

    .task-box select {
        border-radius: 5px;
    }
}

/* ===== GPS PERMISSION OVERLAY ===== */
/* Blocks the keypad until location is granted (standalone/installed mode only) */
#gpsOverlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#gpsOverlayBox {
    background: #1c1c1e;
    border: 1px solid #3a3a3c;
    border-radius: 16px;
    padding: 30px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    color: #ffffff;
}

#gpsOverlayBox h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: #ffffff;
}

#gpsOverlayBox p {
    font-size: 14px;
    color: #8e8e93;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

#gpsRequestBtn {
    background-color: #00802b;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

#gpsRequestBtn:active {
    background-color: #006622;
}

/* ===== PWA STANDALONE - push content down from status bar ===== */
@media all and (display-mode: standalone) {
    .app-shell {
        padding-top: max(20px, env(safe-area-inset-top));
    }

    .logo-wrap {
        padding-top: 24px;
    }
}