:root {
    --coallia-blue: #0055a4; --bg-color: #f2f2f7; --card-color: #ffffff;
    --text-dark: #1c1c1e; --text-gray: #8e8e93;
    --success: #34c759; --warning: #ff9500; --danger: #ff3b30;
}

/* ANTI-ZOOM SUR LES BOUTONS */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }

body, html { margin: 0; padding: 0; font-family: 'Inter', sans-serif; background-color: var(--bg-color); height: 100%; overflow: hidden; }
.view { height: 100vh; display: flex; flex-direction: column; padding: 20px; }
.hidden { display: none !important; }

/* FIX DU SCROLL */
.content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.tab-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 180px !important; }

/* AUTH */
#login-screen { justify-content: center; align-items: center; }
.auth-card { width: 100%; max-width: 360px; background: var(--card-color); padding: 40px 25px; border-radius: 28px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); text-align: center; }
.logo-container { width: 100%; margin-bottom: 20px; display: flex; justify-content: center; }
.logo-coallia { height: 55px; width: auto; object-fit: contain; }
h1 { font-size: 24px; margin: 10px 0 0 0; font-weight: 700; color: var(--coallia-blue); }
.subtitle { color: var(--text-gray); margin-bottom: 25px; font-size: 15px; }

input { width: 100%; border: 1px solid transparent; background: #e5e5ea; padding: 16px; border-radius: 14px; margin-bottom: 12px; font-size: 16px; outline: none; transition: all 0.2s ease; }
input:focus { background: #fff; border-color: var(--coallia-blue); }
input.input-error { border-color: var(--danger) !important; background-color: #fff1f0 !important; }
#error-bubble { background-color: var(--danger); color: white; padding: 10px 15px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 15px; position: relative; opacity: 0; transform: translateY(-5px); transition: all 0.3s ease; }
#error-bubble.show { opacity: 1; transform: translateY(0); }
#btn-login { width: 100%; border: none; background: var(--coallia-blue); color: white; padding: 18px; border-radius: 14px; font-weight: 600; font-size: 16px; cursor: pointer; }

/* HEADER & TABS */
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.pro-badge { background: white; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 14px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.logout-link { background: none; border: none; color: var(--coallia-blue); font-weight: 600; font-size: 14px; cursor: pointer; }
.tabs-nav { display: flex; background: #e5e5ea; padding: 4px; border-radius: 14px; margin-bottom: 15px; }
.tab-btn { flex: 1; border: none; padding: 12px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; background: none; color: var(--text-gray); transition: all 0.2s; }
.tab-btn.active { background: white; color: var(--text-dark); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.scan-main-btn { width: 100%; background: white; color: var(--coallia-blue); border: 2px solid var(--coallia-blue); padding: 16px; border-radius: 16px; font-weight: 700; font-size: 16px; margin-bottom: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* PANIER & SELECTION */
.actions-header { display: flex; justify-content: flex-end; margin-bottom: 15px; }
.btn-panier { background: #e5e5ea; color: var(--text-dark); border: none; padding: 10px 15px; border-radius: 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.btn-panier.active { background: var(--coallia-blue); color: white; }
.floating-bar { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: white; padding: 12px 18px; border-radius: 20px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: space-between; gap: 10px; z-index: 1000; width: 92%; max-width: 340px; border: 1px solid rgba(0,0,0,0.1); }
.floating-bar span { font-weight: 600; color: var(--coallia-blue); font-size: 15px; }
.floating-bar button { padding: 10px 20px; border-radius: 12px; font-weight: 600; font-size: 14px; margin: 0; }

/* ACCORDÉONS (CATÉGORIES) */
.section-title { font-size: 16px; color: var(--text-dark); margin: 25px 0 10px 5px; font-weight: 700; }
.accordion-header { background: white; padding: 16px 20px; border-radius: 18px; margin-bottom: 10px; font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,0.03); cursor: pointer; color: var(--text-dark); }
.accordion-content { display: none; padding-left: 10px; border-left: 3px solid var(--coallia-blue); margin-bottom: 20px; margin-top: 10px; }
.accordion-content.open { display: block; animation: slideDown 0.2s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* === NOUVEAU : LE TITRE POUR CHAQUE JEUNE === */
.resident-title {
    background: var(--coallia-blue);
    color: white;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    margin: 25px 0 12px 0;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0,85,164,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}
.resident-title:first-child { margin-top: 5px; }

/* CARTES MATÉRIEL - GRAND FORMAT LISIBLE */
.items-grid { display: flex; flex-direction: column; gap: 12px; }
.item-card { background: white; border-radius: 20px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.04); cursor: pointer; border: 2px solid transparent; }
.item-card.selected-panier { border-color: var(--coallia-blue); background-color: #f4f8fc; }
.status-line { height: 6px; width: 100%; }
.card-body { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
.info h3 { margin: 0 0 5px 0; font-size: 16px; color: var(--text-dark); }
.status-text { margin: 0; font-size: 13px; font-weight: 600; }
.dot-indicator { width: 12px; height: 12px; border-radius: 50%; }
.card-footer { border-top: 1px solid #f2f2f7; padding: 12px 20px; font-size: 12px; background: #fafafa; }
.row { display: flex; justify-content: space-between; margin-bottom: 4px; color: var(--text-gray); }
.row b { color: var(--text-dark); }

/* COULEURS */
.available .status-line, .available .dot-indicator { background: var(--success); }
.available .status-text { color: var(--success); }
.borrowed .status-line, .borrowed .dot-indicator { background: var(--warning); }
.borrowed .status-text { color: var(--warning); }
.overdue .status-line, .overdue .dot-indicator { background: var(--danger); }
.overdue .status-text, .overdue .info h3 { color: var(--danger); }
.generic .status-line, .generic .dot-indicator { background: var(--coallia-blue); }
.generic .status-text { color: var(--coallia-blue); }

/* CONTROLES QUANTITÉ */
.qty-controls { display: flex; align-items: center; gap: 12px; background: white; padding: 4px; border-radius: 12px; border: 1px solid #e5e5ea; }
.qty-btn { background: var(--bg-color); border: none; width: 32px; height: 32px; border-radius: 8px; font-weight: bold; font-size: 18px; color: var(--coallia-blue); cursor: pointer; }
.qty-btn:active { background: #d1d1d6; }
.qty-controls span { font-weight: 700; font-size: 15px; width: 20px; text-align: center; }

.qty-controls-large { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 10px; }
.qty-btn-large { background: #e5e5ea; border: none; width: 45px; height: 45px; border-radius: 12px; font-weight: bold; font-size: 24px; color: var(--coallia-blue); cursor: pointer; }
#modal-qty-display { font-weight: 700; font-size: 22px; width: 30px; text-align: center; }

/* MODALS */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 2000; padding: 20px; }
.modal-card { background: white; width: 100%; max-width: 320px; padding: 30px 20px; border-radius: 28px; text-align: center; animation: slideUp 0.3s ease-out; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-card h3 { margin: 0 0 8px 0; font-size: 20px; }
.modal-subtitle { color: var(--text-gray); margin-bottom: 20px; font-size: 14px; }
.error-text { color: var(--danger); font-size: 12px; margin-top: 5px; text-align: left; padding-left: 5px; }
.modal-buttons { display: flex; gap: 12px; margin-top: 25px; }
.modal-buttons button { flex: 1; padding: 15px; border-radius: 14px; font-weight: 600; border: none; cursor: pointer; font-size: 15px; }
.btn-primary { background: var(--coallia-blue); color: white; }
.btn-secondary { background: #f2f2f7; color: var(--text-dark); }
.btn-danger { background: var(--danger); color: white; }
#reader img { display: none !important; }
.shake { animation: shake 0.4s ease-in-out; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }