/* ============================================
   TAROTYA - Feuille de style principale
   Version 1.1
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overscroll-behavior: none;
}

/* --------------------------------------------
   CONTENEUR PRINCIPAL
--------------------------------------------- */
.container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* --------------------------------------------
   HEADER
--------------------------------------------- */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
}

.icon-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

/* --------------------------------------------
   ÉCRANS
--------------------------------------------- */
.screen {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: none;
    -webkit-overflow-scrolling: touch;
}

.screen.active {
    display: block;
}

/* --------------------------------------------
   CONFIGURATION - NOMBRE DE JOUEURS
--------------------------------------------- */
.player-count-selector {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    justify-content: center;
}

.count-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #667eea;
    background: white;
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s;
}

.count-btn.active {
    background: #667eea;
    color: white;
}

/* --------------------------------------------
   CONFIGURATION - NOMS DES JOUEURS
--------------------------------------------- */
.players-inputs {
    margin: 1rem 0;
}

.player-input {
    margin: 0.5rem 0;
}

.player-input label {
    display: block;
    margin-bottom: 0.25rem;
    color: #666;
}

.player-input input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.player-input input:focus {
    outline: none;
    border-color: #667eea;
}

/* --------------------------------------------
   FORMULAIRES - CHAMPS GÉNÉRIQUES
--------------------------------------------- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 600;
}

.form-select,
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: #667eea;
}

/* --------------------------------------------
   BOUTS
--------------------------------------------- */
.bouts-selector {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.bout-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.bout-btn.active {
    background: #667eea;
    color: white;
}

.points-objectif {
    text-align: center;
    padding: 0.5rem;
    background: #f0f0f0;
    border-radius: 5px;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

#objectifPoints {
    font-weight: bold;
    color: #667eea;
}

/* --------------------------------------------
   MODE DE COMPTAGE (v1.1)
--------------------------------------------- */
.mode-selector {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.mode-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.mode-btn.active {
    background: #667eea;
    color: white;
}

/* --------------------------------------------
   POINTS - INDICATEURS
--------------------------------------------- */
.points-indicator {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f0f0f0;
    border-radius: 5px;
}

#pointsDiff {
    font-weight: bold;
    color: #27ae60;
}

#pointsDiff.negative {
    color: #e74c3c;
}

/* --------------------------------------------
   SCORES ACTUELS
--------------------------------------------- */
.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
    margin: 1rem 0;
}

.score-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem;
    border-radius: 10px;
    text-align: center;
}

.score-item .player-name {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.score-item .player-score {
    font-size: 1.25rem;
    font-weight: bold;
}

/* --------------------------------------------
   RÉSULTAT D'UNE DONNE
--------------------------------------------- */
.result-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
}

.result-details {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.score-changes {
    margin: 1rem 0;
}

.score-change-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.score-change-item.positive {
    color: #27ae60;
}

.score-change-item.negative {
    color: #e74c3c;
}

/* --------------------------------------------
   BOUTONS PRIMAIRES ET SECONDAIRES
--------------------------------------------- */
.primary-btn,
.secondary-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    margin-bottom: 0.5rem;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.secondary-btn {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.primary-btn:active,
.secondary-btn:active {
    transform: scale(0.98);
}

/* --------------------------------------------
   HISTORIQUE
--------------------------------------------- */
.history-item {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.history-details {
    font-size: 0.95rem;
}

.history-details p {
    margin: 0.25rem 0;
}

.history-annonces {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f0f0f0;
    border-radius: 5px;
    font-size: 0.9rem;
    color: #666;
}

/* --------------------------------------------
   OVERLAYS (POPUPS)
--------------------------------------------- */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    max-width: 300px;
    text-align: center;
}

.overlay-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Style pour les messages de l'overlay personnalisé */
#customConfirmMessage {
    text-align: left;
    white-space: pre-line;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 1rem 0;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    max-height: 60vh;
    overflow-y: auto;
}

#customConfirmMessage br {
    display: block;
    margin-bottom: 4px;
}

/* --------------------------------------------
   TOAST (NOTIFICATIONS)
--------------------------------------------- */
.toast {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    animation: slideUp 0.3s;
    z-index: 2000;
}

.toast.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --------------------------------------------
   UTILITAIRES
--------------------------------------------- */
.hidden {
    display: none !important;
}

.info-note {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fff3cd;
    color: #856404;
    border-radius: 5px;
    font-size: 0.9rem;
}

/* --------------------------------------------
   EN-TÊTE DE LA DONNE
--------------------------------------------- */
.game-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.deal-counter {
    font-size: 1.1rem;
    font-weight: bold;
    color: #667eea;
}

.total-score {
    font-size: 1.1rem;
    font-weight: bold;
    color: #27ae60;
}

/* --------------------------------------------
   BOUTON REMONTER (SCROLL)
--------------------------------------------- */
.scroll-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.scroll-btn:hover,
.scroll-btn:active {
    transform: scale(1.1);
    background: #764ba2;
}

/* --------------------------------------------
   FOOTER (v1.1)
--------------------------------------------- */
.app-footer {
    background: rgba(102, 126, 234, 0.05);
    border-top: 1px solid rgba(102, 126, 234, 0.2);
    text-align: center;
    padding: 0.5rem;
    font-size: 0.6rem;
    color: #aaa;
    font-family: monospace;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

/* --------------------------------------------
   RESPONSIVE (MOBILE)
--------------------------------------------- */
@media (max-width: 500px) {
    .container {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
}
