/* QPal - Trainer Client App Styles */

:root {
    --primary: #4F46E5;
    --primary-light: #6366F1;
    --primary-dark: #3730A3;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --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 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: #fff;
    position: relative;
}

/* Header */
.header {
    background: var(--primary);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header h1 {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}
.header .btn-back {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}
.header .btn-action {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

/* Tab bar */
.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    background: #fff;
    position: sticky;
    top: 54px;
    z-index: 99;
}
.tab-bar button {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-bar button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Bottom nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-top: 1px solid var(--gray-200);
    display: flex;
    padding-bottom: var(--safe-bottom);
    z-index: 100;
}
.bottom-nav button {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: none;
    font-size: 11px;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.bottom-nav button.active {
    color: var(--primary);
}
.bottom-nav .nav-icon {
    font-size: 22px;
}

/* Cards */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin: 12px 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}
.card-subtitle {
    font-size: 13px;
    color: var(--gray-500);
}

/* Client list */
.client-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s;
}
.client-item:active { background: var(--gray-50); }
.client-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}
.client-info { flex: 1; }
.client-name { font-weight: 600; font-size: 15px; }
.client-meta { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.client-arrow { color: var(--gray-300); font-size: 18px; }

/* Checklist */
.checklist-section {
    margin: 16px;
}
.checklist-category {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 8px;
}
.checklist-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    gap: 12px;
}
.checklist-checkbox {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    font-size: 14px;
    color: transparent;
}
.checklist-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.checklist-item-content { flex: 1; }
.checklist-item-title {
    font-size: 15px;
    font-weight: 500;
}
.checklist-item-title.done {
    text-decoration: line-through;
    color: var(--gray-500);
}
.checklist-item-detail {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* Progress ring */
.progress-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px 16px;
}
.progress-ring {
    position: relative;
    width: 80px;
    height: 80px;
}
.progress-ring svg {
    transform: rotate(-90deg);
}
.progress-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}
.progress-stats {
    font-size: 14px;
    color: var(--gray-700);
}
.progress-stats div { margin: 4px 0; }

/* Forms */
.form-group {
    margin: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* Buttons */
.btn {
    display: block;
    width: calc(100% - 32px);
    margin: 16px;
    padding: 14px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.2s;
}
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-sm {
    width: auto;
    display: inline-block;
    padding: 8px 16px;
    margin: 4px;
    font-size: 13px;
}

/* FAB */
.fab {
    position: fixed;
    bottom: 80px;
    right: calc(50% - 210px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
}
.login-logo {
    font-size: 48px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}
.login-subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
    font-size: 14px;
}
.login-page .form-group { width: 100%; margin: 8px 0; }
.login-page .btn { width: 100%; margin: 16px 0 8px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 32px;
    color: var(--gray-500);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; }

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 200;
    animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Date selector */
.date-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
}
.date-selector button {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--primary);
    cursor: pointer;
    padding: 4px 8px;
}
.date-selector .date-text {
    font-size: 15px;
    font-weight: 600;
    min-width: 140px;
    text-align: center;
}

/* Utility */
.p-16 { padding: 16px; }
.mb-80 { margin-bottom: 80px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--gray-500); }
.hidden { display: none !important; }

/* Category badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge-diet { background: #FEF3C7; color: #92400E; }
.badge-training { background: #DBEAFE; color: #1E40AF; }
.badge-supplement { background: #E0E7FF; color: #3730A3; }
.badge-water { background: #CFFAFE; color: #155E75; }
.badge-walk { background: #D1FAE5; color: #065F46; }
.badge-custom { background: var(--gray-100); color: var(--gray-700); }
