/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary-color: #06b6d4;
    --secondary-light: #67e8f9;
    --success-color: #10b981;
    --success-light: #6ee7b7;
    --warning-color: #f59e0b;
    --warning-light: #fbbf24;
    --error-color: #ef4444;
    --error-light: #f87171;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgb(99 102 241 / 0.15);
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --border-radius-xl: 32px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    --gradient-success: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    --gradient-warning: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    --gradient-error: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
    --gradient-bg: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f1f5f9 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient-bg);
    color: var(--gray-800);
    line-height: 1.6;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* GDPR Notice */
.gdpr-notice {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 0.75rem;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.gdpr-notice.hidden {
    display: none;
}

.gdpr-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.gdpr-content p {
    margin: 0;
    font-size: 0.9rem;
}

.btn-accept {
    background: var(--white);
    color: var(--primary-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-accept:hover {
    background: var(--gray-100);
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px 0 rgb(0 0 0 / 0.06);
    padding: 0.75rem 0;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    background: var(--gradient-primary);
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

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

.status-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.status {
    font-size: 0.875rem;
    font-weight: 500;
}

.status.online {
    color: var(--success-color);
}

.status.offline {
    color: var(--error-color);
}

.current-time {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* Main Container */
.main-container {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
    display: flex;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.screen-header {
    text-align: center;
    margin-bottom: clamp(0.25rem, 1vh, 0.5rem);
    flex-shrink: 0;
    padding: 0 0.5rem;
}

.screen-header h2 {
    font-size: clamp(1.25rem, 3.5vw, 1.75rem);
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: clamp(0.125rem, 0.5vh, 0.25rem);
}

.screen-header p {
    font-size: clamp(0.8rem, 2vw, 1rem);
    color: var(--gray-600);
}

/* Worker Selection Screen */
.search-container {
    margin-bottom: clamp(0.25rem, 1vh, 0.5rem);
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: block;
    padding: clamp(0.75rem, 2vw, 1rem) 1rem;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    border: 2px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--border-radius-lg);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow), 0 0 0 4px rgba(99, 102, 241, 0.1);
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-focus-ring-color: rgba(99, 102, 241, 0.3);
    -webkit-tap-highlight-color: transparent;
    background: var(--white);
    transform: scale(1.02);
}

.workers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: min-content;
    gap: clamp(0.5rem, 1.5vh, 1rem);
    margin-top: clamp(0.25rem, 1vh, 0.5rem);
    overflow-y: auto;
    flex: 1;
    padding: clamp(0.25rem, 1vh, 0.5rem);
    /* Scrollbar personalizado */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--gray-200);
}

.workers-grid::-webkit-scrollbar {
    width: 8px;
}

.workers-grid::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: 4px;
}

.workers-grid::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.workers-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.worker-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, 0.5);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.worker-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.6s;
}

.worker-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px) scale(1.02);
    background: rgba(255, 255, 255, 0.95);
}

.worker-card:hover::before {
    left: 100%;
}

.worker-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(165, 180, 252, 0.05) 100%);
    box-shadow: var(--shadow-glow);
    transform: scale(1.02);
}

.worker-avatar {
    width: 100%;
    max-width: 80px;
    aspect-ratio: 1 / 1; /* Mantiene la relación de aspecto 1:1 */
    border-radius: 50%;
    margin: 0 auto 1rem;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.5rem, 4vw, 2rem); /* Tamaño de fuente responsivo */
    color: var(--white);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.worker-avatar::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    transition: var(--transition);
    opacity: 0;
}

.worker-card:hover .worker-avatar {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.worker-card:hover .worker-avatar::before {
    opacity: 1;
    animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.worker-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.worker-id {
    font-size: 0.9rem;
    color: var(--gray-500);
}

/* Worker Status Badge - Enhanced with animations */
.worker-status-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 3px solid var(--white);
    transition: all 0.3s ease;
    z-index: 10;
}

.worker-status-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Active Status - Pulsing green animation */
.worker-status-badge.status-active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: var(--white);
    animation: pulse-active 2s infinite;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

@keyframes pulse-active {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    }
}

