/* ============================================
   Cave à Vin - Mobile First CSS - Light Theme
   v1.0.2
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-light: #f5f5f7;
    --bg-card: #ffffff;
    --accent: #722f37;
    --accent-light: #a4343a;
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --border: #d2d2d7;
    --border-light: #e5e5ea;
    --blanc: #f5e6a3;
    --rose: #f4a4b8;
    --rouge: #8b1a2b;
    --mousseux: #d4af37;
    --success: #34c759;
    --warning: #ff9500;
    --danger: #ff3b30;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 70px;
}

/* Navigation */
header {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
}

.nav-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    text-align: center;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-btn.active {
    color: #fff;
    background: var(--accent);
}

/* Main content */
main {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

h1 {
    font-size: 1.4rem;
    margin-bottom: 16px;
    color: var(--text);
}

h2 {
    font-size: 1.1rem;
    margin: 16px 0 8px;
    color: var(--text-muted);
}

/* 4 grilles cave côte à côte, alignées par le bas */
.cave-4grids {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 0;
    margin-bottom: 16px;
}

.cave-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.cave-section-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-align: center;
    white-space: nowrap;
    font-weight: 600;
}

.cave-section-mousseux .cave-section-label { color: #b8960e; }
.cave-section-rouge .cave-section-label { color: var(--rouge); }
.cave-section-blanc .cave-section-label { color: #9e8a2f; }
.cave-section-rose .cave-section-label { color: #c4577a; }

.cave-grid-wrap {
    background: var(--bg-card);
    border-radius: 6px;
    padding: 4px;
    border: 1px solid var(--border);
}

/* Grille cave */
.cave-grid {
    display: grid;
    gap: 2px;
}

.cave-cell {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.cave-cell.occupied {
    border-color: var(--border);
}

.cave-cell.couleur-1 { background: var(--blanc); color: #333; }
.cave-cell.couleur-2 { background: var(--rose); color: #333; }
.cave-cell.couleur-3 { background: var(--rouge); color: #fff; }
.cave-cell.couleur-4 { background: var(--mousseux); color: #333; }

.cave-cell:hover {
    transform: scale(1.3);
    z-index: 10;
}

/* Section tabs */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.tab {
    padding: 6px 10px;
    border-radius: 16px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}

.tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Cards / Listes */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}

.card:active {
    transform: scale(0.98);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.badge-blanc { background: var(--blanc); color: #333; }
.badge-rose { background: var(--rose); color: #333; }
.badge-rouge { background: var(--rouge); color: #fff; }
.badge-mousseux { background: var(--mousseux); color: #333; }

/* Boutons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    color: #fff;
}

.btn-primary { background: var(--accent); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); }
.btn-block { display: block; width: 100%; }

.btn:active {
    transform: scale(0.95);
}

/* Formulaires */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    color: var(--text);
    font-size: 15px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.1);
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

/* Switch toggle */
.switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.switch-group label {
    font-size: 14px;
    color: var(--text);
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle .slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .slider {
    background: var(--accent);
}

.toggle input:checked + .slider::before {
    transform: translateX(20px);
}

/* Photo upload */
.photo-preview {
    width: 150px;
    height: 200px;
    border-radius: 8px;
    background: var(--bg-light);
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px auto;
    overflow: hidden;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Statut badges */
.statut-1 { color: var(--warning); }
.statut-2 { color: var(--success); }
.statut-3 { color: var(--accent-light); }
.statut-4 { color: var(--text-muted); font-style: italic; }

/* Position display */
.position-tag {
    font-size: 11px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Légende */
.legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 8px 0 16px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Messages */
.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

.alert-success { background: rgba(52,199,89,0.1); border: 1px solid var(--success); color: #1b7a34; }
.alert-error { background: rgba(255,59,48,0.1); border: 1px solid var(--danger); color: #cc2f27; }

/* Actions bouteille */
.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

/* Login page */
.login-container {
    max-width: 320px;
    margin: 60px auto;
    padding: 24px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    text-align: center;
}

.login-container h1 {
    margin-bottom: 24px;
}

.login-container .btn {
    margin-top: 16px;
}
