/* =========================
   MonCoachIA - CSS Principal
   Style sobre, mobile-first
   ========================= */

:root {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #8e8e93;
    --accent: #0071e3;
    --accent-light: #e8f4fd;
    --success: #34c759;
    --warning: #ff9500;
    --danger: #ff3b30;
    --border: #d2d2d7;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --nav-height: 64px;
}

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + 16px);
}

/* =========================
   Main Content
   ========================= */
.main-content {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

/* =========================
   Bottom Navigation
   ========================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 8px 12px;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--accent);
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
}

/* =========================
   Cards
   ========================= */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* =========================
   Date Header
   ========================= */
.date-header {
    text-align: center;
    padding: 16px 0;
}

.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.date-nav-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.5rem;
    padding: 8px;
    cursor: pointer;
}

.date-display {
    font-size: 1.1rem;
    font-weight: 600;
}

.date-weekday {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* =========================
   Forms
   ========================= */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* =========================
   Buttons
   ========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:active {
    background: #0062cc;
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-dark {
    background: #000000 !important;
    color: #ffffff !important;
    border: none !important;
}
.btn-dark:hover, .btn-dark:active {
    background: #333333 !important;
    color: #ffffff !important;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

/* =========================
   Range Slider
   ========================= */
.range-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-input {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.range-value {
    min-width: 32px;
    text-align: center;
    font-weight: 600;
    color: var(--accent);
}

/* =========================
   Checkbox
   ========================= */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.checkbox-input {
    width: 22px;
    height: 22px;
    accent-color: var(--accent);
}

.checkbox-label {
    font-size: 0.95rem;
}

/* =========================
   Collapsible Sections
   ========================= */
.collapsible {
    border-bottom: 1px solid var(--border);
}

.collapsible:last-child {
    border-bottom: none;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    cursor: pointer;
}

.collapsible-title {
    font-weight: 500;
}

.collapsible-arrow {
    transition: transform 0.2s;
}

.collapsible.open .collapsible-arrow {
    transform: rotate(180deg);
}

.collapsible-content {
    display: none;
    padding-bottom: 12px;
}

.collapsible.open .collapsible-content {
    display: block;
}

/* =========================
   Status Badge
   ========================= */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
}

.badge-success {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 149, 0, 0.15);
    color: var(--warning);
}

.badge-muted {
    background: var(--bg-primary);
    color: var(--text-muted);
}

/* =========================
   Summary Row
   ========================= */
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-primary);
}

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

.summary-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.summary-value {
    font-weight: 500;
}

/* =========================
   Exercise List
   ========================= */
.exercise-item {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
}

.exercise-name {
    font-weight: 500;
    margin-bottom: 8px;
}

.exercise-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.exercise-info-btn {
    background: none;
    border: none;
    color: var(--accent);
    padding: 4px;
    cursor: pointer;
}

/* =========================
   Sets Table
   ========================= */
.sets-table {
    width: 100%;
    margin-top: 8px;
}

.sets-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.sets-number {
    width: 28px;
    height: 28px;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.sets-input {
    width: 60px;
    padding: 8px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.sets-unit {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 24px;
}

.sets-delete {
    background: none;
    border: none;
    color: var(--danger);
    padding: 4px;
    cursor: pointer;
    opacity: 0.6;
}

.sets-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    color: var(--accent);
    background: var(--accent-light);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
    margin-top: 8px;
}

/* =========================
   List Items
   ========================= */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.list-item-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.list-item-arrow {
    color: var(--text-muted);
}

/* =========================
   Empty State
   ========================= */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* =========================
   Login Page
   ========================= */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* =========================
   Week View
   ========================= */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 16px;
}

.week-day {
    text-align: center;
    padding: 8px 4px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.week-day.active {
    background: var(--accent);
    color: white;
}

.week-day.has-workout::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    margin: 4px auto 0;
}

.week-day-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.week-day-number {
    font-weight: 600;
}

/* =========================
   Modal
   ========================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s;
    padding-bottom: env(safe-area-inset-bottom);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.modal-body {
    padding: 16px;
}

/* =========================
   Utilities
   ========================= */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* Exercise thumbnail */
.exercise-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-card);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.exercise-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-dark);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}
.btn-icon:hover {
    background: var(--accent);
    color: white;
}

/* Bouton suppression (croix rouge) */
.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    color: #e74c3c !important;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none !important;
    margin-left: 8px;
    transition: all 0.2s;
    line-height: 1;
    border: none;
}
.btn-delete:hover {
    background: #e74c3c;
    color: white !important;
    text-decoration: none !important;
}
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* =========================
   Coach Style Selector
   ========================= */
.coach-styles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.coach-style-option {
    flex: 1 1 calc(50% - 4px);
    min-width: 140px;
    cursor: pointer;
}

.coach-style-option input {
    display: none;
}

.coach-style-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    transition: all 0.2s ease;
    text-align: center;
}

.coach-style-option input:checked + .coach-style-card {
    border-color: var(--accent);
    background: var(--accent-light);
}

.coach-style-icon {
    color: var(--accent);
    margin-bottom: 4px;
}

.coach-style-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.coach-style-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}
