/* Styles optimisés pour l'application corBac */

/* Reset de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

html, body, #app {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* Structure principale */
#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
}

/* En-tête */
header {
    background-color: #2e7d32;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    height: 50px;
}

header h1 {
    font-size: 18px;
    font-weight: bold;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.header-buttons button {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.header-buttons button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Container principal et carte */
#map-container {
    flex-grow: 1;
    position: relative;
    height: calc(100% - 50px);
    width: 100%;
    min-height: 300px;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* Teinte orange pour les marqueurs */
.leaflet-marker-pane img {
    filter: hue-rotate(25deg); /* Donne une teinte orangée aux marqueurs */
}

/* Indicateur GPS */
#gps-indicator {
    position: absolute;
    left: 10px;
    bottom: 70px;
    background-color: white;
    padding: 8px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 5;
    font-size: 14px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#retry-btn {
    background-color: #2e7d32;
    color: white;
    border: none;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 8px;
    cursor: pointer;
    font-size: 12px;
}

/* Bouton d'ajout */
#add-point-btn {
    position: absolute;
    bottom: 70px;
    right: 15px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #2e7d32;
    color: white;
    font-size: 24px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#add-point-btn:hover {
    background-color: #1b5e20;
}

/* Panneau inférieur */
#bottom-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    transition: transform 0.3s ease;
}

#bottom-panel.collapsed {
    transform: translateY(calc(100% - 50px));
}

#bottom-panel.expanded {
    transform: translateY(0);
    max-height: 70%;
    overflow-y: auto;
}

#panel-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

#panel-title {
    font-weight: bold;
}

/* Tabs */
#tabs {
    display: flex;
    border-bottom: 1px solid #eee;
}

.tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
}

.tab.active {
    color: #2e7d32;
    font-weight: bold;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #2e7d32;
}

/* Contenu des onglets */
.tab-panel {
    display: none;
    padding: 15px;
}

.tab-panel.active {
    display: block;
}

/* Formulaires */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input, 
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.button-group {
    display: flex;
    gap: 10px;
}

/* Boutons */
.btn {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin: 5px 0;
    text-align: center;
    font-weight: bold;
}

.btn.primary {
    background-color: #2e7d32;
    color: white;
}

.btn.secondary {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.btn.danger {
    background-color: #d32f2f;
    color: white;
}

/* Liste des points */
#points-list {
    list-style: none;
}

#points-list li {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}

.point-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.point-meta {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.point-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.point-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    background-color: #f5f5f5;
}

.point-btn.play {
    background-color: #2e7d32;
    color: white;
}

.point-btn.delete {
    background-color: #d32f2f;
    color: white;
}

.empty-message {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Lecteur Audio */
#audio-player {
    position: fixed;
    bottom: 60px;
    left: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px;
    border-radius: 10px;
    z-index: 50;
    display: none;
}

.audio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#close-audio-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    display: none;
}

.modal-content {
    background-color: white;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-header button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 15px;
}

.modal-body h4 {
    color: #2e7d32;
    margin: 15px 0 5px 0;
}

.modal-body ul, 
.modal-body ol {
    padding-left: 20px;
    margin-bottom: 10px;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Toast et Loading */
#toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 1000;
    font-size: 14px;
    display: none;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2e7d32;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Titre de section */
.section-title {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.section-title h3 {
    color: #333;
    font-size: 16px;
    margin-bottom: 10px;
}

/* Informations utilisateur */
.user-info-container {
    display: flex;
    align-items: center;
    background-color: #f8f8f8;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.username {
    font-weight: bold;
    margin: 0 5px;
}

.small-btn {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    color: #333;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: auto;
}

.small-btn:hover {
    background-color: #e8e8e8;
}

/* Liste des circuits */
.circuits-list {
    max-height: 250px;
    overflow-y: auto;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
}

.empty-message, .loading-message {
    padding: 15px;
    text-align: center;
    color: #666;
}

.dropbox-circuit {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropbox-circuit:last-child {
    border-bottom: none;
}

.circuit-info {
    flex: 1;
}

.circuit-name {
    font-weight: bold;
    margin-bottom: 3px;
}

.circuit-date {
    font-size: 12px;
    color: #666;
}

.circuit-actions {
    display: flex;
    gap: 5px;
}

.circuit-btn {
    padding: 5px 8px;
    font-size: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    background-color: #f0f0f0;
}

.circuit-btn:hover {
    background-color: #e0e0e0;
}

.circuit-btn.delete {
    background-color: #ffebee;
    color: #d32f2f;
}

.circuit-btn.delete:hover {
    background-color: #ffcdd2;
}

/* Modal de partage */
#share-modal .modal-body {
    text-align: center;
}

#share-link {
    font-size: 14px;
    padding: 10px;
    margin-bottom: 10px;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.qr-container {
    margin: 15px auto;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 5px;
}

/* Icône Dropbox */
#dropbox-connect-btn::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 14.3l4.1 2.6-2.4 2-1.7-1.1-1.7 1.1-2.4-2 4.1-2.6zm0-9.5l-4.1 2.6 4.1 2.6 4.1-2.6-4.1-2.6zm-4.1 8.1l-4.1-2.6v3.3l4.1 2.6v-3.3zm8.2 0v3.3l4.1-2.6v-3.3l-4.1 2.6zm-4.1-13.6l-8.2 5.3 8.2 5.3 8.2-5.3-8.2-5.3z"/></svg>');
    background-repeat: no-repeat;
    background-size: contain;
    margin-right: 5px;
    vertical-align: middle;
}

/* Adaptation mobile spécifique */
@media (max-width: 480px) {
    .point-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    
    .circuit-actions {
        flex-direction: column;
    }
    
    .dropbox-circuit {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .circuit-actions {
        margin-top: 8px;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}