/* =====================================================
   GUTime Client - Global Modern Stylesheet
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #f2f7ff;
    --surface: #ffffff;
    --ink: #12233f;
    --muted: #5f7293;
    --brand: #1e63d6;
    --brand-dark: #174fae;
    --brand-light: #e8f1ff;
    --accent: #56b8ff;
    --success: #1b8a4a;
    --warning: #e0a32e;
    --danger: #d9534f;
    --shadow: 0 2px 8px rgba(18, 35, 63, 0.06);
    --shadow-md: 0 4px 12px rgba(18, 35, 63, 0.08);
    --shadow-lg: 0 8px 24px rgba(18, 35, 63, 0.12);
    --radius: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

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

body {
    font-family: 'Prompt', 'IBM Plex Sans Thai', system-ui, sans-serif;
    background: linear-gradient(135deg, #e6f1ff 0%, #f2f7ff 50%, #fbfdff 100%);
    color: var(--ink);
    min-height: 100vh;
    padding-bottom: 90px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(30, 99, 214, 0.15); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(30, 99, 214, 0.3); }
::selection { background: rgba(30, 99, 214, 0.15); color: var(--ink); }

/* ── Topbar ── */
.topbar {
    background: linear-gradient(135deg, #0d2f6f 0%, #1e63d6 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(13, 47, 111, 0.2);
}

.brand {
    font-family: 'Prompt', 'Kanit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.3px;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.25s ease;
    cursor: pointer;
    font-family: inherit;
    backdrop-filter: blur(8px);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
    transform: translateY(-1px);
}

.btn-ghost:active {
    transform: translateY(0);
}

/* ── Content ── */
.content {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.hero {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

/* ── Cards ── */
.card-surface {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(30, 99, 214, 0.05);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    animation: fadeUp 0.4s ease both;
}

.card-surface:hover {
    box-shadow: var(--shadow-md);
}

/* ── Hero Card ── */
.hero-card {
    background: linear-gradient(135deg, #1e63d6 0%, #0d2f6f 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: fadeUp 0.35s ease both;
}

.profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
}

.profile-name {
    font-family: 'Prompt', 'Kanit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
}

.profile-meta {
    opacity: 0.8;
    font-size: 0.88rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 18px;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 14px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.25s ease;
}

.stat:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 0.78rem;
    opacity: 0.8;
    margin-bottom: 3px;
}

.stat-value {
    font-weight: 700;
    font-size: 1.02rem;
}

/* ── Section Titles ── */
.section-title {
    font-family: 'Prompt', 'Kanit', sans-serif;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.section-title i {
    color: var(--brand);
    font-size: 0.95rem;
}

/* ── Status Badges ── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--brand-light);
    color: var(--brand);
    border: 1px solid rgba(30, 99, 214, 0.1);
}

/* ── Buttons ── */
.btn-main {
    background: linear-gradient(135deg, #1e63d6 0%, #3e8bff 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 20px;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.92rem;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(30, 99, 214, 0.25);
    cursor: pointer;
}

.btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 99, 214, 0.35);
}

.btn-main:active {
    transform: translateY(0);
}

.btn-outline {
    border: 2px solid rgba(30, 99, 214, 0.2);
    color: var(--brand);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.92rem;
    background: var(--surface);
    transition: all 0.25s ease;
    cursor: pointer;
}

.btn-outline:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ── Action Cards (check-in/out) ── */
.action-card {
    border: none;
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1rem;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(30, 99, 214, 0.2);
    transition: all 0.3s ease;
    width: 100%;
    cursor: pointer;
    color: #fff;
}

.action-card:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(30, 99, 214, 0.3);
}

.action-card:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(40%);
}

