/* =========================================
   MODO ADMIN - ESTILOS
   ========================================= */

/* Banda superior */
.admin-mode-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #d4af37 0%, #b8932e 100%);
    color: #000;
    padding: 8px 20px;
    z-index: 99999;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
}

.admin-bar-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.admin-bar-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.admin-bar-email {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-left: auto;
}

.admin-bar-logout {
    background: #000;
    color: #d4af37;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.admin-bar-logout:hover {
    background: #c0392b;
    color: #fff;
}

/* ✅ Padding al header en lugar del body */
body.is-admin .main-header {
    margin-top: 42px;
}

/* =========================================
   BOTÓN FLOTANTE "+" (FAB)
   ========================================= */
.admin-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #d4af37;
    color: #000;
    border: 2px solid #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.5);
    transition: all 0.3s ease;
    animation: fab-pulse 2s ease-in-out infinite;
}

@keyframes fab-pulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(212, 175, 55, 0.5); }
    50% { box-shadow: 0 10px 40px rgba(212, 175, 55, 0.9); }
}

.admin-fab:hover {
    transform: scale(1.15) rotate(90deg);
    animation: none;
    box-shadow: 0 15px 40px rgba(212, 175, 55, 0.8);
}

/* =========================================
   BOTÓN "+" EN LOS TABS
   ========================================= */
.tab-add-brand {
    border-color: #25d366 !important;
    color: #25d366 !important;
    border-style: dashed !important;
}

.tab-add-brand:hover {
    background: #25d366 !important;
    color: #000 !important;
}

/* =========================================
   BOTÓN DE EDITAR EN CADA PRODUCTO (✏️)
   ========================================= */
body.is-admin .product-card {
    position: relative;
}

.admin-edit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #d4af37;
    color: #000;
    border: 2px solid #fff;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

.product-card:hover .admin-edit-btn {
    opacity: 1;
    transform: scale(1);
}

.admin-edit-btn:hover {
    background: #fff;
    transform: scale(1.15) rotate(15deg);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}

/* =========================================
   RESPONSIVE - BANDA Y FAB
   ========================================= */
@media (max-width: 768px) {
    .admin-bar-label span {
        display: none;
    }
    .admin-bar-email {
        display: none;
    }
    .admin-fab {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        bottom: 20px;
        right: 20px;
    }
}

/* =========================================
   MODAL DE EDICIÓN - DISEÑO PREMIUM
   ========================================= */

/* Overlay oscuro que cubre toda la pantalla */
.admin-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: overlayFadeIn 0.25s ease;
}

.admin-modal-overlay.active {
    display: flex !important;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Contenedor del modal */
.admin-modal {
    background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 20px;
    width: 100%;
    max-width: 650px;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 
        0 40px 100px rgba(0, 0, 0, 0.9),
        0 0 80px rgba(212, 175, 55, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: modalPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Barra decorativa superior dorada */
.admin-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
    border-radius: 20px 20px 0 0;
}

/* Header del modal */
.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 20px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, #1a1a1a 0%, #151515 100%);
    border-radius: 20px 20px 0 0;
    z-index: 10;
}

.admin-modal-header h3 {
    color: #d4af37;
    font-size: 1.3rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.admin-modal-header h3::before {
    content: '✏️';
    font-size: 1.2rem;
}

/* Botón X para cerrar */
.admin-modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    font-size: 1.4rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.admin-modal-close:hover {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.15);
    border-color: #d4af37;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

/* Cuerpo del modal */
.admin-modal-body {
    padding: 30px;
}

/* Grupos de campos */
.admin-form-group {
    margin-bottom: 20px;
    position: relative;
}

.admin-form-group label {
    display: block;
    color: #d4af37;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.admin-form-group label::before {
    content: '▸ ';
    color: #d4af37;
    opacity: 0.7;
}

/* Inputs, textarea, select */
.admin-form-group input,
.admin-form-group textarea,
.admin-form-group select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.5);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.admin-form-group input::placeholder,
.admin-form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
    font-style: italic;
}

.admin-form-group input:hover,
.admin-form-group textarea:hover,
.admin-form-group select:hover {
    border-color: rgba(212, 175, 55, 0.3);
    background: rgba(0, 0, 0, 0.6);
}

.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
    border-color: #d4af37;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 
        0 0 0 4px rgba(212, 175, 55, 0.12),
        0 8px 25px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.admin-form-group textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

.admin-form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
    padding-right: 45px;
}

/* Filas de 3 columnas */
.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 5px;
}

/* Footer con botones */
.admin-modal-footer {
    display: flex;
    gap: 15px;
    padding: 20px 30px 25px;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    background: linear-gradient(180deg, #0f0f0f 0%, #0a0a0a 100%);
    border-radius: 0 0 20px 20px;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Botones */
.admin-btn {
    flex: 1;
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.admin-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.admin-btn:active::before {
    width: 300px;
    height: 300px;
}

/* Botón principal (Guardar) */
.admin-btn-primary {
    background: linear-gradient(135deg, #d4af37 0%, #b8932e 100%);
    color: #000;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.admin-btn-primary:hover {
    background: linear-gradient(135deg, #fff 0%, #e0e0e0 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.5);
}

/* Botón secundario (Cancelar) */
.admin-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.admin-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
}

/* Botón peligro (Eliminar) */
.admin-btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.admin-btn-danger:hover {
    background: linear-gradient(135deg, #ff5c4c 0%, #e74c3c 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(231, 76, 60, 0.5);
}

/* Mensaje de feedback (éxito/error) */
.admin-modal-feedback {
    padding: 14px 20px;
    margin: 0 30px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
    animation: feedbackSlide 0.3s ease;
    text-align: center;
}

@keyframes feedbackSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-modal-feedback.success {
    display: block;
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1.5px solid #4caf50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

.admin-modal-feedback.error {
    display: block;
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1.5px solid #e74c3c;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.2);
}

/* Scrollbar personalizada del modal */
.admin-modal::-webkit-scrollbar {
    width: 8px;
}

.admin-modal::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
}

.admin-modal::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d4af37, #b8932e);
    border-radius: 20px;
}

.admin-modal::-webkit-scrollbar-thumb:hover {
    background: #d4af37;
}

/* Responsive - Modal */
@media (max-width: 600px) {
    .admin-modal {
        max-width: 100%;
        border-radius: 16px;
        max-height: 95vh;
    }
    
    .admin-modal-header {
        padding: 20px 20px 15px;
    }
    
    .admin-modal-header h3 {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    
    .admin-modal-body {
        padding: 20px;
    }
    
    .admin-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .admin-modal-footer {
        padding: 15px 20px 20px;
        flex-wrap: wrap;
    }
    
    .admin-btn {
        padding: 12px 15px;
        font-size: 0.75rem;
    }
}