/* Mum's Restaurant Timesheet - Mobile-first CSS */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #ca8a04;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    width: 100%;
}

/* Layout */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    overflow-x: hidden;
}

/* Prevent any element from causing overflow */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Word breaking for long text */
.name, .staff-name, h1, h2, h3, p {
    word-break: break-word;
    overflow-wrap: break-word;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    text-align: center;
    padding: 24px 0;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

.page-header .subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Staff List (Kiosk) */
.staff-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.staff-btn {
    display: block;
    width: 100%;
    padding: 20px 24px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--gray-900);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow);
}

.staff-btn:hover,
.staff-btn:focus {
    border-color: var(--primary);
    background: var(--gray-50);
}

.staff-btn:active {
    transform: scale(0.98);
}

/* Confirm Button (Press-and-Hold) */
.confirm-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px 16px;
}

.confirm-info {
    text-align: center;
    margin-bottom: 32px;
}

.confirm-info .name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.confirm-info .action {
    font-size: 1.25rem;
    color: var(--gray-500);
    margin-top: 8px;
}

.confirm-info .action.check-in {
    color: var(--success);
}

.confirm-info .action.check-out {
    color: var(--primary);
}

.confirm-btn {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    background: white;
    color: var(--primary);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.confirm-btn:hover {
    background: var(--gray-50);
}

.confirm-btn.holding {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.confirm-btn .icon {
    font-size: 2.5rem;
}

.confirm-btn .hint {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
}

.progress-ring {
    position: absolute;
    width: 220px;
    height: 220px;
    pointer-events: none;
}

.progress-ring circle {
    fill: none;
    stroke: var(--success);
    stroke-width: 4;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    stroke-dasharray: 628;
    stroke-dashoffset: 628;
    transition: stroke-dashoffset 0.6s linear;
}

/* Success Page */
.success-page {
    text-align: center;
    padding: 48px 16px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 2.5rem;
    color: var(--success);
}

.success-message {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.success-time {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
}

.success-total {
    color: var(--gray-500);
    font-size: 1rem;
    margin-bottom: 32px;
}

/* Links */
.action-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    display: inline-block;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* Overview Page */
.overview-header {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.overview-header .name {
    font-size: 1.5rem;
    font-weight: 600;
}

.overview-header .status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 8px;
}

.overview-header .status.checked-in {
    background: var(--success-light);
    color: var(--success);
}

.overview-header .status.checked-out {
    background: var(--gray-100);
    color: var(--gray-500);
}

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

.stat-card {
    background: white;
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card .label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-top: 4px;
}

.log-list {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.log-list-header {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
}

.log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
}

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

.log-item .type {
    font-weight: 500;
}

.log-item .type.in {
    color: var(--success);
}

.log-item .type.out {
    color: var(--primary);
}

.log-item .time {
    color: var(--gray-500);
}

/* Admin */
.admin-header {
    background: var(--gray-900);
    color: white;
    padding: 12px 16px;
    margin: -16px -16px 16px;
    width: calc(100% + 32px);
    max-width: none;
}

.admin-header h1 {
    font-size: 1.125rem;
    font-weight: 600;
}

.admin-nav {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
}

.admin-nav::-webkit-scrollbar {
    display: none;
}

.admin-nav a {
    color: var(--gray-400);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.admin-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--gray-200);
}

.admin-nav a.active {
    background: var(--primary);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Table */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
}

.alert-warning {
    background: #fef9c3;
    color: var(--warning);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--gray-500);
}

/* Version footer */
.version-footer {
    text-align: center;
    padding: 16px;
    color: var(--gray-500);
    font-size: 0.75rem;
}

/* Responsive */
@media (min-width: 640px) {
    .container {
        max-width: 600px;
    }
}