.action-card.in { background: linear-gradient(135deg, #1e63d6 0%, #174fae 100%); }
.action-card.out { background: linear-gradient(135deg, #e55353 0%, #d43f3f 100%); }
.action-card.break-start { background: linear-gradient(135deg, #4b7bec, #3867d6); }
.action-card.break-end { background: linear-gradient(135deg, #3a8ef5, #2d74d1); }

/* ── Action Buttons (checkin page) ── */
.action-btn {
    border: none;
    border-radius: 18px;
    padding: 16px;
    font-weight: 700;
    font-size: 0.92rem;
    font-family: inherit;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(18, 35, 63, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(18, 35, 63, 0.25);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(50%);
}

.action-btn.in { background: linear-gradient(135deg, #2f79ea, #1e63d6); }
.action-btn.out { background: linear-gradient(135deg, #e09f3e, #d65a31); }
.action-btn.break-start { background: linear-gradient(135deg, #4b7bec, #3867d6); }
.action-btn.break-end { background: linear-gradient(135deg, #3a8ef5, #2d74d1); }
.action-btn.selected { outline: 3px solid rgba(255, 255, 255, 0.5); transform: scale(1.02); }

.action-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* ── Info Rows ── */
.info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.92rem;
    padding: 10px 0;
    border-bottom: 1px solid rgba(18, 35, 63, 0.04);
}

.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--muted); font-weight: 500; }
.info-row strong { color: var(--ink); font-weight: 700; }

/* ── Schedule Grid ── */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.schedule-grid .label {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.schedule-grid .value {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ink);
}

/* ── Timeline ── */
.timeline { margin-top: 12px; }

.timeline-item {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(18, 35, 63, 0.05);
}

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

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.dot.in { background: var(--brand); }
.dot.out { background: var(--danger); }

.timeline-time {
    font-weight: 700;
    color: var(--ink);
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
}

/* ── Tables ── */
.table thead th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    font-weight: 700;
    background: linear-gradient(135deg, #f0f5ff, #e8effc);
    padding: 12px 14px;
    border-bottom: 2px solid rgba(30, 99, 214, 0.06);
}

.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(30, 99, 214, 0.04);
    vertical-align: middle;
    font-size: 0.88rem;
}

.table tbody tr:hover {
    background: rgba(30, 99, 214, 0.02);
}

/* ── Form Controls ── */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(30, 99, 214, 0.12);
    font-size: 0.9rem;
    font-family: inherit;
    padding: 10px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(30, 99, 214, 0.1);
}

.form-control::placeholder {
    color: rgba(95, 114, 147, 0.5);
}

/* ── Video Box (face scan) ── */
.video-box {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #0b1020;
    box-shadow: var(--shadow-lg);
}

.video-status {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(210, 236, 255, 0.9);
    color: #0b3a5a;
    border: 1px solid rgba(11, 58, 90, 0.15);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(11, 58, 90, 0.12);
    backdrop-filter: blur(8px);
    pointer-events: none;
    z-index: 3;
}

.face-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(65%, 260px);
    aspect-ratio: 1;
    border: 4px solid #34c759;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45), 0 0 30px rgba(52, 199, 89, 0.25);
    z-index: 2;
    animation: scanPulse 2.5s ease-in-out infinite;
}

.face-overlay::before {
    content: '';
    position: absolute;
    inset: -10px;
    border: 2px solid rgba(52, 199, 89, 0.2);
    border-radius: 50%;
    animation: scanRing 2.5s ease-in-out infinite;
}

.face-overlay::after {
    content: '';
    position: absolute;
    inset: -20px;
    border: 1px solid rgba(52, 199, 89, 0.1);
    border-radius: 50%;
    animation: scanRing 2.5s ease-in-out infinite 0.3s;
}

@keyframes scanPulse {
    0%, 100% {
        border-color: #34c759;
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45), 0 0 20px rgba(52, 199, 89, 0.2);
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        border-color: #30d158;
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45), 0 0 40px rgba(52, 199, 89, 0.35);
        transform: translate(-50%, -50%) scale(1.01);
    }
}

@keyframes scanRing {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.03); }
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 0.92rem;
}

/* ── SweetAlert Override ── */
.swal2-popup {
    font-family: 'Prompt', 'IBM Plex Sans Thai', sans-serif !important;
    border-radius: 18px !important;
}

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .content, .hero { padding: 16px; }
    .card-surface { padding: 16px; border-radius: 16px; }
    .hero-card { padding: 20px; }
    .hero-stats { grid-template-columns: 1fr; gap: 10px; }
    .topbar { padding: 14px 16px; }
    .brand { font-size: 1rem; }
    .btn-ghost { padding: 6px 12px; font-size: 0.82rem; }
    .section-title { font-size: 0.95rem; }
    .action-row { grid-template-columns: 1fr; gap: 10px; }
    .action-btn { padding: 14px; font-size: 0.88rem; }
    .schedule-grid { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 480px) {
    .topbar { padding: 12px; }
    .content, .hero { padding: 12px; }
    .card-surface { padding: 14px; border-radius: 14px; }
    .btn-ghost { padding: 6px 10px; font-size: 0.8rem; }
    .video-box { border-radius: 16px; }
    .action-btn { padding: 12px; font-size: 0.85rem; }
    .info-row { font-size: 0.85rem; }
}
