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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0.5rem;
    color: var(--text-primary);
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

header {
    color: white;
    margin-bottom: 1rem;
    position: relative;
}

.header-content {
    text-align: center;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
}

.language-selector {
    position: absolute;
    top: 0;
    right: 0;
}

.gear-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.gear-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.gear-icon {
    font-size: 1.25rem;
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-width: 150px;
    z-index: 1000;
}

.lang-option {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-option:hover {
    background: var(--bg-color);
}

.lang-option.active {
    background: var(--primary-color);
    color: white;
}

.status-card,
.settings-card,
.statistics-card,
.history-card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}

.timer-display {
    text-align: center;
    margin-bottom: 1rem;
}

.time-remaining {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.25rem;
}

.time-remaining.warning {
    color: var(--warning-color);
}

.time-remaining.danger {
    color: var(--danger-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.check-in-btn {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.check-in-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

.check-in-btn.success {
    background: var(--success-color);
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.stop-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    background: var(--danger-color);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.stop-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3);
}

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

.btn-icon {
    font-size: 1.125rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 1s linear;
    border-radius: 4px;
}

.settings-card h2,
.statistics-card h2,
.history-card h2 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.setting-group {
    margin-bottom: 0.75rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input[type="number"],
.input-group input[type="datetime-local"] {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 0.375rem;
    transition: border-color 0.3s ease;
}

.input-group input[type="number"]:focus,
.input-group input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.setting-group input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}


.btn-secondary {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-color);
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.history-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 1rem;
    font-size: 0.875rem;
}

.history-item {
    padding: 0.625rem;
    border-left: 3px solid var(--success-color);
    background: var(--bg-color);
    margin-bottom: 0.375rem;
    border-radius: 0.375rem;
}

.history-item.missed {
    border-left-color: var(--danger-color);
}

.history-item.stopped {
    border-left-color: var(--text-secondary);
    opacity: 0.8;
}

.history-item-time {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    font-size: 0.875rem;
}

.history-item-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stats-input-group {
    margin-bottom: 0.75rem;
}

.stats-input-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.stats-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

.stat-item {
    background: var(--bg-color);
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-value.active {
    color: var(--success-color);
}

.stat-value.inactive {
    color: var(--danger-color);
}

.stat-value.warning {
    color: var(--warning-color);
}

footer {
    text-align: center;
    color: white;
    font-size: 0.75rem;
    margin-top: 1rem;
    opacity: 0.8;
}

@media (max-width: 640px) {
    body {
        padding: 0.375rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .time-remaining {
        font-size: 2rem;
    }

    .status-card,
    .settings-card,
    .statistics-card,
    .history-card {
        padding: 0.75rem;
    }

    .stats-results {
        grid-template-columns: 1fr;
    }

    .history-controls {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }
}
