/* style.css - Direction Artistique Dark OLED Gab's Drone */
:root {
    --bg-color: #07080a;
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.1);
    --accent-blue: #007aff;
    --accent-cyan: #00f0ff;
    --accent-green: #34c759;
    --accent-red: #ff3b30;
    --accent-orange: #ff9500;
    --text-main: #ffffff;
    --text-muted: #8e8e93;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    -webkit-tap-highlight-color: transparent; 
}

/* Verrouillage Anti-Scroll Strict pour Mobile */
html, body { 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    width: 100vw; 
    height: 100vh; 
    overflow: hidden; 
    position: fixed; 
    touch-action: none; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between;
}



/* Zone de contenu défilable en interne si besoin */
.main-content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
    padding: 12px 16px; 
    overflow-y: auto; 
    touch-action: pan-y; 
    -webkit-overflow-scrolling: touch; 
}
/* Barre Supérieure */
.top-bar { 
    position: relative;
    padding: 12px 16px; 
    border-bottom: 1px solid var(--card-border); 
    background: rgba(13, 14, 18, 0.9); 
    text-align: center; 
    flex-shrink: 0; 
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 48px;
}

.top-bar h1 { 
    font-size: 16px; 
    font-weight: 800; 
    background: linear-gradient(90deg, #fff, var(--accent-cyan)); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
}

/* Bouton Home calé en Haut à Gauche */
.btn-home {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s;
}

.btn-home:active {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

/* Cartes & Composants Glassmorphism */
.card { 
    background: var(--card-bg); 
    border: 1px solid var(--card-border); 
    border-radius: 16px; 
    padding: 14px; 
}

/* Boutons UI */
.btn { 
    flex: 1; 
    padding: 12px; 
    border-radius: 12px; 
    border: none; 
    font-size: 14px; 
    font-weight: 700; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px; 
    text-decoration: none;
    transition: transform 0.1s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); opacity: 0.8; }
.btn-primary { background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan)); color: #fff; }
.btn-secondary { background: rgba(255, 255, 255, 0.1); border: 1px solid var(--card-border); color: #fff; }
.btn-success { background: var(--accent-green); color: #fff; }
.btn-danger { background: rgba(255, 59, 48, 0.2); border: 1px solid var(--accent-red); color: var(--accent-red); }

/* Champs Formulaires */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
input, select { 
    width: 100%; 
    padding: 10px 12px; 
    border-radius: 8px; 
    border: 1px solid var(--card-border); 
    background: rgba(255,255,255,0.08); 
    color: #fff; 
    font-size: 14px; 
    outline: none; 
}

/* Footer Unique */
.footer { 
    font-size: 11px; 
    color: #555; 
    text-align: center; 
    padding: 10px 0; 
    background: #07080a; 
    border-top: 1px solid rgba(255, 255, 255, 0.05); 
    flex-shrink: 0; 
    width: 100%;
}
.footer span { color: var(--text-muted); font-weight: 600; }

/* --- COMPOSANTS VERIFICATION & ÉDITION --- */
.controls-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.counter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 2px 4px;
}

.book-card-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 12px; /* Ajuste cette valeur (ex: 10px, 12px, 16px) selon l'espace souhaité */
}

.book-card-item.selected-card {
    border-color: var(--accent-blue);
    background: rgba(0, 122, 255, 0.12);
}

.book-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.book-title-main {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
}

.book-sub-meta {
    font-size: 12px;
    color: var(--accent-cyan);
    margin-top: 2px;
}

.tags-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.tag-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.bulk-floating-bar {
    position: fixed;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;
    background: rgba(18, 20, 28, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    padding: 10px 14px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    display: none;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    z-index: 500;
}

.undo-toast-banner {
    display: none;
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-blue);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 700;
}

.edit-inline-box {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--card-border);
}

.add-inline-box {
    display: none;
    flex-direction: column;
    gap: 8px;
    background: rgba(52, 199, 89, 0.05);
    border: 1px dashed var(--accent-green);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 30px 10px;
}

/* --- COMPOSANTS SPÉCIFIQUES À SEARCH.HTML --- */
.instructions {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    color: #ccc;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#canvas-container {
    width: 100vw;
    height: 38vh;
    position: relative;
    background: radial-gradient(circle at center, #13151f 0%, #07080a 100%);
    touch-action: none;
    touch-action: pan-y !important;
}

.search-container {
    padding: 15px 20px 5px 20px;
    max-width: 500px;
    margin: 0 auto;
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.results-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    flex: 1;
}

.book-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.book-item:active, .book-item.selected {
    background: rgba(0, 122, 255, 0.2);
    border-color: var(--accent-blue);
}

.book-title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.book-author { font-size: 13px; color: var(--text-muted); }

.badge-case {
    background: var(--accent-blue);
    color: #fff;
    padding: 5px 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
}

/* --- COMPOSANTS VÉRIFICATION & RECHERCHE MULTI-CASES --- */
.location-badge-tag {
    background: var(--accent-blue);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    margin-right: 6px;
}

.search-scope-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
}

/* --- MULTI-SELECT ET EN-TÊTE CLEAN VÉRIFICATION --- */
.search-header-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 12px;
    border-radius: 12px;
}

.btn-cases-trigger {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.cases-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    z-index: 300;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.cases-grid-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px 0;
}

.case-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

/* Réduction de la taille du bouton Ajouter */
.counter-bar .btn-success {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 6px;
    flex: none;
}

/* BOUTON SCAN DANS LA BARRE DE RECHERCHE */
.search-box-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-box-wrapper input {
    width: 100%;
    padding-right: 45px !important; /* Laisse de la place pour le bouton icône */
}

.btn-scan-inline {
    position: absolute;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border);
    color: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-scan-inline:active {
    background: var(--accent-blue);
}

/* OVERLAY MODAL SCANNER RAPIDE */
.quick-scan-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 400;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

#quickVideoContainer video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Espacement sous la barre de recherche */
.search-container .search-box-wrapper {
    margin-bottom: 12px;
}

/* Espacement du bloc de résultats */
.results-list {
    margin-top: 4px;
}

/* --- ESPACEMENT & ALIGNEMENT DE LA BARRE DE RECHERCHE --- */
.search-container {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Assure un espace automatique et fluide de 12px entre la barre et les résultats */
}

.search-box-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-box-wrapper input {
    width: 100%;
    padding-right: 50px !important; /* Laisse assez de place pour le bouton caméra */
}

.btn-scan-inline {
    position: absolute;
    right: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}