/* Pushup Counter PWA Styles - High Contrast Version */

:root {
    /* Primary Colors - Brighter and more vibrant */
    --primary-color: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --secondary-color: #10B981;
    
    /* Backgrounds - Pure white and clean */
    --background: #FFFFFF;
    --surface: #F9FAFB;
    --card-background: #FFFFFF;
    
    /* Text - High contrast black */
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    
    /* States */
    --error: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
    
    /* On colors */
    --on-primary: #FFFFFF;
    
    /* Borders */
    --border-color: #E5E7EB;
    --border-color-strong: #D1D5DB;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --border-radius: 12px;
    --transition: all 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark mode - Better contrast */
        --background: #0F172A;
        --surface: #1E293B;
        --card-background: #1E293B;
        
        --text-primary: #F1F5F9;
        --text-secondary: #CBD5E1;
        --text-tertiary: #94A3B8;
        
        --primary-color: #818CF8;
        --primary-dark: #6366F1;
        --primary-light: #A5B4FC;
        
        --border-color: #334155;
        --border-color-strong: #475569;
        
        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    font-size: 16px;
}

/* App Container */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 600px;
    margin: 0 auto;
}

#app.hidden {
    display: none;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--card-background);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
}

.app-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    background: var(--card-background);
    border-top: 2px solid var(--border-color);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
    padding: 4px 0;
    z-index: 50;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: var(--transition);
    border-radius: 8px;
    margin: 0 4px;
}

.nav-item.hidden {
    display: none;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-secondary);
}

.nav-item.active {
    color: var(--primary-color);
    font-weight: 700;
    background: rgba(99, 102, 241, 0.1);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
}

/* Auth Screen */
.auth-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    padding: 20px;
}

.auth-screen.hidden {
    display: none;
}

.auth-container {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 48px 36px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 440px;
    width: 100%;
}

.auth-logo {
    font-size: 72px;
    margin-bottom: 24px;
}

.auth-container h1 {
    margin-bottom: 12px;
    color: #111827;
    font-size: 28px;
    font-weight: 800;
}

.auth-subtitle {
    color: #6B7280;
    margin-bottom: 36px;
    line-height: 1.6;
    font-size: 16px;
}

/* Buttons */
.btn-primary, .btn-secondary, .google-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: var(--primary-color);
    color: #FFFFFF;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border-color-strong);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--text-tertiary);
}

.google-btn {
    width: 100%;
    background: #FFFFFF;
    color: #1F2937;
    border: 2px solid #E5E7EB;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.google-btn:hover {
    background: #F9FAFB;
    box-shadow: var(--shadow-md);
    border-color: #D1D5DB;
}

/* Cards */
.card {
    background: var(--card-background);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(99,102,241,0.25);
    border: none;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}

.stat-value {
    font-size: 40px;
    font-weight: 800;
    color: white;
    margin-bottom: 6px;
    line-height: 1;
    letter-spacing: -1px;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.95);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Form Elements */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid var(--border-color-strong);
    border-radius: 10px;
    font-size: 17px;
    transition: var(--transition);
    background: var(--card-background);
    color: var(--text-primary);
    font-weight: 500;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Number Input with Buttons */
.number-input-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.number-input-group button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #FFFFFF;
    border: none;
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.number-input-group button:hover {
    background: var(--primary-dark);
    transform: scale(1.08);
    box-shadow: var(--shadow-md);
}

.number-input-group button:active {
    transform: scale(1);
}

.number-input-group input {
    flex: 1;
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
}

