/* Swimming Planner — Main Stylesheet */

:root {
    --primary: #0077b6;
    --primary-dark: #005f8a;
    --accent: #00b4d8;
    --success: #2d9c4a;
    --warning: #e6a817;
    --danger: #d64045;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #212529;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout */
.container { max-width: 900px; margin: 0 auto; padding: 1rem; }
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1rem; }
.card h2 { margin-bottom: 1rem; color: var(--primary); }

/* Navigation */
nav { background: var(--primary); padding: 0.75rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
nav a { color: #fff; text-decoration: none; padding: 0.4rem 0.8rem; border-radius: var(--radius); font-size: 0.9rem; }
nav a:hover, nav a.active { background: rgba(255,255,255,0.2); }
nav .brand { font-weight: 700; font-size: 1.1rem; margin-right: auto; }
nav .user-info { color: rgba(255,255,255,0.8); font-size: 0.85rem; }

/* Forms */
form { display: flex; flex-direction: column; gap: 0.75rem; }
label { font-weight: 500; font-size: 0.9rem; }
input, select, textarea {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    width: 100%;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,119,182,0.15); }
textarea { resize: vertical; min-height: 60px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.6rem 1.2rem; border: none; border-radius: var(--radius);
    font-size: 0.9rem; font-weight: 500; cursor: pointer; text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: #fde8e8; color: var(--danger); border: 1px solid #f5c6c6; }
.alert-success { background: #e8f5e9; color: var(--success); border: 1px solid #c8e6c9; }

/* Tables */
.swim-list { width: 100%; border-collapse: collapse; }
.swim-list th, .swim-list td { padding: 0.6rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.swim-list th { font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; }
.swim-list tr:hover { background: var(--bg); }

/* Suggestions */
.suggestion-card { border-left: 4px solid var(--accent); }
.suggestion-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.suggestion-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }

/* Tasks */
.task-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: none; }
.task-status { padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; cursor: pointer; border: none; }
.task-status.not_started { background: #e9ecef; color: var(--text-muted); }
.task-status.in_progress { background: #fff3cd; color: #856404; }
.task-status.done { background: #d4edda; color: #155724; }
.task-title { flex: 1; }
.task-title.done { text-decoration: line-through; color: var(--text-muted); }
.task-notes { font-size: 0.8rem; color: var(--text-muted); width: 100%; margin-top: 0.25rem; }

/* Progress bar */
.progress { height: 6px; background: #e9ecef; border-radius: 3px; overflow: hidden; margin-top: 0.5rem; }
.progress-bar { height: 100%; background: var(--success); transition: width 0.3s; }

/* Chart container */
.chart-container { position: relative; height: 300px; margin-top: 1rem; }

/* Gate page */
.gate-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.gate-card { max-width: 380px; width: 100%; text-align: center; }
.gate-card h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.gate-card p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Auth pages */
.auth-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.auth-card { max-width: 380px; width: 100%; }
.auth-card h1 { text-align: center; margin-bottom: 1.5rem; color: var(--primary); }
.auth-card .link { text-align: center; margin-top: 1rem; font-size: 0.9rem; }
.auth-card .link a { color: var(--primary); }

/* Inline form row */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--card-bg); border-radius: var(--radius); padding: 1.5rem; max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto; }
.modal h2 { margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

/* Responsive */
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .swim-list { font-size: 0.8rem; }
    nav { font-size: 0.85rem; }
}
