/* Galerie d'Art - Style Intimiste Responsive */




* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Garamond', 'Georgia', serif;
    background: #1a1a1a;
    color: #e8e8e8;
    min-height: 100vh;
    padding: 0;
}

.sticky-header-wrapper {
    position: sticky;
    top: 0;
    background: #1a1a1a;
    z-index: 1000;
    padding: 20px 0 20px 0;
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 10px;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

h1 {
    color: #d4af37;
    font-size: clamp(1.5em, 5vw, 2.5em);
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Navigation Par artiste / Par œuvre */
.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.nav-link {
    background: #1a1a1a;
    border: 2px solid #444;
    color: #999;
    padding: 8px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s;
    cursor: pointer;
    font-family: 'Garamond', 'Georgia', serif;
}

.nav-link:hover {
    border-color: #d4af37;
    color: #d4af37;
    transform: translateY(-2px);
}

.nav-link.active {
    background: #d4af37;
    border-color: #d4af37;
    color: #1a1a1a;
    font-weight: bold;
    cursor: default;
}

.nav-link.active:hover {
    transform: none;
}

/* Bouton + FIXE en bas à droite */
.btn-add {
    position: fixed !important;
    right: 27px !important;
    bottom: 20px !important;
    top: auto !important;
    transform: none !important;
    width: 60px;
    height: 60px;
    border: 2px solid #d4af37;
    background: #1a1a1a;
    color: #d4af37;
    font-size: 2em;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    z-index: 900;
}

.btn-add:hover, 
.btn-add:active {
    background: #d4af37;
    color: #1a1a1a;
    transform: scale(1.1) !important;
}

.search-container-oeuvres{
    max-width: 500px;
    margin: 0 auto 20px;
    padding: 0 10px;
    position: relative;
}

.search-container {
    max-width: 500px;
    margin: 0 auto 20px;
    padding: 0 10px;
    position: relative;
}

.search-bar-oeuvres {
    width: 109%;
    padding: 15px 45px 15px 20px;
    font-size: 1em;
    border: 1px solid #444;
    background: #2a2a2a;
    color: #e8e8e8;
    border-radius: 15px;
    font-family: 'Garamond', 'Georgia', serif;
    transition: all 0.3s;
}

.search-bar {
    width: 109%;
    padding: 15px 45px 15px 20px;
    font-size: 1em;
    border: 1px solid #444;
    background: #2a2a2a;
    color: #e8e8e8;
    border-radius: 15px;
    font-family: 'Garamond', 'Georgia', serif;
    transition: all 0.3s;
}

.search-clear {
    position: absolute;
    right: 25px;
    top: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.3em;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: none;
    transition: color 0.3s;
    line-height: 30px;
    text-align: center;
}

.search-clear:hover {
    color: #d4af37;
}

.search-clear.visible {
    display: block;
}

.search-bar:focus {
    outline: none;
    border-color: #d4af37;
    background: #333;
}

.search-bar::placeholder {
    color: #888;
}

.result-count {
    text-align: center;
    color: #999;
    font-size: 0.9em;
    margin-top: 10px;
    font-style: italic;
}

.loading {
    text-align: center;
    color: #999;
    font-size: 1.1em;
    padding: 60px 20px;
    font-style: italic;
}

.artistes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    padding: 10px 0;
}

.artiste-card {
    background: #242424;
    border: 1px solid #333;
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s ease;
    -webkit-tap-highlight-color: transparent;
}

.artiste-card.hidden {
    display: none;
}

.artiste-card:active {
    background: #2a2a2a;
    border-color: #d4af37;
}

@media (hover: hover) {
    .artiste-card:hover {
        border-color: #d4af37;
        background: #2a2a2a;
        transform: translateY(-3px);
    }
}

.artiste-card h2 {
    color: #d4af37;
    font-size: 1.3em;
    font-weight: 300;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.artiste-card p {
    color: #999;
    font-size: 0.9em;
    margin-bottom: 12px;
}

.artiste-card .badge {
    display: inline-block;
    color: #888;
    padding: 5px 0;
    font-size: 0.85em;
    border-top: 1px solid #333;
    margin-top: 8px;
    width: 100%;
}

.highlight {
    background-color: #d4af37;
    color: #1a1a1a;
    padding: 2px 4px;
}

/* Bloquer le scroll du fond quand une modal est ouverte */
body.modal-open {
    overflow: hidden;
    touch-action: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

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

.modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    margin: 20px auto;
    padding: 30px 20px;
    width: 90%;
    max-width: 600px;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    transition: color 0.3s;
    -webkit-tap-highlight-color: transparent;
    padding: 5px;
}

.close:active {
    color: #d4af37;
}

@media (hover: hover) {
    .close:hover {
        color: #d4af37;
    }
}

.modal-content h2 {
    color: #d4af37;
    font-size: 1.8em;
    font-weight: 300;
    margin-bottom: 30px;
    text-align: center;
    letter-spacing: 2px;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.oeuvres-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.oeuvre-item {
    background: #242424;
    border: 1px solid #333;
    color: #e8e8e8;
    padding: 15px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
    -webkit-tap-highlight-color: transparent;
}

.oeuvre-item:active {
    border-color: #d4af37;
    background: #2a2a2a;
}

@media (hover: hover) {
    .oeuvre-item:hover {
        border-color: #d4af37;
        background: #2a2a2a;
    }
}

/* Bouton + œuvre FIXE en bas à droite */
.btn-add-oeuvre {
    position: fixed !important;
    right: 20px !important;
    bottom: 20px !important;
    top: auto !important;
    transform: none !important;
    width: 60px;
    height: 60px;
    border: 2px solid #d4af37;
    background: #1a1a1a;
    color: #d4af37;
    font-size: 2em;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    z-index: 900;
}

.btn-add-oeuvre:hover, 
.btn-add-oeuvre:active {
    background: #d4af37;
    color: #1a1a1a;
    transform: scale(1.1) !important;
}

/* Page œuvre */
.oeuvre-page {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.oeuvre-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 15px;
}

.back-button {
    background: #1a1a1a;
    border: 2px solid #d4af37;
    padding: 10px 20px;
    cursor: pointer;
    margin-bottom: 30px;
    transition: all 0.3s;
    font-family: 'Garamond', 'Georgia', serif;
    border-radius: 25px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.back-button img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(78%) sepia(25%) saturate(1082%) hue-rotate(7deg) brightness(93%) contrast(85%);
    transition: filter 0.3s;
}

.back-button:hover {
    background: #d4af37;
    transform: translateX(-5px);
}

.back-button:hover img {
    filter: brightness(0) saturate(100%) invert(9%) sepia(7%) saturate(7%) hue-rotate(358deg) brightness(96%) contrast(89%);
}

.back-button:active {
    transform: translateX(-3px) scale(0.98);
}

.oeuvre-image {
    width: 100%;
    max-width: 700px;
    height: auto;
    display: block;
    margin: 0 auto 30px;
    border: 1px solid #333;
}

.oeuvre-legende {
    max-width: 700px;
    margin: 0 auto;
    background: #242424;
    border: 1px solid #333;
    padding: 25px 20px;
    line-height: 1.8;
}

.oeuvre-legende h3 {
    color: #d4af37;
    font-size: 1.6em;
    font-weight: 300;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.oeuvre-legende p {
    color: #bbb;
    font-size: 0.95em;
    margin-bottom: 12px;
}

.oeuvre-legende strong {
    color: #d4af37;
    font-weight: 400;
}

.error {
    text-align: center;
    color: #d4af37;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid #d4af37;
    padding: 20px;
    margin: 30px 15px;
}

/* Formulaire */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #d4af37;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #e8e8e8;
    font-size: 1em;
    font-family: 'Garamond', 'Georgia', serif;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #d4af37;
}

.form-group textarea {
    resize: vertical;
}

.form-group input[type="date"] {
    padding-right: 235px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #d4af37;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: #d4af37;
    color: #1a1a1a;
    border: none;
    font-size: 1em;
    cursor: pointer;
    font-family: 'Garamond', 'Georgia', serif;
    font-weight: 600;
    letter-spacing: 1px;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:active {
    background: #c49d2d;
}

@media (hover: hover) {
    .btn-primary:hover {
        background: #c49d2d;
    }
}

/* Fix z-index modals */
#imageFormModal {
    z-index: 3000 !important;
}

#imageFormModal .modal-content {
    z-index: 3001 !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Mobile */
@media (max-width: 768px) {
    body {
        padding: 0 15px 0px 15px;
    }

    h1 {
        font-size: 1.5em;
        letter-spacing: 1px;
    }

    .btn-add, {
        width: 40px;
        height: 40px;
        font-size: 1.5em;
        right: 18px !important;
        bottom: 170px;

    }


    .btn-add-oeuvre {
        width: 40px;
        height: 40px;
        font-size: 1.5em;
        right: 18px !important;
        bottom: 170px;

    }

    .header {
        /*margin-bottom: 25px;*/
        padding-bottom: 15px;
    }

    .search-container {
        margin-bottom: 10px;
        margin-right: 25px;
    }

    .search-container-oeuvres {
        margin-bottom: 10px;
        margin-right: 25px;
    }


    .search-bar {
        padding: 12px 15px;
        font-size: 0.95em;
    }

    .search-bar-oeuvres {
        padding: 12px 15px;
        font-size: 0.95em;
    }

    .artistes-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .artiste-card {
        padding: 20px 15px;
    }

    .artiste-card h2 {
        font-size: 1.4em;
    }

    .modal-content {
        width: 95%;
        padding: 25px 15px;
        margin: 10px auto;
    }

    .modal-content h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    .oeuvres-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .oeuvre-item {
        padding: 15px;
    }

    .oeuvre-container {
        padding: 20px 10px;
    }

    .back-button {
        padding: 10px 20px;
        font-size: 0.9em;
        margin-bottom: 20px;
    }

    .oeuvre-legende {
        padding: 20px 15px;
    }

    .oeuvre-legende h3 {
        font-size: 1.4em;
    }

    .oeuvre-legende p {
        font-size: 0.9em;
    }
}

@media (max-width: 400px) {
    h1 {
        font-size: 1.3em;
    }

    .btn-add,
    .btn-add-oeuvre {
        width: 45px;
        height: 45px;
        font-size: 1.6em;
    }

    .artiste-card h2 {
        font-size: 1.2em;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        margin: 5px auto;
        max-height: 95vh;
        overflow-y: auto;
    }

    .oeuvre-container {
        padding: 15px 10px;
    }
}

@media (hover: none) {
    .artiste-card,
    .oeuvre-item,
    .close,
    .back-button,
    .btn-add,
    .btn-add-oeuvre,
    .btn-primary {
        -webkit-tap-highlight-color: rgba(212, 175, 55, 0.2);
    }
}

/* sticky géré uniquement par .sticky-header-wrapper */

/* ============================================
   BOUTONS ÉDITER ET IMPRIMER
   ============================================ */

/* Bouton éditer œuvre */
.btn-edit-oeuvre {
    position: fixed;
    right: 20px;
    bottom: 100px;
    width: 60px;
    height: 60px;
    border: 2px solid #d4af37;
    background: #1a1a1a;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    z-index: 9999;
    display: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit-oeuvre img {
    width: 55%;
    height: 55%;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(78%) sepia(25%) saturate(1082%) hue-rotate(7deg) brightness(93%) contrast(85%);
    transition: filter 0.3s;
}

.btn-edit-oeuvre:hover {
    background: #d4af37;
    transform: scale(1.1);
}

.btn-edit-oeuvre:hover img {
    filter: brightness(0) saturate(100%) invert(9%) sepia(7%) saturate(7%) hue-rotate(358deg) brightness(96%) contrast(89%);
}

/* Bouton imprimer œuvre */
.btn-print-oeuvre {
    position: fixed;
    right: 20px;
    bottom: 170px;
    width: 60px;
    height: 60px;
    border: 2px solid #d4af37;
    background: #1a1a1a;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    z-index: 9999;
    display: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-print-oeuvre img {
    width: 55%;
    height: 55%;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(78%) sepia(25%) saturate(1082%) hue-rotate(7deg) brightness(93%) contrast(85%);
    transition: filter 0.3s;
}

.btn-print-oeuvre:hover {
    background: #d4af37;
    transform: scale(1.1);
}

.btn-print-oeuvre:hover img {
    filter: brightness(0) saturate(100%) invert(9%) sepia(7%) saturate(7%) hue-rotate(358deg) brightness(96%) contrast(89%);
}

/* Responsive */
@media (max-width: 768px) {
    .btn-edit-oeuvre {
        width: 50px;
        height: 50px;
        right: 15px;
        bottom: 80px;
    }
    
    .btn-print-oeuvre {
        width: 50px;
        height: 50px;
        right: 15px;
        bottom: 20px;
    }
}

/* Force z-index des boutons */
.btn-add,
.btn-add-oeuvre,
.btn-edit-oeuvre
.btn-print-oeuvre {
    z-index: 9999 !important;
}

/* Modal en dessous */
.modal {
    z-index: 1000;
}

.oeuvre-page {
    z-index: 2000;
}

#editOeuvreModal,
#addOeuvreModal,
#imageFormModal {
    z-index: 3000 !important;
}

@media print {
    /* Masquer tout sauf la page œuvre */
    body * {
        visibility: hidden;
    }
    
    .oeuvre-page,
    .oeuvre-page * {
        visibility: visible;
    }
    
    /* Configuration page */
    @page {
        size: A3;
        margin: 1cm;
    }
    
    /* Détection orientation automatique */
    @page landscape {
        size: A3 landscape;
    }
    
    @page portrait {
        size: A3 portrait;
    }
    
    /* Reset body */
    body {
        margin: 0;
        padding: 0;
        background: white;
    }
    
    .oeuvre-page {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100vh;
        background: white;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 1cm;
    }

    * {
        page-break-before: avoid !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
    }
    
    html {
        overflow: hidden !important;
        height: 100vh !important;
    }
    
    body {
        overflow: hidden !important;
        height: 100vh !important;
    }
    
    .oeuvre-page {
        overflow: hidden !important;
        height: 100vh !important;
        max-height: 100vh !important;
    }

    .oeuvre-container {
        width: 100%;
        max-width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0;
        margin: 0;
    }
    
    /* Cacher les boutons */
    .back-button,
    .btn-edit-oeuvre,
    .btn-print-oeuvre,
    #imageError {
        display: none !important;
    }
    
    /* Image : 75% de la page */
    .oeuvre-image {
        max-width: 90%;
        max-height: 75vh;
        width: auto;
        height: auto;
        object-fit: contain;
        display: block;
        margin: 0 auto 0cm;
        border: none;
        page-break-after: avoid;
    }
    
    /* Légende : texte en ligne séparé par - */
    .oeuvre-legende {
        max-width: 90%;
        margin: 0 auto;
        padding: 0.5cm;
        background: transparent;
        border: none;
        text-align: center;
        page-break-before: avoid;
        page-break-inside: avoid;
    }
    
    .oeuvre-legende h3 {
        display: inline;
        color: #000;
        font-size: 14pt;
        font-style: italic;
        margin: 0;
    }
    
    .oeuvre-legende h3::after {
        content: ", ";
    }
    
    .oeuvre-legende p {
        display: inline;
        color: #000;
        font-size: 11pt;
        margin: 0;
    }
    
    .oeuvre-legende p strong {
        display: none;
    }
    
    .oeuvre-legende p::after {
        content: " - ";
    }
    
    .oeuvre-legende p:last-child::after {
        content: "";
    }
    
    /* Masquer "Dernière exposition" */
    .oeuvre-legende p:has(strong:contains("Dernière exposition")) {
        display: none !important;
    }
    
    /* Force une seule page */
    .oeuvre-page {
        page-break-after: avoid;
        page-break-before: avoid;
        page-break-inside: avoid;
    }
}

/* Script pour orientation auto */
@media print and (orientation: landscape) {
    @page {
        size: A3 landscape;
    }
}

@media print and (orientation: portrait) {
    @page {
        size: A3 portrait;
    }
}

/* ============================================
   BOUTON SCROLL TO TOP
   ============================================ */
.scroll-to-top {
    position: fixed;
    right: 27px;
    bottom: 80px;
    width: 45px;
    height: 45px;
    background: #1a1a1a;
    border: 2px solid #d4af37;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.scroll-to-top img {
    width: 50%;
    height: 50%;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(78%) sepia(25%) saturate(1082%) hue-rotate(7deg) brightness(93%) contrast(85%);
    transition: filter 0.3s;
}

.scroll-to-top:hover {
    background: #d4af37;
    transform: scale(1.1);
}

.scroll-to-top:hover img {
    filter: brightness(0) saturate(100%) invert(9%) sepia(7%) saturate(7%) hue-rotate(358deg) brightness(96%) contrast(89%);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

@media print {
    .scroll-to-top {
        display: none !important;
    }
}