/* Date Picker */
.date-picker {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.date-picker button {
    padding: 12px 20px;
    border: 2px solid var(--border-color-strong);
    background: var(--card-background);
    color: var(--text-primary);
    border-radius: 24px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 15px;
}

.date-picker button:hover {
    background: var(--surface);
    border-color: var(--primary-color);
}

.date-picker button.active {
    background: var(--primary-color);
    color: #FFFFFF;
    border-color: var(--primary-color);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

/* Quick Add Buttons */
.quick-add-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.quick-add-btn {
    flex: 1;
    padding: 18px 16px;
    border: 3px solid var(--primary-color);
    background: var(--card-background);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.quick-add-btn:hover {
    background: var(--primary-color);
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* Entries List */
.entries-list {
    margin-top: 28px;
}

.entries-list h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

.entry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.entry-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.entry-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.entry-count {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-color);
}

.entry-time {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.delete-btn {
    padding: 10px 18px;
    background: #FFFFFF;
    color: var(--error);
    border: 2px solid var(--error);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 15px;
    font-weight: 700;
}

.delete-btn:hover {
    background: var(--error);
    color: #FFFFFF;
    transform: scale(1.05);
}

.delete-btn:active {
    transform: scale(1);
}

/* Leaderboard */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.leaderboard-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.leaderboard-rank {
    font-size: 26px;
    font-weight: 800;
    width: 60px;
    text-align: center;
    color: var(--text-secondary);
}

.leaderboard-rank.top {
    font-size: 32px;
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-weight: 700;
    font-size: 17px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.leaderboard-stats {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.leaderboard-count {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-color);
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
}

.toast {
    background: var(--card-background);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
    max-width: 320px;
    border: 2px solid var(--border-color);
    font-weight: 600;
}

.toast.success {
    background: var(--success);
    color: #FFFFFF;
    border-color: var(--success);
}

.toast.error {
    background: var(--error);
    color: #FFFFFF;
    border-color: var(--error);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Error Message */
.error-message {
    background: #FFEBEE;
    color: var(--error);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-top: 16px;
    text-align: center;
}

.error-message.hidden {
    display: none;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: 100px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 100px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--outline);
    transition: var(--transition);
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Time Picker */
.time-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: var(--card-background);
    border: 1px solid var(--outline);
    border-radius: var(--border-radius);
}

.time-btn {
    min-width: 36px;
    width: 36px;
    min-height: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--on-primary);
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.time-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.time-input {
    display: none;
}

.time-display {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--on-surface);
}

/* Responsive */
@media (max-width: 600px) {
    body {
        font-size: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }
    
    .main-content {
        padding: 8px;
        padding-bottom: 90px;
        max-width: 100%;
    }
    
    .stat-card {
        padding: 14px;
        min-height: 90px;
    }
    
    .stat-card h2 {
        font-size: 28px;
        line-height: 1.1;
    }
    
    .stat-value {
        font-size: 36px !important;
        margin-bottom: 6px;
    }
    
    .stat-label {
        font-size: 11px;
        letter-spacing: 0.5px;
    }
    
    .card {
        padding: 14px;
        margin-bottom: 10px;
        border-radius: 10px;
    }
    
    .card h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .card p {
        font-size: 13px;
    }
    
    .app-header {
        padding: 10px 12px;
        position: sticky;
        top: 0;
        z-index: 100;
        backdrop-filter: blur(20px);
        background: rgba(15, 23, 42, 0.8);
    }
    
    .app-header h1 {
        font-size: 18px;
    }
    
    .btn-secondary {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .bottom-nav {
        padding: 6px 0;
        gap: 0;
        height: 68px;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
    }
    
    .nav-item {
        padding: 6px 4px;
        min-width: unset;
        flex: 1;
        border-radius: 0;
    }
    
    .nav-item.active {
        background: transparent;
        color: var(--primary-light);
    }
    
    .nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 3px;
        background: var(--primary-color);
        border-radius: 0 0 3px 3px;
    }
    
    .nav-icon {
        font-size: 22px;
        margin-bottom: 2px;
    }
    
    .nav-label {
        font-size: 10px;
        font-weight: 600;
    }
    
    .form-group {
        margin-bottom: 14px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-input {
        padding: 12px;
        font-size: 16px;
        border-radius: 10px;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 13px 20px;
        font-size: 15px;
        border-radius: 10px;
        font-weight: 700;
    }
    
    .quick-add-buttons {
        gap: 8px;
    }
    
    .quick-add-btn {
        padding: 12px;
        font-size: 15px;
        font-weight: 700;
        border-radius: 10px;
    }
    
    .entry-item {
        padding: 10px 12px;
        font-size: 13px;
        border-radius: 8px;
        margin-bottom: 8px;
    }
    
    .entry-info {
        gap: 6px;
    }
    
    .delete-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .leaderboard-item {
        padding: 12px;
        font-size: 14px;
        border-radius: 10px;
        margin-bottom: 8px;
    }
    
    .rank {
        font-size: 15px;
        width: 34px;
        height: 34px;
        min-width: 34px;
    }
    
    .user-info h3 {
        font-size: 14px;
    }
    
    .user-info p {
        font-size: 11px;
    }
    
    .settings-group {
        padding: 14px;
        margin-bottom: 10px;
        border-radius: 10px;
    }
    
    .settings-group h3 {
        font-size: 15px;
        margin-bottom: 12px;
    }
    
    .time-picker-group {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .time-picker {
        width: 100%;
    }
    
    .time-picker label {
        font-size: 12px;
    }
    
    .time-display {
        font-size: 18px;
        padding: 10px;
    }
    
    .time-btn {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }
    
    .progress-bar {
        height: 10px;
        border-radius: 5px;
    }
    
    /* Hide scrollbar on mobile for cleaner look */
    .main-content::-webkit-scrollbar {
        display: none;
    }
    
    .main-content {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    /* Improved touch targets */
    button {
        min-height: 44px;
    }
    
    /* Better spacing for stats screen */
    .stats-grid + .card {
        margin-top: 8px;
    }
    
    /* Compact leaderboard rank badges */
    .leaderboard-rank.top {
        font-size: 18px;
    }
    
    /* Better contrast for mobile */
    .card {
        background: var(--card-background);
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }
}

/* iOS Safe Area */
@supports (padding-top: env(safe-area-inset-top)) {
    .app-header {
        padding-top: calc(16px + env(safe-area-inset-top));
    }
    
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
