/* CSS Variables */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent-green: #00C853;
    --accent-red: #FF3B30;
    --accent-blue: #007AFF;
    --border-radius: 16px;
    --button-height: 56px;
    --timer-font-size: 48px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* App container */
.app-container {
    width: 100%;
    max-width: 420px;
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gps-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gps-indicator {
    position: relative;
    width: 12px;
    height: 12px;
}

.gps-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-green);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    animation: pulse 2s infinite;
}

.gps-dot.searching {
    background-color: var(--text-secondary);
    animation: none;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

#gps-status-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    padding: 20px;
}

/* Timer Section */
.timer-section {
    text-align: center;
    margin-bottom: 32px;
}

.timer-display {
    font-size: var(--timer-font-size);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

/* Stats Section */
.stats-section {
    margin-bottom: 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    margin-bottom: 4px;
}

.stat-unit {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.btn-start {
    width: 100%;
    height: var(--button-height);
    background-color: var(--accent-green);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.btn-start:hover {
    transform: scale(0.98);
}

.btn-start:active {
    transform: scale(0.97);
}

.btn-start.stop {
    background-color: var(--accent-red);
}

.btn-save {
    width: 100%;
    height: var(--button-height);
    background-color: transparent;
    color: var(--text-primary);
    border: 2px solid var(--bg-secondary);
    border-radius: 16px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s ease;
}

.btn-save:hover:not(:disabled) {
    background-color: var(--bg-secondary);
    transform: scale(0.98);
}

.btn-save:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-save:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* History Section */
.history-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.runs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.run-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.run-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.run-date {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.run-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

.run-badge {
    display: flex;
    align-items: center;
    gap: 4px;
}

.synced-badge {
    background-color: rgba(0, 200, 83, 0.2);
    color: var(--accent-green);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
}

.no-runs {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 32px 16px;
}

/* Responsive Design */
@media (min-width: 768px) {
    body {
        padding: 40px;
    }
    
    .app-container {
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 420px;
    }
}

/* Utility classes */
.text-secondary {
    color: var(--text-secondary);
}

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