/**
 * Styles pour les composants JavaScript
 * Lightbox, Toast, Back to Top, etc.
 */

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    animation: zoomIn 0.3s ease;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.3s ease;
}

.lightbox-close:hover {
    color: var(--color-accent);
}

.lightbox-caption {
    color: #fff;
    text-align: center;
    padding: 15px;
    font-size: 1.1rem;
}

/* ============================================================
   BACK TO TOP BUTTON
   ============================================================ */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

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

.back-to-top:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-5px);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 15px 20px;
    background-color: var(--color-dark);
    color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    min-width: 250px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    background-color: var(--color-success);
}

.toast-danger {
    background-color: var(--color-danger);
}

.toast-warning {
    background-color: var(--color-warning);
}

.toast-info {
    background-color: var(--color-info);
}

/* ============================================================
   TOOLTIPS
   ============================================================ */
.tooltip {
    position: absolute;
    background-color: var(--color-dark);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 9997;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-dark);
}

/* ============================================================
   ACCORDÉON
   ============================================================ */
.accordion-item {
    border: 1px solid var(--color-light-gray);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-header {
    background-color: var(--color-beige);
    padding: 15px 20px;
    cursor: pointer;
    font-weight: 600;
    color: var(--color-primary-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.accordion-header:hover {
    background-color: var(--color-sand);
}

.accordion-header::after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    transition: transform 0.3s ease;
}

.accordion-item.active .accordion-header::after {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #fff;
}

.accordion-body {
    padding: 15px 20px;
}

/* ============================================================
   FIELD ERROR
   ============================================================ */
.form-control.error {
    border-color: var(--color-danger);
}

.field-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    margin-top: 5px;
}

/* ============================================================
   CHARACTER COUNTER
   ============================================================ */
.char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: var(--color-gray);
    margin-top: 5px;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(139, 69, 19, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 50px;
    height: 50px;
    border-width: 5px;
}

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

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================================
   CLASSES UTILITAIRES D'ANIMATION
   ============================================================ */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.zoom-in {
    animation: zoomIn 0.5s ease;
}

.slide-in-right {
    animation: slideInRight 0.5s ease;
}

.slide-in-left {
    animation: slideInLeft 0.5s ease;
}

.slide-in-up {
    animation: slideInUp 0.5s ease;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 95%;
    }
    
    .lightbox-close {
        top: -35px;
        font-size: 30px;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
    }
}
