/* Styles principaux pour la page d'accueil (index.html) */

/* Header */
.header {
    background: linear-gradient(135deg, #a65902 0%, #8b4513 100%);
    color: white;
    padding: 0.5rem 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.6rem;
    margin-bottom: 0.1rem;
    font-weight: 300;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Contenu principal */
.main-content {
    max-width: 800px;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.card h3 {
    background: #f8f9fa;
    padding: 1.5rem;
    margin: 0;
    color: #333;
    border-bottom: 1px solid #dee2e6;
}

/* Collapsible headers */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    padding: 0.5rem;
    margin: 0;
}

.collapsible-header:hover {
    background: #e9ecef;
}

.collapse-icon {
    transition: transform 0.2s ease;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Collapsible content */
.collapsible-content {
    padding: 0.5rem;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.collapsible-content.collapsed {
    max-height: 0;
    padding: 0 0.5rem;
}

/* Formulaires */
.form-group {
    margin-bottom: 1.5rem;
}

/* Autocomplétion d'adresses */
.address-suggestions {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.address-search-container {
    position: relative;
}

.address-suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
}

.address-suggestion-item:hover {
    background-color: #f8f9fa;
}

.address-suggestion-item.selected {
    background-color: #a65902;
    color: white;
}

.address-suggestion-item:last-child {
    border-bottom: none;
}

.address-suggestion-icon {
    margin-right: 10px;
    color: #6c757d;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.address-suggestion-icon .fas,
.address-suggestion-icon .fa-solid,
.address-suggestion-icon .fa-regular {
    color: #6c757d !important;
}

.address-suggestion-item.selected .address-suggestion-icon {
    color: white;
}

.address-suggestion-item:hover .address-suggestion-icon .fas,
.address-suggestion-item:hover .address-suggestion-icon .fa-solid,
.address-suggestion-item:hover .address-suggestion-icon .fa-regular,
.address-suggestion-item.selected .address-suggestion-icon .fas,
.address-suggestion-item.selected .address-suggestion-icon .fa-solid,
.address-suggestion-item.selected .address-suggestion-icon .fa-regular {
    color: white !important;
}

.address-suggestion-text {
    flex: 1;
    line-height: 1.4;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #a65902;
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.1);
}

.form-control:disabled {
    background-color: #e9ecef;
    opacity: 0.6;
    cursor: not-allowed;
}

.form-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* School info */
.school-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #a65902 !important;
}

.school-info h4 {
    margin: 0 0 8px 0;
    color: #a65902 !important;
    font-size: 14px;
}

.school-info-hidden {
    display: none !important;
}

/* Recherche d'établissement par code UAI */
.establishment-id-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.establishment-id-container > #establishment-type {
    flex: 0 0 110px;
}

.establishment-id-container > #establishment-id-input {
    flex: 1 1 180px;
    min-width: 160px;
}

.establishment-id-container > .btn {
    flex: 0 0 auto;
    width: auto;
}

@media (max-width: 400px) {
    .establishment-id-container > #establishment-type,
    .establishment-id-container > #establishment-id-input,
    .establishment-id-container > .btn {
        flex: 1 1 100%;
    }
}

/* Anonymous info */
.anonymous-info {
    background: #e3f2fd !important;
    border: 1px solid #bbdefb !important;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #2196f3 !important;
}

.anonymous-info h4 {
    margin: 0 0 8px 0;
    color: #1976d2 !important;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.anonymous-info p {
    margin: 0;
    color: #424242;
    font-size: 13px;
    line-height: 1.4;
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, #a65902 0%, #8b4513 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #8b4513 0%, #654321 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #545b62 0%, #3d4142 100%);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%);
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #333;
}

.share-links {
    margin: 20px 0;
}

.share-link-item {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
}

.share-link-item strong {
    display: block;
    margin-bottom: 10px;
    color: #495057;
}

.link-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.link-container input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
    background: white;
}

.copy-btn {
    padding: 8px 16px;
    background: #a65902;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.copy-btn:hover {
    background: #8b4513;
}

.modal-footer {
    margin-top: 20px;
    text-align: right;
}

