/* ========================================
   Protection borne kiosque
   ======================================== */
*,
*::before,
*::after {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* ========================================
   Variables CSS (seront écrasées par config)
   ======================================== */
:root {
    --color-primary: #3E9283;
    --color-secondary: #F5F5F5;
    --color-text: #333333;
    --color-text-light: #FFFFFF;
    --color-bg: #FAFAFA;
    --color-border: #DDDDDD;
    --color-hover: #2D7A6D;
    --color-error: #D32F2F;

    --font-size-base: 16px;
    --font-size-title: 24px;
    --font-size-subtitle: 18px;
    --font-size-button: 18px;

    --btn-min-size: 60px;
    --spacing: 16px;
}

/* ========================================
   Overlay d'authentification
   ======================================== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.auth-overlay.hidden {
    display: none;
}

.auth-modal {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    width: 90%;
    max-width: 420px;
}

.auth-header {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    padding: 28px 24px;
    text-align: center;
}

.auth-header h2 {
    color: var(--color-text-light);
    margin: 0 0 6px 0;
    font-size: 22px;
}

.auth-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 15px;
}

.auth-body {
    padding: 28px 24px;
}

.auth-field {
    margin-bottom: 18px;
}

.auth-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text);
}

.auth-field input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 16px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(62, 146, 131, 0.15);
}

.auth-error {
    color: var(--color-error);
    font-size: 14px;
    min-height: 20px;
    margin-bottom: 12px;
    text-align: center;
}

.auth-btn {
    width: 100%;
    margin: 0;
}

/* ========================================
   Reset et styles de base
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: var(--font-size-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    overflow: hidden;
    overflow-y: auto;
    height: 100vh;
    width: 100vw;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* ========================================
   Gestion des écrans
   ======================================== */
.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    overflow-y: auto;
    padding: 30px 40px;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 1200px;
    width: 100%;
    text-align: center;
}

/* ========================================
   Logo et titres
   ======================================== */
.logo-container {
    margin-bottom: 30px;
}

.logo {
    max-width: 220px;
    max-height: 150px;
    width: auto;
    height: auto;
}

.logo-container-small {
    margin-bottom: 15px;
}

.logo-small {
    max-width: 120px;
    max-height: 80px;
    width: auto;
    height: auto;
}

.title {
    font-size: var(--font-size-title);
    color: var(--color-primary);
    margin-bottom: 15px;
    font-weight: 600;
}

.subtitle {
    font-size: var(--font-size-subtitle);
    color: var(--color-text);
    margin-bottom: 20px;
}

h2 {
    font-size: 22px;
    color: var(--color-primary);
    margin-bottom: 15px;
}

/* ========================================
   Champ de recherche (écran d'accueil)
   ======================================== */
.search-container {
    margin-top: 40px;
}

.search-box {
    margin-bottom: 20px;
}

#search-input {
    width: 100%;
    max-width: 500px;
    height: 56px;
    font-size: 20px;
    padding: 0 24px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    text-align: center;
    background-color: white;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

#search-input:hover {
    border-color: var(--color-primary);
}

#search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(62, 146, 131, 0.1);
}

/* ========================================
   Boutons
   ======================================== */
.btn {
    min-width: var(--btn-min-size);
    min-height: var(--btn-min-size);
    padding: 14px 28px;
    font-size: var(--font-size-button);
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text-light);
}

.btn-primary:hover {
    background-color: var(--color-hover);
}

.btn-primary:disabled {
    background-color: #CCCCCC;
    color: #999999;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: #E0E0E0;
}

.btn-large {
    min-width: 150px;
    min-height: 56px;
    font-size: 18px;
}

/* ========================================
   Clavier virtuel
   ======================================== */
.keyboard-header {
    margin-bottom: 25px;
}

.input-display {
    display: inline-block;
    min-width: 300px;
    padding: 14px 24px;
    font-size: 22px;
    font-weight: 600;
    background-color: white;
    border: 2px solid var(--color-primary);
    border-radius: 10px;
    margin-top: 15px;
    letter-spacing: 2px;
}

.cursor {
    animation: blink 1s infinite;
    color: var(--color-primary);
    font-weight: normal;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.keyboard-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.key {
    min-width: 55px;
    min-height: 55px;
    font-size: 18px;
    font-weight: 600;
    background-color: white;
    color: var(--color-text);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.key:hover {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.key:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.key-space {
    min-width: 200px;
    font-size: 16px;
}

.keyboard-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ========================================
   Listes de résultats
   ======================================== */
.suggestions-list,
.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 25px auto;
    max-width: 600px;
}

.suggestion-item,
.result-item-card {
    padding: 18px 24px;
    background-color: white;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.suggestion-item:hover,
.result-item-card:hover {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    transform: translateX(10px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.result-item-card {
    text-align: left;
}

.result-item-card .name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
}

.result-item-card .details {
    font-size: 16px;
    opacity: 0.8;
}

/* ========================================
   Carte de résultat final
   ======================================== */
.result-card {
    max-width: 550px;
    margin: 25px auto;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.result-header {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    padding: 20px;
}

.result-header h2 {
    color: var(--color-text-light);
    margin: 0;
}

.result-content {
    padding: 24px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--color-secondary);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.result-value {
    font-size: 18px;
    color: var(--color-primary);
    font-weight: 700;
}

.result-item.highlight {
    background-color: #FFF9E6;
    margin: 14px -14px 0;
    padding: 16px 14px;
    border-radius: 8px;
}

.result-item.highlight .result-value {
    font-size: 22px;
}

/* ========================================
   Message aucun résultat
   ======================================== */
.no-result-message {
    padding: 40px 30px;
    background-color: white;
    border-radius: 12px;
    margin: 25px auto;
    max-width: 500px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.no-result-message h2 {
    color: var(--color-text);
    margin-bottom: 15px;
}

.no-result-message p {
    font-size: 17px;
    color: var(--color-text);
    margin: 10px 0;
}

.help-text {
    font-size: 15px;
    color: #999999;
    font-style: italic;
}

/* ========================================
   Loader
   ======================================== */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader p {
    color: white;
    font-size: 18px;
    margin-top: 15px;
}

/* ========================================
   Responsive pour différentes résolutions
   ======================================== */
@media (max-height: 800px) {
    .screen {
        padding: 15px;
    }

    .logo {
        max-width: 160px;
        max-height: 100px;
    }

    .title {
        font-size: 20px;
    }

    .subtitle {
        font-size: 16px;
    }
}

/* ========================================
   Portrait orientation (borne 43" 1080x1920)
   ======================================== */
@media (orientation: portrait) and (min-height: 1200px) {
    .screen.active {
        align-items: flex-start;
        padding-top: 60px;
    }

    .container {
        max-width: 900px;
    }

    .keyboard {
        max-width: 700px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ========================================
   Optimisations tactiles
   ======================================== */
button, .key, .suggestion-item, .result-item-card, #search-input {
    -webkit-tap-highlight-color: rgba(62, 146, 131, 0.3);
}

/* Désactiver le zoom sur double-tap */
body {
    touch-action: pan-x pan-y;
}
