/* app.css - Styles spécifiques à la disposition de l'application */

:root {
    --bg-color: #f4f6f8;
    --card-bg: #ffffff;
    --primary: #2563eb;
    --success: #16a34a;
    --danger: #dc2626;
    --text: #1f2937;
}
.hidden { display: none !important; }
body {
    margin: 0; padding: 0;
    display: flex; flex-direction: column;
    height: 100dvh; overflow: hidden;
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color); color: var(--text);
}
h1 { text-align: center; color: var(--primary); margin-bottom: 10px; }
h2 { margin: 6px 0; font-size: 1.1rem; display: flex; align-items: center; }

/* Entête */
.app-header { flex-shrink: 0; display: flex; justify-content: center; align-items: center; background: #1e293b; color: white; padding: 8px 12px; }
.btn-mode { background: transparent; color: #94a3b8; border: 1px solid #475569; padding: 6px 12px; border-radius: 4px; font-weight: bold; font-size: 0.85rem; cursor: pointer; }
.btn-mode.active { background: #3b82f6; color: white; border-color: #3b82f6; }
.btn-sync { background: #334155; color: white; border: 1px solid #475569; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 0.85rem; font-weight: bold; }

/* Barre Chrono Globale */
.global-chrono-bar { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; background: var(--card-bg); padding: 10px 15px; border-bottom: 2px solid #e5e7eb; box-shadow: 0 2px 4px rgba(0,0,0,0.05); z-index: 10; }

/* Zone Principale Scrollable */
.scrollable-content { flex-grow: 1; overflow-y: auto; background-color: var(--bg-color); }

/* Footer Nav */
.bottom-bar { flex-shrink: 0; background: var(--card-bg); display: flex; justify-content: space-around; box-shadow: 0 -2px 10px rgba(0,0,0,0.1); z-index: 1000; }
.nav-btn { background: none; border: none; font-size: 0.8rem; font-weight: bold; color: #6b7280; padding: 4px 8px; border-radius: 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.nav-btn.active { color: var(--primary); }

/* Cartes et Boutons */
.card { background: var(--card-bg); border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.btn { background: var(--primary); color: white; border: none; padding: 8px 12px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.btn-icon { background: transparent; border: none; font-size: 1.5rem; cursor: pointer; padding: 0 5px; transition: transform 0.2s; }
.btn-icon:hover { transform: scale(1.1); }
.btn-action { background: var(--primary); color: white; border: none; padding: 8px 12px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.btn-action:disabled { background: #9ca3af; cursor: not-allowed; opacity: 0.7; }
.btn-danger { background: var(--danger); }

/* Tableau */
.results-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.results-table th, .results-table td { padding: 6px 8px; border-bottom: 1px solid #e5e7eb; }
.results-table th:not(.name), .results-table td:not(.name) { text-align: center; }
.results-table th.name, .results-table td.name { text-align: left; }
.results-table th { background-color: #f3f4f6; font-weight: bold; white-space: nowrap; }
.results-table td.time { font-family: monospace; font-size: 1rem; }
.results-table .age { font-size: 0.8rem; font-style: italic; text-wrap: nowrap; }
@media (max-width: 600px) { .results-table th, .results-table td { padding: 6px; } }

/* Overlays et Grilles */
.overlay-fullscreen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 3000; display: flex; justify-content: center; align-items: center; }
.login-card { max-width: 400px; text-align: center; padding: 10px; }
.login-card > * { margin: 10px 0px !important; }
.conflict-card { max-height: 90vh; overflow-y: auto; padding: 0px 10px 5px; }
.loader-spinner { border: 4px solid rgba(255,255,255,0.3); border-top: 4px solid white; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Formulaire */
input, button { box-sizing: border-box; }
.registration-container { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; }
@media (max-width: 800px) { .registration-container { grid-template-columns: 1fr; } }
#inscription-form { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
#inscription-form input[type="text"], #inscription-form button { width: 100%; }
#inscription-form button { grid-column: 1 / span 2; }
.radio-group { display: flex; gap: 12px; align-items: center; }
.radio-group, input:not([type="text"]) { width: fit-content; }
.btn-scan { background: #7c3aed; margin-bottom: 8px; width: 100%; }
.form-mode-badge { font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; background-color: #e0f2fe; color: #0369a1; }
.alert { padding: 8px; border-radius: 4px; margin-bottom: 8px; font-size: 0.85rem; font-weight: bold; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.table-responsive { max-height: 500px; overflow-y: auto; }
tr.editing-row { background-color: #fef08a !important; font-weight: bold; }
tr.clickable-row { cursor: pointer; }

/* PAramètres */
#settings-form { display: flex; flex-direction: column; gap: 5px; }
#settings-form > *:not(label):not(hr) { margin-bottom: 10px; }

/* Grille Chrono */
.grid-container { display: grid; gap: 4px; }
.grid-compact { grid-template-columns: repeat(auto-fill, minmax(55px, 1fr)); }
.grid-standard { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
.runner-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 8px; background-color: #e5e7eb; padding: 4px; border-radius: 6px; }
.runner-card { background: var(--card-bg); border: 2px solid #e5e7eb; border-radius: 5px; padding: 3px; text-align: center; cursor: pointer; user-select: none; display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 44px; }
.runner-card.en_course { border-color: var(--primary); }
.runner-card.arrive { border-color: var(--success); background-color: #f0fdf4; opacity: 0.7; }
.runner-card.abandon { border-color: var(--danger); background-color: #fef2f2; }
.runner-rank { font-size: 0.75rem; font-weight: bold; color: var(--primary); }
.runner-bib { font-size: 1.6rem; font-weight: bold; line-height: 1.1; }
.runner-details { font-size: 0.7rem; color: #6b7280; }
.runner-subtext { font-size: 0.65rem; color: #059669; font-weight: bold; }
.abandon-controls { background: var(--card-bg); padding: 8px; border-radius: 6px; margin-bottom: 10px; display: flex; gap: 8px; }

/* Clavier Duo */
button { touch-action: manipulation; }
#btn-giant-top:active { transform: translateY(2px); filter: brightness(0.9); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr) 2fr; gap: 10px; max-width: 500px; margin: 0 auto; padding: 5px; }
/*.key-row { display: flex; justify-content: space-between; }*/
.keypad > * { font-size: 2rem; font-weight: bold; text-align: center; padding: 0px; }
.keypad button { border-radius: 8px; border: 1px solid #d1d5db; background: #f9fafb; color: #111827; }
.keypad button:active { background: #e5e7eb; }
.key-display { grid-row: span 2; align-content: center; background: #111827; color: #10b981; font-family: monospace; font-size: 3rem; border-radius: 8px; letter-spacing: 5px; }
.num-key.zero { grid-column: span 2; }
/*.key-bottom { display: flex; gap: 10px; margin-top: 5px; }
.key-actions { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.key-actions button { flex: 1; font-size: 1.2rem; font-weight: bold; border-radius: 8px; border: none; }*/
#btn-back { background: #ef4444; color: white; }
#btn-ok { background: #10b981; color: white; }

/* Boutons ajustement temps */
/* Boutons ajustement temps INLINE */
.btn-time-adjust { color: var(--text); font-size: 1.2rem; font-family: monospace; font-weight: bold; cursor: pointer; padding: 2px 10px; border: 1px solid #d1d5db; border-radius: 4px; background: #f3f4f6; transition: all 0.1s; user-select: none; }
.btn-time-adjust:active { background: #e5e7eb; transform: scale(0.95); }
@media (max-width: 400px) { .btn-time-adjust { font-size: 1.3rem; gap: 5px; } #time-edit-display { font-size: 1.5rem !important; } }