/* css/ui_enhancements.css */

/* --- ZOOM LOUPE (MAGNIFIER) --- */
.magnifier-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    /* Ensure interaction is obvious */
    overflow: hidden;
    border-radius: 8px;
    line-height: 0;
}

.magnifier-lens {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: crosshair;
    width: 220px;
    height: 220px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6),
        inset 0 0 15px rgba(0, 0, 0, 0.2),
        0 0 0 1000px rgba(0, 0, 0, 0.1);
    /* Subtle darkening outside lens */
    display: none;
    pointer-events: none;
    z-index: 9990;
    /* Very high, but below modals */
    background-repeat: no-repeat;
    background-color: #000;
    transition: opacity 0.2s ease-out, transform 0.1s ease-out;
    opacity: 0;
    transform: scale(0.8);
}

.magnifier-lens.active {
    display: block;
    opacity: 1;
    transform: scale(1);
}

/* Hide cursor on the image when lens is active - DISABLED to avoid mouse disappearing */
.magnifier-container:hover .stamp-image {
    cursor: crosshair;
}

/* --- DRAG & DROP ZONE --- */
.upload-drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    overflow: hidden;
}

.upload-drop-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(0, 122, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-drop-zone:hover::before,
.upload-drop-zone.dragover::before {
    opacity: 1;
}

.upload-drop-zone:hover,
.upload-drop-zone.dragover {
    border-color: var(--accent-blue, #007aff);
    background: rgba(0, 122, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 122, 255, 0.1);
    transform: translateY(-2px);
}

.upload-drop-zone .upload-icon {
    font-size: 3em;
    color: var(--accent-blue, #007aff);
    filter: drop-shadow(0 0 10px rgba(0, 122, 255, 0.3));
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.upload-drop-zone:hover .upload-icon,
.upload-drop-zone.dragover .upload-icon {
    transform: scale(1.2) translateY(-5px);
}

.upload-drop-zone .upload-text {
    color: #94a3b8;
    font-weight: 500;
    z-index: 1;
}

.upload-drop-zone .upload-text strong {
    color: #fff;
    display: block;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.upload-drop-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* --- UNIFIED GALLERY & PREVIEW SYSTEM --- */
.unified-gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Stack by default on mobile */
    gap: 20px;
    margin-top: 35px;
    /* Added spacing from drop zone */
    width: 100%;
}

@media (min-width: 900px) {
    .unified-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on larger screens */
    }
}

.gallery-card {
    background: rgba(45, 49, 66, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    min-height: 80px;
}

.gallery-card:hover {
    background: rgba(45, 49, 66, 0.6);
    border-color: rgba(0, 122, 255, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.gallery-card .img-box {
    width: 60px !important;
    height: 60px !important;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-card .img-box img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.gallery-card .card-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.gallery-card .file-name {
    font-size: 0.85em;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Inter', sans-serif;
}

.gallery-card .comment-field {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.8em;
    padding: 6px 10px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s;
}

.gallery-card .comment-field:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--accent-blue, #007aff);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

.gallery-card .card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 10px;
}

/* Styled Delete Toggle */
.delete-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.2);
    color: #ff453a;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.2s;
    width: fit-content !important;
    white-space: nowrap;
}

.delete-toggle:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.4);
}

.delete-toggle input[type="checkbox"] {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute;
}

.delete-toggle .icon {
    font-size: 1.1em;
}

/* State when checked for deletion */
.gallery-card.marked-for-delete {
    opacity: 0.4;
    filter: grayscale(0.8);
    background: rgba(231, 76, 60, 0.05);
}

.gallery-card.marked-for-delete .delete-toggle {
    background: #e74c3c;
    color: white;
}

/* Single Upload Preview (matches cards) */
.upload-preview-container {
    display: none;
    margin-top: 20px;
}

.upload-preview-container.active {
    display: block;
}

/* --- MODALS (LIQUID GLASS STYLE) --- */
.liquid-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    /* Highest priority */
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.liquid-modal-overlay.active {
    display: flex !important;
}

.liquid-modal-glass {
    background: rgba(31, 34, 46, 0.6);
    backdrop-filter: blur(25px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.liquid-modal-overlay.active .liquid-modal-glass {
    transform: scale(1);
}

.liquid-modal-glass.red {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.4);
    box-shadow: 0 25px 50px rgba(231, 76, 60, 0.15);
}

.liquid-modal-glass.blue {
    background: rgba(0, 122, 255, 0.1);
    border-color: rgba(0, 122, 255, 0.4);
    box-shadow: 0 25px 50px rgba(0, 122, 255, 0.15);
}

.liquid-modal-glass.green {
    background: rgba(46, 204, 113, 0.1);
    border-color: rgba(46, 204, 113, 0.4);
    box-shadow: 0 25px 50px rgba(46, 204, 113, 0.15);
}

.liquid-modal-glass h3 {
    margin-top: 0;
    font-size: 1.5em;
    font-weight: 700;
    color: #fff;
    margin-bottom: 15px;
}

.liquid-modal-glass p {
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 30px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 25px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.95em;
}

.modal-btn-confirm {
    background: var(--accent-blue, #007aff);
    color: white;
}

.liquid-modal-glass.red .modal-btn-confirm {
    background: #e74c3c;
}

.modal-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.modal-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

/* --- CLOSE BUTTON (MODERN GLASS STYLE) --- */
.close-modal {
    position: fixed;
    top: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px) saturate(160%);
    -webkit-backdrop-filter: blur(15px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    user-select: none;
    line-height: 1;
}

.close-modal:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.4);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 12px 40px rgba(255, 59, 48, 0.3);
}

.close-modal:active {
    transform: rotate(90deg) scale(0.95);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- EXEMPLAR CARDS (CARTOUCHES) --- */
.exemplar-list-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 15px;
}

.exemplar-card {
    background: rgba(31, 34, 46, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    display: flex;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 180px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.exemplar-card:hover {
    transform: translateY(-3px);
    background: rgba(31, 34, 46, 0.6);
    border-color: rgba(0, 122, 255, 0.3);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

/* Left Column: Media */
.exemplar-card-media {
    width: 200px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.ex-main-thumb-wrapper {
    width: 100%;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.ex-main-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s;
}

.ex-main-thumb:hover {
    transform: scale(1.05);
}

.ex-gallery-mini {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.ex-gallery-mini img {
    height: 35px;
    width: 35px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    flex-shrink: 0;
}

/* Right Column: Content */
.exemplar-card-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.ex-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.ex-collection-tag {
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-blue);
    background: rgba(0, 122, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

.ex-status-badges {
    display: flex;
    gap: 8px;
}

.ex-card-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    flex: 1;
}

.ex-info-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ex-info-label {
    font-size: 0.7em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ex-info-value {
    font-size: 0.95em;
    color: var(--text-main);
    font-weight: 500;
}

.ex-info-value.highlight-green {
    color: var(--accent-green);
    font-weight: 700;
}

.ex-commentary-box {
    margin-top: 15px;
    padding: 8px 12px;
    background: rgba(0, 122, 255, 0.05);
    border-left: 2px solid var(--accent-blue);
    border-radius: 4px;
}

.ex-commentary-text {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    line-height: 1.4;
}

/* Action Bar */
.ex-card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ex-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ex-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
}

.ex-action-btn.edit:hover {
    background: rgba(0, 122, 255, 0.2);
    color: var(--accent-blue);
    border-color: rgba(0, 122, 255, 0.4);
}

.ex-action-btn.delete:hover {
    background: rgba(231, 76, 60, 0.2);
    color: #ff453a;
    border-color: rgba(231, 76, 60, 0.4);
}

/* --- PHOTO BADGES (RÉELLE VS RÉFÉRENCE) --- */
.badge-photo-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 100%;
}

.photo-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.65em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #fff;
    pointer-events: none;
    user-select: none;
}

.photo-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* Badge Photo Réelle */
.badge-photo-reelle {
    background: rgba(46, 204, 113, 0.25);
    border-color: rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

.badge-photo-reelle::before {
    background: #2ecc71;
    box-shadow: 0 0 8px #2ecc71;
}

/* Badge Photo de Référence */
.badge-photo-reference {
    background: rgba(243, 156, 18, 0.25);
    border-color: rgba(243, 156, 18, 0.4);
    color: #f39c12;
}

.badge-photo-reference::before {
    background: #f39c12;
    box-shadow: 0 0 8px #f39c12;
}