/* ========================================
   SECTION CONTRIBUTIONS DANS LA MODAL
======================================== */

.contributions-section {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.contributions-section h3 {
    color: #2d3748;
    border-bottom: 2px solid #a66107;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* Onglets */
.contributions-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.tab-button {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
    bottom: -1px;
}

.tab-button:hover {
    background: #f5f5f5;
}

.tab-button.active {
    background: #FFF3E0;
    border-color: #a66107;
    font-weight: 600;
    color: #a66107;
}

.tab-content {
    padding: 1rem;
    background: white;
    border-radius: 0 0 8px 8px;
    min-height: 100px;
}

/* Grille de photos */
.contributions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); /* Réduit de 150px à 120px */
    gap: 12px; /* Réduit de 15px */
}

/* Miniatures photos ET documents */
.contribution-photo {
    position: relative;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.contribution-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.contribution-photo img {
    width: 100%;
    height: 120px; /* Réduit de 150px à 120px */
    object-fit: cover;
    cursor: pointer;
    display: block;
}

.contrib-info {
    padding: 6px; /* Réduit de 8px */
    font-size: 11px; /* Réduit de 12px */
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #f9f9f9;
}

/* Liste de documents/textes */
.contributions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contribution-item {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.contribution-item a {
    color: #a66107;
    text-decoration: none;
    font-weight: 500;
}

.contribution-item a:hover {
    text-decoration: underline;
}

.contrib-text {
    color: #333;
    line-height: 1.6;
    margin-bottom: 8px;
    padding: 10px;
    background: white;
    border-radius: 4px;
}

/* Bouton contribution dans le footer */
.btn-contribution {
    background: #28a745 !important;
    border: none !important;
}

.btn-contribution:hover {
    background: #218838 !important;
}

/* ========================================
   MODAL DE CONTRIBUTION
======================================== */

.modal-contribution {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    overflow-y: auto;
}

.modal-contribution.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.modal-contribution-content {
    background: white;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    border-radius: 12px;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

.modal-contribution-header {
    padding: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f5f5f5;
    border-radius: 12px 12px 0 0;
}

.modal-contribution-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
}

.modal-contribution-body {
    padding: 1.5rem;
}

.contrib-soldier-info {
    background: #FFF3E0;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    color: #666;
}

.contrib-soldier-info strong {
    color: #a66107;
}

/* Sélecteur de type */
.contrib-type-selector h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #333;
}

.contrib-type-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 1.5rem;
}

.type-btn {
    padding: 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-align: center;
}

.type-btn:hover {
    background: #f5f5f5;
    border-color: #a66107;
}

.type-btn.active {
    background: #FFF3E0;
    border-color: #a66107;
    font-weight: 600;
    color: #a66107;
}

/* Zone d'upload */
.upload-area {
    border: 2px dashed #a66107;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.upload-area:hover {
    background: #FFF3E0;
}

.upload-area.dragover {
    background: #FFF3E0;
    border-color: #28a745;
}

.upload-area p {
    margin: 5px 0;
    color: #666;
}

.upload-info {
    font-size: 12px;
    color: #999;
}

/* Prévisualisation des fichiers */
.file-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.file-preview-item {
    position: relative;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    background: white;
}

.file-preview-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

.file-preview-item span {
    display: block;
    font-size: 11px;
    color: #666;
    margin-top: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview-item button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

/* Éditeur de texte */
.text-editor-toolbar {
    display: flex;
    gap: 5px;
    padding: 8px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.text-editor-toolbar button {
    padding: 5px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.text-editor-toolbar button:hover {
    background: #e0e0e0;
}

.text-editor {
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    font-size: 14px;
    line-height: 1.6;
    background: white;
}

.text-editor:focus {
    outline: none;
    border-color: #a66107;
}

.text-editor[contenteditable]:empty:before {
    content: attr(placeholder);
    color: #999;
}

.char-counter {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Informations contributeur */
.contributor-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.contributor-info h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #a66107;
}

.form-group small {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: #999;
}

/* Zone captcha */
.captcha-zone {
    margin-top: 1rem;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 3px;
}

.checkbox-group label {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

/* Messages */
.contrib-message {
    padding: 12px;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 14px;
}

.contrib-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.contrib-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Footer de la modal */
.modal-contribution-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.btn-submit {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-submit:hover:not(:disabled) {
    background: #218838;
}

.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-cancel {
    padding: 10px 20px;
    background: white;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #f5f5f5;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-20px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .modal-contribution-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .contrib-type-buttons {
        grid-template-columns: 1fr;
    }
    
    .contribution-photo img {
        height: 100px;
    }

    .contributions-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .contributions-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        width: 100%;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
    }
}

/* ========================================
   CORRECTIONS POUR LES DOCUMENTS
======================================== */
.pswp__custom-caption {
    background: rgba(0, 0, 0, 0.75);
    font-size: 14px;
    color: white;
    padding: 10px 20px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
}

.pswp-description {
    font-size: 16px;
    margin-bottom: 5px;
}

.pswp-info {
    font-size: 12px;
    opacity: 0.8;
}

.photo-link, .document-link {
    display: block;
}
/* Conteneur de la galerie documents */
.documents-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Style pour les documents avec miniatures */
.contribution-document {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

/* IMPORTANT : Limiter la taille de la miniature */
.document-preview {
    flex-shrink: 0;
    width: 100px !important;  /* Taille fixe */
    height: 100px !important; /* Taille fixe */
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    cursor: zoom-in;
    transition: transform 0.2s;
    position: relative;
}

.document-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Le lien qui contient l'image */
.document-link {
    display: block;
    width: 100%;
    height: 100%;
}

/* L'image miniature elle-même */
.document-thumb {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Important : couvre toute la zone en gardant les proportions */
    display: block;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 15px;
}

.document-description {
    color: #666;
    font-size: 14px;
    margin: 8px 0;
    line-height: 1.4;
    background: #f9f9f9;
    padding: 8px;
    border-radius: 4px;
}

/* Description des photos aussi */
.photo-description {
    padding: 6px;
    background: rgba(255, 255, 255, 0.95);
    font-size: 12px; /* Réduit de 13px */
    color: #555;
    border-top: 1px solid #eee;
    max-height: 40px; /* Limite la hauteur */
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-download {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.2s;
}

.btn-download:hover {
    background: #218838;
    color: white;
    text-decoration: none;
}

/* Styles pour PhotoSwipe captions */
.pswp__custom-caption {
    background: rgba(0, 0, 0, 0.75);
    font-size: 14px;
    color: white;
    padding: 10px 20px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
}

.pswp-description {
    font-size: 16px;
    margin-bottom: 5px;
    color: white;
}

.pswp-info {
    font-size: 12px;
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.8);
}

.photo-link, .document-link {
    display: block;
}



/* Responsive pour mobile */
@media (max-width: 480px) {
    .contribution-document {
        flex-direction: column;
    }
    
    .document-preview {
        width: 100% !important;
        height: 200px !important;
    }
}

/* Pour mobile */
@media (max-width: 480px) {
    .contributions-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .contribution-photo img {
        height: 80px;
    }
}