/**
 * Americano Mode - Specific Styles
 * Separate CSS to avoid impacting index.html (Montante Descendante)
 */

/* ===== BASE LAYOUT ===== */
body {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

.container-fluid {
    overflow-y: visible;
    height: auto;
}

/* Main container with proper scroll */
main.container {
    padding-bottom: calc(80px + 2rem); /* Space for bottom navigation */
    overflow-y: visible;
    min-height: auto;
}

/* ===== SCREENS ===== */
.screen {
    animation: fadeIn 0.3s ease-in-out;
    overflow-y: visible;
    height: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #dee2e6;
    padding: 1rem;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.bottom-nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.bottom-nav-content.config-nav {
    justify-content: center;
}

.screen.d-none .bottom-nav {
    display: none !important;
}

/* ===== CARDS ===== */
.card {
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.5rem;
    overflow: visible;
}

.card-body {
    padding: 1.5rem;
    overflow-y: visible;
    height: auto;
}

/* ===== CONFIG FORM ===== */
.config-group {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.config-group:last-child {
    border-bottom: none;
}

.config-field {
    margin-bottom: 1rem;
}

.config-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

.config-section-title {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.form-control-compact {
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
    font-size: 0.95rem;
}

.form-select-compact {
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
    font-size: 0.95rem;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.config-field-inline {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.config-label-sm {
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0;
}

.form-control-inline {
    width: 80px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    main.container {
        padding-bottom: 100px;
    }

    .bottom-nav {
        padding: 0.75rem;
    }

    /* Transformer les boutons en ronds sur tablette */
    .bottom-nav .btn {
        width: 48px;
        min-width: 48px;
        height: 48px;
        padding: 0.75rem;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0;
    }

    .bottom-nav .btn-lg {
        width: 56px;
        min-width: 56px;
        height: 56px;
        padding: 1rem;
    }

    /* Masquer le texte, garder seulement les icônes */
    .bottom-nav .btn i {
        margin: 0 !important;
        font-size: 1.25rem;
    }

    /* Styles spécifiques pour les boutons de navigation résultats */
    .results-nav-buttons .btn {
        width: 48px !important;
        min-width: 48px !important;
        height: 48px !important;
        padding: 0.75rem !important;
        border-radius: 50% !important;
        font-size: 0 !important;
    }

    .results-nav-buttons .btn i {
        margin: 0 !important;
        font-size: 1.25rem !important;
    }
}

@media (max-width: 575px) {
    main.container {
        padding-bottom: 90px;
    }

    .card-body {
        padding: 1rem;
    }

    .bottom-nav-content {
        gap: 0.75rem;
    }

    /* Boutons ronds plus compacts sur petit mobile */
    .bottom-nav .btn {
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 0.625rem;
    }

    .bottom-nav .btn-lg {
        width: 52px;
        min-width: 52px;
        height: 52px;
        padding: 0.875rem;
    }

    .bottom-nav .btn i {
        font-size: 1.125rem;
        margin: 0 !important;
    }

    /* Styles spécifiques pour les boutons de navigation résultats sur petit mobile */
    .results-nav-buttons .btn {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        padding: 0.625rem !important;
        border-radius: 50% !important;
        font-size: 0 !important;
    }

    .results-nav-buttons .btn i {
        margin: 0 !important;
        font-size: 1.125rem !important;
    }
}

/* ===== TABLE STYLES ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

/* ===== ALERTS ===== */
.alert {
    margin-bottom: 1rem;
}

.alert-heading {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ===== ACCORDION ===== */
.accordion {
    margin-bottom: 1rem;
}

.accordion-button {
    font-weight: 500;
}

.accordion-button:not(.collapsed) {
    background-color: #e7f1ff;
    color: #0d6efd;
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d !important;
}

.text-primary {
    color: #0d6efd !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.p-4 {
    padding: 1.5rem !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

/* ===== AMERICANO SCORE ENTRY ===== */
/* Grid layout for matches - 2 columns on desktop */
#americano-matches-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    #americano-matches-results {
        grid-template-columns: 1fr;
    }
}

.americano-score-card {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Score complete - subtle indicator without background change */
.americano-score-card.score-complete {
    border-color: #28a745;
}

.americano-score-card.score-complete .court-label {
    border-bottom-color: #28a745;
}

.court-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.4rem;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
}

.court-label i {
    color: #ff9500;
}

.match-status {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    background: #6c757d;
    color: white;
    font-weight: 500;
}

.score-complete .match-status {
    background: #28a745;
}

.americano-score-entry {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.team-counter {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.team-names {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    min-height: 1.2rem;
    display: flex;
    align-items: center;
    margin-bottom: 0.3rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.counter-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    padding: 0.3rem 0.5rem;
    border-radius: 50px;
}

.counter-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    border: 2px solid;
    transition: all 0.2s ease;
    cursor: pointer;
}

.counter-btn:hover {
    transform: scale(1.1);
}

.counter-btn:active {
    transform: scale(0.95);
}

.counter-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* Counter button styles (scoped to score cards only) */
.counter-btn.btn-outline-danger {
    border-color: #dc3545;
    color: #dc3545;
    background: white;
}

.counter-btn.btn-outline-danger:hover {
    background: #dc3545;
    color: white;
}

.counter-btn.btn-outline-success {
    border-color: #28a745;
    color: #28a745;
    background: white;
}

.counter-btn.btn-outline-success:hover {
    background: #28a745;
    color: white;
}

.score-display {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0d6efd;
    min-width: 45px;
    text-align: center;
    font-feature-settings: "tnum";
    transition: all 0.2s ease;
}

.score-input {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0d6efd;
    width: 55px;
    text-align: center;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    padding: 0.15rem;
    font-feature-settings: "tnum";
    background: white;
    transition: all 0.2s ease;
}

.score-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.score-display.score-changed {
    animation: scoreChange 0.4s ease;
}

@keyframes scoreChange {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #ffc107; }
    100% { transform: scale(1); color: #0d6efd; }
}

/* Auto-calculated team styling */
.team-auto {
    opacity: 0.9;
}

.counter-auto {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border: 2px dashed #2196f3;
    position: relative;
}

.auto-label {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: #1976d2;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.auto-label i {
    font-size: 0.7rem;
}

.score-auto {
    color: #1976d2 !important;
    font-size: 1.4rem;
}

.vs-separator {
    font-size: 0.9rem;
    font-weight: 700;
    color: #6c757d;
    padding: 0 0.3rem;
}

/* Progress bar for score validation */
.score-progress-bar {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.score-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.score-progress-info.invalid {
    color: #dc3545;
    font-weight: 600;
}

.score-progress-info.valid {
    color: #28a745;
    font-weight: 600;
}

.progress {
    height: 14px;
    border-radius: 8px;
    background-color: #e9ecef;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.3s ease, background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.7rem;
}

.americano-progress-container {
    margin-top: 0.5rem;
}

.progress-text {
    text-align: center;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #495057;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.auto-info {
    font-size: 0.65rem;
    color: #1976d2;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    opacity: 0.7;
}

.auto-info i {
    font-size: 0.65rem;
}

.score-error-message {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.score-error-message.show {
    display: block;
    opacity: 1;
}

.score-error-message:not(:empty) {
    display: block;
}

/* Round navigation */
.round-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Resting players section */
.resting-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    background: #e9ecef;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
}

.resting-badge i {
    font-size: 1rem;
}

/* Match action buttons (Validate/Edit) in court label */
.btn-match-action {
    background: transparent !important;
    color: white !important;
    border: none !important;
    padding: 0.25rem 0.5rem !important;
}

.btn-match-action:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.btn-match-action:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.btn-match-action i {
    color: white !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .americano-score-entry {
        flex-direction: column;
        gap: 0.75rem;
    }

    .team-counter {
        width: 100%;
    }

    .vs-separator {
        transform: rotate(90deg);
        padding: 0.3rem 0;
        font-size: 0.8rem;
    }

    .counter-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .score-display {
        font-size: 1.6rem;
        min-width: 50px;
    }

    .score-input {
        font-size: 1.6rem;
        width: 60px;
    }

    .score-auto {
        font-size: 1.6rem !important;
    }

    .auto-label {
        font-size: 0.65rem;
    }
}

/* ===== ENSURE SCROLL WORKS ===== */
html {
    overflow-y: auto;
    height: auto;
}

body {
    overflow-y: auto;
    height: auto;
}

#app-content {
    overflow-y: visible;
    height: auto;
    min-height: 100vh;
}
