:root { --theme-primary: #8b2252; }
body { font-family: 'Montserrat', sans-serif; overflow-x: hidden; background-color: #fdf8fc; }
.fade-in { animation: fadeIn 0.2s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.image-crop-container {
    position: relative; width: 100%; aspect-ratio: 1 / 1;
    background-color: #fce7f3; overflow: hidden; border-radius: 0.5rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.image-crop-container img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.5s ease; }
.product-card:hover .image-crop-container img { transform: scale(1.05); }

.admin-sticky-header { position: sticky; top: 0; z-index: 50; background-color: white; padding: 1rem 0; border-bottom: 1px solid #fbcfe8; }
.admin-sticky-filters { position: sticky !important; top: 90px !important; z-index: 35 !important; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.06); }

.logo-alunea { font-family: 'Philosopher', sans-serif; font-weight: 700; letter-spacing: 0.05em; }

#loadingOverlay {
    position: fixed; inset: 0; background: rgba(253,248,252,0.95);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; flex-direction: column; gap: 1rem;
}
.spinner {
    border: 4px solid #fbcfe8; border-top-color: #8b2252;
    border-radius: 50%; width: 50px; height: 50px; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#brandsSubNavContainer > div::-webkit-scrollbar { height: 4px; }
#brandsSubNavContainer > div::-webkit-scrollbar-thumb { background-color: #fbcfe8; border-radius: 4px; }
#brandsSubNavContainer > div::-webkit-scrollbar-track { background-color: transparent; }

.btn-add { opacity: 0; transform: translateY(10px); transition: all 0.3s ease; }
.product-card:hover .btn-add { opacity: 1; transform: translateY(0); }
@media (hover: none) and (pointer: coarse) {
    .btn-add { opacity: 1 !important; transform: translateY(0) !important; }
    .product-card:hover .image-crop-container img { transform: none; }
}

.photo-bank-item .delete-photo-btn { opacity: 0; transition: opacity 0.2s; }
.photo-bank-item:hover .delete-photo-btn { opacity: 1; }
@media (hover: none) and (pointer: coarse) {
    .photo-bank-item .delete-photo-btn { opacity: 1 !important; }
}

@keyframes successPulse {
    0%, 100% { background-color: transparent; }
    50% { background-color: #dcfce7; }
}
.row-success { animation: successPulse 0.8s ease-in-out; }

#dragGhost {
    position: fixed; pointer-events: none; z-index: 9999;
    width: 100px; height: 100px; border-radius: 10px; overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    border: 3px solid var(--theme-primary); opacity: 0.95; transform: rotate(3deg);
}
#dragGhost img { width: 100%; height: 100%; object-fit: cover; }

body.dragging { user-select: none; cursor: grabbing !important; }
body.dragging * { cursor: grabbing !important; }

.bank-sticky { position: sticky; top: 180px; align-self: flex-start; max-height: calc(100vh - 200px); }
@media (max-width: 1023px) {
    .bank-sticky { position: relative; top: auto; max-height: 750px; }
}

#photoBankGrid { scroll-behavior: auto; }

/* ✅ Nombre del archivo en el banco */
.photo-name {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    text-overflow: ellipsis;
    min-height: 24px;
    font-size: 10px;
    line-height: 1.25;
    color: #333;
    font-weight: 600;
}

/* ✅ Foto item en formato LISTA horizontal */
.photo-bank-item.list-view {
    display: flex !important;
    flex-direction: row !important;
    aspect-ratio: auto !important;
    min-height: 70px;
    align-items: stretch;
}
.photo-bank-item.list-view > div:first-child {
    width: 70px !important;
    height: 70px !important;
    flex-shrink: 0;
    position: relative;
}
.photo-bank-item.list-view > div:last-child {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 6px 10px !important;
    min-height: auto !important;
}
.photo-bank-item.list-view .photo-name {
    margin: 0;
}

.drag-over { background-color: #fbcfe8 !important; outline: 2px dashed var(--theme-primary); }

.expanded-row { background-color: #fef3f8 !important; }
.expanded-content {
    background: #fdf2f8;
    border-top: 2px solid #fbcfe8;
    border-bottom: 2px solid #fbcfe8;
    padding: 16px;
}
.expanded-content .gallery-thumb {
    position: relative; width: 90px; height: 90px;
    border-radius: 8px; overflow: hidden;
    border: 2px solid #fbcfe8; flex-shrink: 0;
}
.expanded-content .gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.expanded-content .gallery-thumb .remove-btn {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px;
    background: rgba(220, 38, 38, 0.9);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold; cursor: pointer; z-index: 10;
}
.expanded-content .gallery-thumb .remove-btn:hover { background: rgba(185, 28, 28, 1); }

.inline-edit-input {
    border: 2px solid var(--theme-primary);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    width: 100%;
    outline: none;
}
.inline-edit-input.price { width: 90px; }
.inline-edit-input.name { min-width: 200px; }

.editable-cell {
    cursor: pointer; padding: 2px 6px;
    border-radius: 4px; transition: background 0.2s;
}
.editable-cell:hover { background: #fce7f3; }

#productModal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.75);
    z-index: 100; display: none; align-items: center; justify-content: center;
    padding: 16px; overflow-y: auto;
}
#productModal.visible { display: flex; }
#productModal .modal-content {
    background: white; border-radius: 16px; max-width: 1000px; width: 100%;
    max-height: 90vh; overflow-y: auto; position: relative;
    animation: scaleIn 0.2s ease-out;
}
@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.shade-chip {
    padding: 4px 12px; border-radius: 999px; font-size: 11px;
    font-weight: 600; border: 1px solid #fbcfe8;
    background: #fdf2f8; color: #8b2252; cursor: default; user-select: none;
}
.modal-thumb {
    width: 60px; height: 60px; border-radius: 6px; overflow: hidden;
    cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s; flex-shrink: 0;
}
.modal-thumb.active { border-color: var(--theme-primary); }
.modal-thumb:hover { border-color: #f472b6; }
.modal-thumb img { width: 100%; height: 100%; object-fit: cover; }