/**
 * mobi.css - Stylesheet Mobile Dédiée pour Smartphone
 * Club de Tir La Loupe - Application Terrain
 */

:root {
    --m-primary: #b3261e;
    --m-primary-dark: #8e1a14;
    --m-primary-light: #fef2f2;
    --m-success: #15803d;
    --m-success-bg: #dcfce7;
    --m-warning: #b45309;
    --m-warning-bg: #fef3c7;
    --m-danger: #b91c1c;
    --m-danger-bg: #fee2e2;
    --m-info: #1d4ed8;
    --m-info-bg: #dbeafe;
    --m-bg: #f1f5f9;
    --m-card-bg: #ffffff;
    --m-text: #0f172a;
    --m-text-muted: #64748b;
    --m-border: #e2e8f0;
    --m-radius: 14px;
    --m-radius-sm: 8px;
    --m-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --m-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--m-bg);
    color: var(--m-text);
    font-size: 15px;
    line-height: 1.45;
    padding-bottom: 80px; /* Espace pour la barre de navigation basse */
    min-height: 100vh;
}

/* Header Haut */
.mobi-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 1px solid var(--m-border);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.mobi-header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.mobi-header-brand img {
    height: 32px;
    width: auto;
}

.mobi-header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--m-primary);
    line-height: 1.2;
}

.mobi-header-subtitle {
    font-size: 11px;
    color: var(--m-text-muted);
}

.mobi-btn-pc {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: var(--m-radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    text-decoration: none;
}

/* Barre de navigation basse (Bottom Bar) */
.mobi-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #ffffff;
    border-top: 1px solid var(--m-border);
    display: flex;
    justify-content: space-around;
    padding: 6px 4px env(safe-area-inset-bottom, 6px) 4px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobi-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 2px;
    background: transparent;
    border: none;
    color: var(--m-text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 8px;
}

.mobi-nav-item .mobi-nav-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.mobi-nav-item.active {
    color: var(--m-primary);
    background: var(--m-primary-light);
}

/* Conteneur principal */
.mobi-container {
    padding: 12px 12px 24px 12px;
    max-width: 600px;
    margin: 0 auto;
}

/* Carte */
.mobi-card {
    background: var(--m-card-bg);
    border-radius: var(--m-radius);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--m-shadow);
    border: 1px solid var(--m-border);
}

.mobi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.mobi-card-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Boutons tactiles */
.mobi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    border-radius: var(--m-radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s ease, opacity 0.1s ease;
    width: 100%;
}

.mobi-btn:active {
    transform: scale(0.98);
}

.mobi-btn-primary {
    background: var(--m-primary);
    color: #ffffff;
}

.mobi-btn-success {
    background: var(--m-success);
    color: #ffffff;
}

.mobi-btn-danger {
    background: var(--m-danger);
    color: #ffffff;
}

.mobi-btn-outline {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.mobi-btn-sm {
    padding: 8px 12px;
    font-size: 13px;
    width: auto;
}

/* Badges */
.mobi-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.mobi-badge-success {
    background: var(--m-success-bg);
    color: var(--m-success);
}

.mobi-badge-danger {
    background: var(--m-danger-bg);
    color: var(--m-danger);
}

.mobi-badge-warning {
    background: var(--m-warning-bg);
    color: var(--m-warning);
}

.mobi-badge-info {
    background: var(--m-info-bg);
    color: var(--m-info);
}

/* Barre de recherche tactile */
.mobi-search-bar {
    position: relative;
    margin-bottom: 12px;
}

.mobi-search-input {
    width: 100%;
    padding: 12px 14px 12px 38px;
    border: 1px solid #cbd5e1;
    border-radius: var(--m-radius-sm);
    font-size: 15px;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}

.mobi-search-input:focus {
    border-color: var(--m-primary);
    box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.15);
}

.mobi-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--m-text-muted);
}

/* Filtres pills */
.mobi-pills {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.mobi-pills::-webkit-scrollbar {
    display: none;
}

.mobi-pill {
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid var(--m-border);
    color: var(--m-text-muted);
    cursor: pointer;
}

.mobi-pill.active {
    background: var(--m-primary);
    color: #ffffff;
    border-color: var(--m-primary);
}

/* Viseur Caméra Scanner */
.mobi-camera-box {
    position: relative;
    border-radius: var(--m-radius);
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 12px;
}

.mobi-camera-box video {
    width: 100%;
    height: 230px;
    object-fit: cover;
    display: block;
}

.mobi-laser {
    position: absolute;
    top: 0;
    left: 5%;
    right: 5%;
    height: 3px;
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e, 0 0 18px #22c55e;
    animation: mobiScanAnim 2s infinite ease-in-out;
}

@keyframes mobiScanAnim {
    0% { top: 15%; opacity: 0.8; }
    50% { top: 85%; opacity: 1; }
    100% { top: 15%; opacity: 0.8; }
}

/* Liste des éléments (Armes, Munitions) */
.mobi-list-item {
    background: #ffffff;
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.mobi-list-main {
    flex: 1;
    min-width: 0;
}

.mobi-list-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobi-list-sub {
    font-size: 12px;
    color: var(--m-text-muted);
}

/* Grille de stats / Bilan */
.mobi-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.mobi-stat-box {
    background: #ffffff;
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius);
    padding: 12px;
    text-align: center;
}

.mobi-stat-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--m-primary);
    line-height: 1.2;
}

.mobi-stat-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--m-text-muted);
    margin-top: 3px;
}

/* Toast mobile */
.mobi-toast {
    position: fixed;
    top: 60px;
    left: 14px;
    right: 14px;
    z-index: 1000;
    background: #1e293b;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: var(--m-radius-sm);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--m-shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: mobiSlideDown 0.25s ease-out;
}

@keyframes mobiSlideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   Styles Pointage & Inventaire Terrain
   ========================================================================== */
.mobi-pointage-row {
    background: #ffffff;
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.mobi-pointage-row.conforme {
    background: #f0fdf4;
    border-color: #86efac;
}

.mobi-pointage-row.ecart {
    background: #fffbeb;
    border-color: #fde68a;
}

.mobi-pointage-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.mobi-pointage-base {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
    text-align: center;
    line-height: 1.1;
    min-width: 48px;
}

.mobi-pointage-base b {
    display: block;
    font-size: 15px;
    color: #0f172a;
}

.mobi-pointage-input {
    width: 68px;
    height: 44px;
    padding: 6px;
    border-radius: 8px;
    border: 2px solid #cbd5e1;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    color: #0f172a;
    background: #ffffff;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.mobi-pointage-input:focus {
    outline: none;
    border-color: var(--m-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.15);
}

.mobi-pointage-input::placeholder {
    color: #cbd5e1;
    font-weight: 400;
}
