/* ============================================
   Congélo - Mobile First CSS - Light Theme
   v1.0.0
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-light: #f5f5f7;
    --bg-card: #ffffff;
    --accent: #2196F3;
    --accent-light: #64B5F6;
    --accent-dark: #1565C0;
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --border: #d2d2d7;
    --border-light: #e5e5ea;
    --success: #34c759;
    --warning: #ff9500;
    --danger: #ff3b30;
    --frozen: #E3F2FD;
    --frozen-border: #90CAF9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 100px;
}

/* 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: 16px 0;
}

.nav-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    text-align: center;
    padding: 12px 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);
}

h2 .count {
    font-weight: 400;
    font-size: 0.9rem;
}

/* Congélateur cards */
.congelo-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
}

.congelo-card h2 {
    margin: 0 0 12px;
    color: var(--accent-dark);
    font-size: 1.1rem;
}

.tiroirs-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tiroir-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--frozen);
    border: 1px solid var(--frozen-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.tiroir-item:active {
    transform: scale(0.98);
}

.tiroir-nom {
    font-size: 14px;
    font-weight: 500;
}

.tiroir-badge {
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

/* 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;
    text-decoration: none;
}

.tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Filter active */
.filter-active {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--frozen);
    border: 1px solid var(--frozen-border);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 13px;
}

.btn-remove-filter {
    color: var(--danger);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

/* 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);
}

a.card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.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-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.card-date.peremption-soon {
    color: var(--warning);
    font-weight: 600;
}

.card-date.peremption-expired {
    color: var(--danger);
    font-weight: 600;
}

.qty-badge {
    background: var(--accent-light);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
}

/* Product detail */
.product-detail {
    padding: 16px;
}

.product-photo {
    text-align: center;
    margin-bottom: 12px;
}

.product-photo img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: cover;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row-block {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.detail-description {
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-line;
}

.detail-label {
    color: var(--text-muted);
    font-size: 13px;
}

/* Historique */
.section-historique {
    margin-top: 32px;
    color: var(--text-muted);
}

.product-card.historique {
    opacity: 0.6;
}

/* Statut actions */
.statut-actions {
    display: flex;
    gap: 8px;
}

.statut-actions .btn {
    flex: 1;
}

/* Statut badges */
.statut-1 { color: var(--success); font-weight: 600; }
.statut-2 { color: var(--text-muted); }
.statut-3 { color: var(--warning); }

/* Alertes péremption */
.alert-section {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 12px;
}

.alert-section h2 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.alert-expired {
    background: rgba(255, 59, 48, 0.08);
    border: 1px solid var(--danger);
}

.alert-expired h2 {
    color: var(--danger);
}

.alert-soon {
    background: rgba(255, 149, 0, 0.08);
    border: 1px solid var(--warning);
}

.alert-soon h2 {
    color: var(--warning);
}

.card-expired {
    border-left: 4px solid var(--danger) !important;
    background: rgba(255, 59, 48, 0.04);
}

.card-soon {
    border-left: 4px solid var(--warning) !important;
    background: rgba(255, 149, 0, 0.04);
}

.alert-perime {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 59, 48, 0.12);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-bientot {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 149, 0, 0.12);
    border: 1px solid var(--warning);
    color: #b36b00;
}

/* Scan section */
.scan-section {
    margin-bottom: 16px;
}

.scan-section h2 {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 1rem;
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    color: var(--text);
    font-size: 15px;
}

.input-with-btn .btn {
    padding: 10px 14px;
}

.barcode-result {
    margin-top: 10px;
    padding: 10px;
    background: var(--frozen);
    border: 1px solid var(--frozen-border);
    border-radius: 8px;
    font-size: 13px;
}

.barcode-result.hidden {
    display: none;
}

.barcode-result.error {
    background: rgba(255,59,48,0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* 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,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 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;
    flex-shrink: 0;
}

.toggle input,
.form-group .toggle input {
    position: absolute;
    width: 44px;
    height: 24px;
    opacity: 0;
    margin: 0;
    padding: 0;
    cursor: pointer;
    z-index: 2;
    border: none;
    background: none;
}

.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: 150px;
    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;
    font-size: 2rem;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* 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; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* 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;
}

/* Details/summary */
details.card {
    cursor: default;
}

details.card summary {
    cursor: pointer;
    list-style: none;
}

details.card summary::-webkit-details-marker {
    display: none;
}

details.card summary h2 {
    margin: 0;
    color: var(--accent-dark);
}