.modal-body {
    padding: 1.5rem;
}

.modal button .fas,
.modal button .fa-solid,
.modal button .fa-regular {
    color: white !important;
}

/* Share modal spécifique */
.share-modal-content {
    max-width: 600px;
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.share-link-container input {
    flex: 1;
}

.share-link-container button {
    white-space: nowrap;
    flex-shrink: 0;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.share-buttons .btn {
    flex: 1;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: #a65902;
}

/* QR Code */
.qr-code-container {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-container.qr-collapsed {
    display: none;
}

.qr-label-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 0.75rem;
}

.qr-label-row label {
    margin-bottom: 0;
}

.qr-toggle-label {
    cursor: pointer;
}

.qr-toggle-chevron {
    appearance: none;
    border: none;
    background: transparent;
    color: #495057;
    cursor: pointer;
    padding: 2px 6px;
}

.qr-toggle-chevron .qr-chevron {
    display: inline-block;
    font-size: 22px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.qr-toggle-chevron.is-open .qr-chevron {
    transform: rotate(180deg);
}

.qr-toggle-chevron:hover,
.qr-toggle-chevron:focus {
    color: #212529;
}

/* User token display */
.user-token-display {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-align: center;
    margin: 10px 0;
    color: #333;
}

/* Mise en page côte-à-côte adresse + carte */
.address-map-row {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

.address-map-row > .school-info {
    flex: 1;
}

.address-map-row > .map-column {
    flex: 1;
}

#map {
    height: 250px;
    border-radius: 8px;
    margin: 10px 0;
    border: 2px solid #a65902;
}

#school-ride-container {
    position: relative;
    width: 100%;
    margin-top: 15px;
}

#school-ride-container img {
    width: 100%;
    margin-top: 15px;
    border-radius: 8px;
}

#school-ride-container .clickable-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 48%;
    height: 65%;
    cursor: pointer;
}

.address-search-help {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.use-my-location-btn {
    color: var(--theme-color);
    text-decoration: none;
    font-size: 0.9rem;
    flex: 0 0 auto;
}

.use-my-location-btn:first-child {
    justify-self: flex-start;
}

.map-help-link {
    justify-self: flex-end;
}

.use-my-location-btn-disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 1rem 10px;
    }

    .header h1 {
        font-size: 2rem;
        margin-bottom: 0.25rem;
    }

    .main-content {
        margin: 0.5rem auto;
        padding: 0 0.5rem;
    }

    .card {
        margin-bottom: 0.5rem;
    }

    .card h3 {
        padding: 0.75rem;
        font-size: 1.1rem;
    }

    .collapsible-header {
        padding: 0.75rem;
    }

    .collapsible-content {
        padding: 0.75rem;
    }

    .collapsible-content.collapsed {
        padding: 0 0.75rem;
    }

    .form-group {
        margin-bottom: 0.75rem;
    }

    .form-group label {
        margin-bottom: 0.25rem;
    }

    .school-info,
    .anonymous-info {
        padding: 10px;
        margin: 8px 0;
    }

    .share-link-container {
        flex-direction: column;
    }

    .share-link-container button {
        margin-top: 0.5rem;
    }

    .share-buttons {
        gap: 0.25rem;
        margin-top: 0.5rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .share-links {
        margin: 10px 0;
    }

    .share-link-item {
        margin-bottom: 10px;
        padding: 10px;
    }

    .share-link-item strong {
        margin-bottom: 5px;
    }

    .address-map-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .address-map-row > .school-info,
    .address-map-row > .map-column {
        flex: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.75rem 10px;
    }

    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.125rem;
    }

    .main-content {
        margin: 0.25rem auto;
        padding: 0 0.25rem;
    }

    .card {
        margin-bottom: 0.25rem;
    }

    .card h3 {
        padding: 0.5rem;
        font-size: 1rem;
    }

    .collapsible-header {
        padding: 0.5rem;
    }

    .collapsible-content {
        padding: 0.5rem;
    }

    .collapsible-content.collapsed {
        padding: 0 0.5rem;
    }

    .form-group {
        margin-bottom: 0.5rem;
    }

    .form-group label {
        margin-bottom: 0.125rem;
    }

    .school-info,
    .anonymous-info {
        padding: 8px;
        margin: 5px 0;
    }

    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .modal-content {
        width: 95%;
        margin: 0.5rem;
    }

    .modal-header,
    .modal-body {
        padding: 0.75rem;
    }
}