/* Paused Status - Blinking orange animation */
.worker-status-badge.status-paused {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: var(--white);
    animation: blink-paused 1.5s infinite;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

@keyframes blink-paused {
    0%, 50% {
        opacity: 1;
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    }
    75% {
        opacity: 0.6;
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
    }
    100% {
        opacity: 1;
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    }
}

/* Closed Status - Subtle fade animation */
.worker-status-badge.status-closed {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: var(--white);
    animation: fade-closed 3s infinite;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

@keyframes fade-closed {
    0%, 70% {
        opacity: 1;
    }
    85% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

/* Offline Status - Static gray */
.worker-status-badge.status-offline {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: var(--white);
    opacity: 0.8;
    box-shadow: 0 4px 12px rgba(156, 163, 175, 0.3);
}

/* Add a subtle glow effect for better visibility */
.worker-status-badge::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: inherit;
    filter: blur(4px);
    opacity: 0.3;
    z-index: -1;
}

/* PIN Entry Screen */
.pin-container {
    max-width: 400px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(0.25rem, 1vh, 0.5rem);
    min-height: 0;
    height: 100%;
}

.pin-display {
    flex-shrink: 0;
    margin-bottom: clamp(0.5rem, 2vh, 1rem);
}

.pin-field {
    width: 100%;
    padding: clamp(0.5rem, 2vw, 1rem) 1rem;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    text-align: center;
    border: 2px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--border-radius-lg);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    letter-spacing: clamp(0.25rem, 1vw, 0.5rem);
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.pin-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow), 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: var(--white);
    transform: scale(1.02);
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(0.25rem, 1.5vw, 0.75rem);
    flex: 1;
    align-content: center;
    min-height: 0;
}

.pin-btn {
    aspect-ratio: 1;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: 600;
    border: 2px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: clamp(35px, 6vh, 55px);
    max-height: clamp(40px, 8vh, 60px);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.pin-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.pin-btn:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pin-btn:hover::before {
    width: 100px;
    height: 100px;
}

.pin-btn:active {
    transform: scale(0.95) translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.pin-btn:active::before {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
}

.pin-btn.clear {
    background: var(--gradient-error);
    color: var(--white);
    border-color: var(--error-color);
    box-shadow: var(--shadow-md);
}

.pin-btn.clear:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.pin-btn.confirm {
    background: var(--gradient-success);
    color: var(--white);
    border-color: var(--success-color);
    box-shadow: var(--shadow-md);
}

.pin-btn.confirm:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.pin-actions {
    display: flex;
    flex-direction: column;
    gap: clamp(0.25rem, 1vh, 0.5rem);
    flex-shrink: 0;
    margin-top: clamp(0.25rem, 1vh, 0.5rem);
}

/* Time Tracking Screen */
.worker-status {
    background: var(--gray-100);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    margin-top: 0.5rem;
    display: inline-block;
}

.worker-status.active {
    background: var(--success-color);
    color: var(--white);
}

.worker-status.paused {
    background: var(--warning-color);
    color: var(--white);
}

.time-display {
    text-align: center;
    margin: clamp(0.25rem, 1vh, 0.5rem) 0;
    flex-shrink: 0;
}

.time-counter {
    background: var(--white);
    padding: clamp(1rem, 3vw, 1.5rem);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    display: inline-block;
}

.time-counter span {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.time-counter small {
    color: var(--gray-600);
    font-size: 1rem;
    margin-top: 0.5rem;
    display: block;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: clamp(0.5rem, 1.5vh, 1rem);
    margin: clamp(0.25rem, 1vh, 0.5rem) 0;
    flex-shrink: 0;
}

.action-btn {
    padding: clamp(1rem, 2.5vw, 1.5rem);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    min-height: clamp(60px, 8vh, 80px);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.action-btn.entry {
    background: var(--success-color);
    color: var(--white);
}

.action-btn.entry:hover:not(:disabled) {
    background: #059669;
}

.action-btn.pause {
    background: var(--warning-color);
    color: var(--white);
}

.action-btn.pause:hover:not(:disabled) {
    background: #d97706;
}

.action-btn.resume {
    background: var(--secondary-color);
    color: var(--white);
}

.action-btn.resume:hover:not(:disabled) {
    background: #0891b2;
}

.action-btn.exit {
    background: var(--error-color);
    color: var(--white);
}

.action-btn.exit:hover:not(:disabled) {
    background: #dc2626;
}

.secondary-actions {
    display: flex;
    justify-content: center;
    gap: clamp(0.5rem, 1.5vh, 1rem);
    margin-top: clamp(0.25rem, 1vh, 0.5rem);
    flex-shrink: 0;
}

/* History Screen */
.history-filters {
    margin-bottom: clamp(0.5rem, 1.5vh, 1rem);
    text-align: center;
    flex-shrink: 0;
}

.history-filters .search-input {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
}

.history-records {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.history-record {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-record:last-child {
    border-bottom: none;
}

.record-info {
    flex: 1;
}

.record-date {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.record-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.record-action {
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.record-action.entry {
    background: rgb(16 185 129 / 0.1);
    color: var(--success-color);
}

.record-action.pause {
    background: rgb(245 158 11 / 0.1);
    color: var(--warning-color);
}

.record-action.resume {
    background: rgb(6 182 212 / 0.1);
    color: var(--secondary-color);
}

.record-action.exit {
    background: rgb(239 68 68 / 0.1);
    color: var(--error-color);
}

.record-time {
    font-weight: 600;
    color: var(--gray-600);
}

.history-actions {
    text-align: center;
    margin-top: clamp(0.5rem, 1.5vh, 1rem);
    flex-shrink: 0;
}

/* Buttons */
.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-back {
    background: var(--gray-600);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-back:hover {
    background: var(--gray-700);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem 1.5rem 0;
    text-align: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
}

.modal-body {
    padding: 1.5rem;
    text-align: center;
}

.modal-body p {
    font-size: 1.1rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.modal-details {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.modal-actions {
    padding: 0 1.5rem 1.5rem;
    text-align: center;
}

.modal.error .modal-content {
    border-top: 4px solid var(--error-color);
}

/* Inactivity Warning Modal */
.modal.inactivity-warning .modal-content {
    border-top: 4px solid var(--warning-color);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.modal.inactivity-warning .modal-header h3 {
    color: var(--warning-color);
    font-weight: 700;
}

.modal.inactivity-warning .modal-body {
    padding: 2rem 1.5rem;
}

.modal.inactivity-warning .modal-body p {
    font-size: 1.2rem;
    color: var(--gray-700);
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.inactivity-countdown {
    background: var(--warning-color);
    color: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.inactivity-countdown p {
    margin: 0;
    font-size: 1.1rem;
    color: var(--white) !important;
}

.inactivity-countdown span {
    font-size: 1.3rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.modal.inactivity-warning .btn-primary {
    background: var(--success-color);
    border-color: var(--success-color);
    font-size: 1.1rem;
    padding: 0.875rem 2rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.modal.inactivity-warning .btn-primary:hover {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.error-details {
    background: rgb(239 68 68 / 0.1);
    color: var(--error-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    font-weight: 500;
}

/* Footer */
.footer {
    background: var(--gray-800);
    color: var(--gray-300);
    padding: clamp(0.25rem, 1vh, 0.5rem) 0;
    text-align: center;
    flex-shrink: 0;
}

.footer p {
    margin: 0.125rem 0;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        padding: 0.25rem;
    }
    
    .worker-avatar {
        max-width: 60px;
    }
    
    .workers-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .header-content {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
        padding: 0 0.25rem;
    }
    
    .gdpr-content {
        flex-direction: column;
        text-align: center;
        padding: 0.5rem;
    }
    
    .workers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(0.5rem, 1vh, 0.75rem);
        padding: clamp(0.25rem, 0.5vh, 0.5rem);
    }
    
    .worker-card {
        height: clamp(130px, 18vh, 160px);
        padding: clamp(0.75rem, 1.5vh, 1rem);
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
        gap: clamp(0.5rem, 1vh, 0.75rem);
    }
    
    .secondary-actions {
        flex-direction: column;
        gap: clamp(0.5rem, 1vh, 0.75rem);
    }
    
    .time-counter {
        padding: 1.5rem;
    }
    
    .time-counter span {
        font-size: 2rem;
    }
    
    .screen-header h2 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .screen-header {
        margin-bottom: clamp(0.5rem, 1vh, 0.75rem);
    }
    
    .history-record {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .pin-container {
        padding: 0.25rem;
        justify-content: space-between;
    }
    
    .pin-display {
        margin-bottom: clamp(0.25rem, 1vh, 0.5rem);
    }
    
    .pin-keypad {
        gap: clamp(0.25rem, 0.8vh, 0.375rem);
        min-height: 0;
    }
    
    .pin-field {
        padding: 0.5rem 0.75rem;
        font-size: clamp(1.125rem, 4vw, 1.5rem);
        letter-spacing: 0.125rem;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 0.25rem;
    }
    
    .header {
        padding: 0.375rem 0;
    }
    
    .pin-keypad {
        gap: 0.5rem;
    }
    
    .pin-btn {
        min-height: clamp(32px, 5vh, 45px);
        max-height: clamp(38px, 6vh, 50px);
        font-size: clamp(0.9rem, 3.5vw, 1.2rem);
    }
    
    .pin-actions {
        gap: clamp(0.25rem, 0.8vh, 0.5rem);
        margin-top: clamp(0.25rem, 0.8vh, 0.5rem);
    }
    
    .btn-secondary, .btn-back {
        padding: clamp(0.375rem, 1.5vw, 0.75rem) clamp(0.75rem, 2vw, 1rem);
        font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    }
    
    .action-btn {
        padding: clamp(0.75rem, 2vw, 1rem);
        font-size: clamp(0.9rem, 2.5vw, 1rem);
        min-height: clamp(50px, 6vh, 60px);
    }
    
    .worker-card {
        padding: 1rem;
    }
    
    .worker-status-badge {
        top: 0.5rem;
        right: 0.5rem;
        width: 20px;
        height: 20px;
        font-size: 0.625rem;
    }
    
    .worker-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .workers-grid {
        grid-template-columns: 1fr;
        gap: clamp(0.5rem, 1vh, 0.75rem);
    }
    
    .worker-card {
        height: clamp(120px, 16vh, 140px);
        padding: clamp(0.75rem, 1.2vh, 1rem);
    }
    
    .history-records {
        min-height: 0;
    }
    
    .screen-header h2 {
        font-size: 1.25rem;
    }
    
    .time-counter span {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }
    
    .screen-header {
        margin-bottom: clamp(0.25rem, 0.8vh, 0.5rem);
    }
    
    .screen-header h2 {
        font-size: clamp(1.25rem, 4vw, 1.5rem);
        margin-bottom: 0.125rem;
    }
    
    .screen-header p {
        font-size: clamp(0.8rem, 2.5vw, 1rem);
    }
    
    .footer {
        padding: 0.25rem 0;
    }
}

/* Exit Session Modal Styles */
.exit-modal .modal-content {
    max-width: 600px;
    width: 90%;
}

.exit-modal-content {
    padding: 0;
}

.session-summary {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-200);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
}

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

.summary-label {
    font-weight: 500;
    color: var(--gray-600);
}

.summary-value {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 1.1rem;
}

.signature-section {
    margin-top: 1rem;
}

.signature-section h4 {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.signature-instruction {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.signature-container {
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1rem;
    background: var(--white);
    text-align: center;
}

#signature-canvas {
    border: 1px dashed var(--gray-300);
    border-radius: 8px;
    cursor: crosshair;
    background: var(--white);
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

#signature-canvas:hover {
    border-color: var(--primary-color);
}

.signature-controls {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.exit-modal .modal-actions {
    padding: 1.5rem;
    gap: 1rem;
}

.exit-modal .modal-actions button {
    flex: 1;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
}

#confirm-exit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive adjustments for exit modal */
@media (max-width: 768px) {
    .exit-modal .modal-content {
        width: 95%;
        max-width: none;
    }
    
    #signature-canvas {
        width: 100%;
        max-width: 350px;
        height: 120px;
    }
    
    .summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .summary-value {
        font-size: 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --gray-200: #000000;
        --gray-300: #000000;
    }
}

/* Print styles */
@media print {
    .header,
    .footer,
    .action-buttons,
    .secondary-actions,
    .pin-keypad,
    .modal {
        display: none !important;
    }
    
    .main-container {
        padding: 0;
    }
    
    body {
        background: white;
    }
}
