/* === VARIABLES & THEME === */
:root {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-card: #252525;
    --bg-hover: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888;
    --border-color: #333;
    --accent-green: #4CAF50;
    --accent-purple: #9C27B0;
    --accent-blue: #5a8fd8;
    --accent-pink: #d85a8f;
}

body.light-theme {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f0f0f0;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #dddddd;
}

/* === BASE === */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* === HEADER === */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.site-header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.header-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* === BOUTONS === */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-icon {
    padding: 8px 12px;
    font-size: 18px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-icon:hover {
    background: var(--bg-hover);
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

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

.btn-danger:hover {
    background: #c82333;
}

/* === SECTIONS === */
.section {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.section h2 {
    color: var(--text-secondary);
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-green);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-green);
}

.section-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

/* === GRAPHIQUES === */
.chart-block {
    margin-bottom: 30px;
}

.chart-title {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.chart-title-male {
    color: var(--accent-blue);
}

.chart-title-female {
    color: var(--accent-pink);
}

.chart-wrapper {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    height: 450px;
    box-sizing: border-box;
}

body.light-theme .chart-wrapper {
    background: linear-gradient(135deg, #e8eef5 0%, #f0f4f8 100%);
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* === ZOOM CONTROLS === */
.zoom-controls {
    margin: 10px 0 30px 0;
    position: relative;
    height: 40px;
}

.range-slider-container {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    margin-top: 15px;
}

.range-selected-track {
    position: absolute;
    height: 100%;
    background: var(--accent-green);
    border-radius: 3px;
}

.range-input-wrapper {
    position: relative;
}

.range-input-wrapper input {
    position: absolute;
    width: 100%;
    height: 6px;
    top: -6px;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
}

.range-input-wrapper input::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--accent-green);
    pointer-events: auto;
    -webkit-appearance: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
}

.range-input-wrapper input::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--accent-green);
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
}

.zoom-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 12px;
    color: var(--text-muted);
}

/* === FORMULAIRE === */

form {
    width: 100%;
}

label {
    display: block;
    margin-top: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

input[type="number"],
input[type="date"],
input[type="text"],
textarea,
select {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

input[type="number"]:focus,
input[type="date"]:focus,
input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

input[type="submit"] {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
    background-color: var(--accent-green);
    color: white;
    cursor: pointer;
    font-weight: bold;
    margin-top: 25px;
    border: none;
    transition: background-color 0.3s;
}

input[type="submit"]:hover {
    background-color: #45a049;
}

input[type="submit"]:active {
    background-color: #3d8b40;
}


/* Notification Toast */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease-in-out;
    pointer-events: none;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.success {
    background-color: var(--accent-green);
    color: white;
}

.notification.error {
    background-color: #f44336;
    color: white;
}


/* === SECTION PHOTOS === */

.photos-section {
    max-width: 1600px;
    margin: 40px auto 0;
    padding: 0 20px;
}

.photos-section h2 {
    color: var(--text-secondary);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--accent-purple);
    padding-bottom: 10px;
}

/* Accordéon dossier */
.folder-accordion {
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.folder-header:hover {
    background: var(--bg-hover);
}

.folder-arrow {
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid var(--text-secondary);
    margin-right: 12px;
    transition: transform 0.3s;
}

.folder-accordion.open .folder-arrow {
    transform: rotate(90deg);
}

.folder-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

.folder-count {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 12px;
}

.upload-btn {
    background: var(--accent-purple);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s, transform 0.2s;
}

.upload-btn:hover {
    background: #7B1FA2;
    transform: scale(1.1);
}

.upload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.upload-input {
    display: none;
}

/* Contenu du dossier */
.folder-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s;
    padding: 0 20px;
}

.folder-accordion.open .folder-content {
    max-height: 2000px;
    padding: 15px 20px 20px;
}

.no-photos {
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
}

/* Grille de photos */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.photo-item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background: var(--bg-secondary);
}

.photo-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.photo-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.photo-date {
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px 2px;
    background: var(--bg-secondary);
}

/* Modal photo */
.photo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.photo-modal.show {
    display: flex;
}

.photo-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}

.photo-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
}

.photo-modal-content p {
    color: white;
    margin-top: 10px;
    font-size: 14px;
}

.photo-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 32px;
    cursor: pointer;
    transition: transform 0.2s;
}

.photo-modal-close:hover {
    transform: scale(1.2);
}

/* Compteur de photos */
.photo-modal-counter {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
}

/* Navigation flèches */
.photo-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 48px;
    font-weight: bold;
    cursor: pointer;
    padding: 16px;
    user-select: none;
    transition: background 0.2s, transform 0.2s;
    border-radius: 4px;
    z-index: 10001;
}

.photo-modal-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.photo-modal-prev {
    left: -80px;
}

.photo-modal-next {
    right: -80px;
}

/* Sur petits écrans, flèches à l'intérieur */
@media (max-width: 900px) {
    .photo-modal-prev {
        left: 10px;
    }

    .photo-modal-next {
        right: 10px;
    }

    .photo-modal-nav {
        background: rgba(0, 0, 0, 0.5);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* === FILTRES DOSSIER GROUPE === */
.groupe-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px;
    background: linear-gradient(135deg, #2a1f3d 0%, #1f2a3d 100%);
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.filter-label {
    font-weight: 600;
    color: var(--accent-purple);
    margin-right: 8px;
    font-size: 14px;
}

.dog-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.dog-filter-label:hover {
    background: #3d2a5a;
    border-color: var(--accent-purple);
}

.dog-filter-label:has(.dog-filter-checkbox:checked) {
    background: var(--accent-purple);
    color: white;
    border-color: #7B1FA2;
}

.dog-filter-checkbox {
    cursor: pointer;
    accent-color: var(--accent-purple);
}

.filter-separator {
    color: var(--text-muted);
    margin: 0 4px;
    font-weight: 300;
}

.untagged-filter {
    background: #3d2a1f !important;
    border-color: #ff9800 !important;
}

.untagged-filter:has(.dog-filter-checkbox:checked) {
    background: #ff9800 !important;
    color: white;
    border-color: #e65100 !important;
}

/* === PANNEAU TAGGING MODAL === */
.photo-modal-tags {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    padding: 12px 16px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 12px;
    max-width: 100%;
}

.tags-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 8px;
    font-size: 14px;
}

.tag-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.tag-checkbox-label:hover {
    background: #1f3d2a;
    border-color: var(--accent-green);
}

.tag-checkbox-label:has(.tag-checkbox:checked) {
    background: var(--accent-green);
    color: white;
    border-color: #388E3C;
}

.tag-checkbox {
    cursor: pointer;
    accent-color: var(--accent-green);
}

/* Responsive tagging */
@media (max-width: 600px) {

    /* Masquer le panneau de tagging sur téléphone */
    .photo-modal-tags {
        display: none !important;
    }

    .dog-filter-label {
        font-size: 11px;
        padding: 3px 8px;
    }

    .filter-label {
        font-size: 12px;
        width: 100%;
        text-align: center;
        margin-bottom: 4px;
    }
}

/* === HISTORIQUE DES COMMENTAIRES === */
.history-section {
    background: var(--bg-card) !important;
    color: var(--text-primary);
}

.history-section h2 {
    color: var(--text-primary);
}

.comment-item {
    background: var(--bg-secondary) !important;
}