/* Utilitaires */
.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

/* Focus accessibility */
.btn:focus,
.form-control:focus {
    outline: 2px solid #a65902;
    outline-offset: 2px;
}

/* Bordures de cartouches et conteneurs */
.ride-card,
.conversation-card,
.message-item {
    border: 2px solid #a65902 !important;
    border-radius: 8px !important;
    background: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.1);
}

.ride-card:hover,
.conversation-card:hover,
.message-item:hover {
    border-color: #8b4513 !important;
    box-shadow: 0 4px 16px rgba(212, 160, 23, 0.25);
    transform: translateY(-2px);
}

.ride-card.bordered {
    border: 2px solid #a65902 !important;
}

.ride-card.bordered:hover {
    border-color: #8b4513 !important;
}

.bordered {
    border: 2px solid #a65902 !important;
    border-radius: 8px !important;
    padding: 15px;
    margin-bottom: 15px;
    background: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.1);
}

.bordered:hover {
    border-color: #8b4513 !important;
    box-shadow: 0 4px 16px rgba(212, 160, 23, 0.25);
    transform: translateY(-1px);
}

/* Icônes FontAwesome avec thème */
.fas,
.fa-solid,
.fa-regular {
    color: #a65902;
}

.btn .fas,
.btn .fa-solid,
.btn .fa-regular {
    color: white !important;
}

.text-muted .fas,
.text-muted .fa-solid,
.text-muted .fa-regular {
    color: #6c757d;
}

.card h3 .fas,
.card h2 .fas,
.card h3 .fa-solid,
.card h2 .fa-solid,
.card h3 .fa-regular,
.card h2 .fa-regular {
    margin-right: 8px;
    color: #a65902;
}

/* Styles carte/liste */
.maplist-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    margin: 0 4px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.maplist-link:hover {
    background: #a65902;
    color: white;
    border-color: #a65902;
    transform: translateY(-1px);
}

.maplist-link.active {
    background: #a65902;
    color: white;
    border-color: #8b4513;
}

.view-container {
    position: relative;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}

.view-container.active {
    border-color: #a65902;
    box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.1);
}

/* Barres de navigation */
.nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #a65902 0%, #8b4513 100%);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.8rem;
    min-width: 60px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-1px);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-icon {
    font-size: 1.2rem;
    margin-bottom: 4px;
    color: white !important;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon,
.nav-bottom .nav-icon,
.nav-bottom .fas,
.nav-bottom .fa-solid,
.nav-bottom .fa-regular {
    color: white !important;
}

/* Icône poubelle blanc sur boutons de suppression */
#delete-user-btn .fas,
#delete-user-btn .fa-solid,
#delete-user-btn .fa-regular,
button[style*="background: #dc3545"] .fas,
button[style*="background: #dc3545"] .fa-solid,
button[style*="background: #dc3545"] .fa-regular {
    color: white !important;
}

/* Animations pour les cartes */
.ride-item-animate {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive nav */
@media (max-width: 768px) {
    .nav-bottom {
        padding: 6px 0;
    }

    .nav-item {
        padding: 6px 8px;
        font-size: 0.7rem;
        min-width: 50px;
    }

    .nav-icon {
        font-size: 1rem;
    }

    .maplist-link {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}

/* === Interaction entre le module scolaire et la recherche par adresse === */
/* Réduit l'espace entre la carte de recherche scolaire et le bloc adresse */
#create-school-platform-form > .card:first-of-type {
    margin-bottom: 0.5rem;
}
#create-school-platform-form > .form-group:has(#manual-address-search) {
    margin-top: 0;
    margin-bottom: 0.5rem;
}
/* Masque la recherche par adresse quand le module scolaire est déplié */
#create-school-platform-form:has(#create-event-section:not(.collapsed)) > .form-group:has(#manual-address-search) {
    display: none;
}