/* ===== RESET Y CONFIGURACIÓN BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    padding: 20px;
    
    /* Imagen de fondo */
    background-image: url('../images/fondo.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    
    /* Fondo de respaldo por si la imagen no carga */
    background-color: #f4f4f4;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95); /* Fondo semi-transparente */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    backdrop-filter: blur(5px); /* Efecto glass */
}

/* ===== TIPOGRAFÍA ===== */
h1 {
    text-align: center;
    margin-bottom: 40px;
    color: #2c3e50;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    margin-bottom: 25px;
    color: #34495e;
    border-bottom: 3px solid #3498db;
    padding-bottom: 12px;
    font-size: 1.5rem;
}

/* ===== FORMULARIOS ===== */
.form-group {
    margin-bottom: 25px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 10px;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

/* ===== BOTONES PRINCIPALES ===== */
.form-actions {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 3px solid #ecf0f1;
    text-align: center;
}

.btn-guardar {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-guardar:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(39, 174, 96, 0.4);
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.btn-agregar {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.btn-agregar:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.4);
}

.btn-finalizar {
    background: linear-gradient(135deg, #e67e22, #f39c12);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.3);
}

.btn-finalizar:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(230, 126, 34, 0.4);
}

/* ===== BOTONES ESPECIALES ===== */
.btn-ubicacion {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 16px 35px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 auto;
}

.btn-ubicacion:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(39, 174, 96, 0.4);
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.btn-foto {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    padding: 16px 35px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 25px rgba(155, 89, 182, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 auto;
    min-width: 280px;
    justify-content: center;
}

.btn-foto:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(155, 89, 182, 0.4);
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
}

.btn-eliminar {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-eliminar:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.4);
}

/* ===== VISTA PREVIA DE IMAGEN ===== */
.vista-previa-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 100%;
    background: white;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

#vistaPrevia {
    max-width: 100%;
    max-height: 350px;
    border-radius: 12px;
    border: 3px solid #fff;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

#vistaPrevia:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

.vista-previa-controls {
    display: flex;
    justify-content: center;
    width: 100%;
    padding-top: 15px;
    border-top: 2px solid #e9ecef;
}

#vistaPreviaContainer {
    text-align: center;
    margin-top: 25px;
}

/* ===== ELEMENTOS ESPECIALES ===== */
.ubicacion-controls {
    text-align: center;
    margin-bottom: 15px;
}

.help-text {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    text-align: center;
}

.producto-item {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    margin: 15px 0;
    border-radius: 12px;
    border-left: 5px solid #3498db;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.producto-item:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.no-productos {
    text-align: center;
    padding: 30px;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px dashed #dee2e6;
}

/* ===== ESTADOS Y UTILIDADES ===== */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

/* ===== GRUPO DE UBICACIÓN ===== */
.ubicacion-group {
    text-align: center;
    margin-top: 10px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    border: 2px dashed #dee2e6;
}

.ubicacion-controls {
    margin-bottom: 15px;
}

/* ===== CAMPO DE DIRECCIÓN ===== */
input[readonly] {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #b8daff;
    color: #495057;
    cursor: not-allowed;
    text-align: center;
    font-weight: 500;
}

input[readonly]:focus {
    border-color: #b8daff;
    box-shadow: 0 0 0 3px rgba(184, 218, 255, 0.3);
    transform: none;
}

/* ===== ESTADO DE DIRECCIÓN DETECTADA ===== */
.direccion-detectada {
    background: linear-gradient(135deg, #d4edda, #c3e6cb) !important;
    border-color: #28a745 !important;
    color: #155724 !important;
    font-weight: 600;
}

/* ===== GRUPO DE FOTO ===== */
.foto-group {
    text-align: center;
    margin-top: 10px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    border: 2px dashed #dee2e6;
}

.foto-controls {
    margin-bottom: 15px;
}

/* ===== BOTÓN DE CAMBIAR FOTO (estado alternativo) ===== */
.btn-foto.cambiar-foto {
    background: linear-gradient(135deg, #3498db, #2980b9);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
}

.btn-foto.cambiar-foto:hover {
    background: linear-gradient(135deg, #2980b9, #3498db);
    box-shadow: 0 15px 35px rgba(52, 152, 219, 0.4);
}

/* ===== SWEETALERT2 PERSONALIZACIÓN ===== */
.swal2-popup {
    border-radius: 15px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

.swal2-title {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
}

.swal2-html-container {
    font-size: 1rem !important;
    color: #5a6c7d !important;
    line-height: 1.5 !important;
}

.swal2-confirm {
    border-radius: 25px !important;
    padding: 12px 30px !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    background: linear-gradient(135deg, #27ae60, #2ecc71) !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3) !important;
    transition: all 0.3s ease !important;
}

.swal2-confirm:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4) !important;
}

.swal2-cancel {
    border-radius: 25px !important;
    padding: 12px 30px !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    background: linear-gradient(135deg, #95a5a6, #7f8c8d) !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3) !important;
    transition: all 0.3s ease !important;
}

.swal2-cancel:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4) !important;
}

.swal2-success .swal2-success-ring {
    border-color: rgba(39, 174, 96, 0.3) !important;
}

.swal2-success [class^='swal2-success-line'] {
    background-color: #27ae60 !important;
}

.swal2-icon.swal2-error {
    border-color: #e74c3c !important;
}

.swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
    background-color: #e74c3c !important;
}

.swal2-icon.swal2-warning {
    border-color: #f39c12 !important;
    color: #f39c12 !important;
}

.swal2-icon.swal2-info {
    border-color: #3498db !important;
    color: #3498db !important;
}

.swal2-loading {
    border-color: #3498db transparent #3498db transparent !important;
}

/* ===== ANIMACIONES PERSONALIZADAS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.swal2-show {
    animation: fadeInUp 0.3s ease-out !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 25px 20px;
        border-radius: 10px;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn-guardar,
    .btn-agregar,
    .btn-finalizar,
    .btn-ubicacion,
    .btn-foto,
    .btn-eliminar {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
    
    .btn-guardar {
        padding: 16px 20px;
        font-size: 16px;
    }
    
    #vistaPrevia {
        max-height: 280px;
    }
    
    .vista-previa-wrapper {
        padding: 20px 15px;
    }
    
    .ubicacion-group {
        padding: 15px;
        margin-top: 5px;
    }
    
    .btn-ubicacion {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .foto-group {
        padding: 20px 15px;
        margin-top: 5px;
    }
    
    .btn-foto {
        width: 100%;
        min-width: auto;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    /* SweetAlert2 responsive */
    .swal2-popup {
        margin: 10px !important;
        width: auto !important;
    }
    
    .swal2-title {
        font-size: 1.3rem !important;
    }
    
    .swal2-html-container {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    input[type="text"],
    input[type="number"],
    input[type="password"],
    select,
    textarea {
        padding: 12px;
    }
    
    .producto-item {
        padding: 15px;
    }
    
    .ubicacion-group {
        padding: 12px;
    }
    
    .btn-ubicacion {
        padding: 12px 15px;
        font-size: 15px;
    }
    
    .help-text {
        font-size: 13px;
    }
    
    .foto-group {
        padding: 15px 12px;
    }
    
    .btn-foto {
        padding: 12px 15px;
        font-size: 15px;
    }
    
    .vista-previa-wrapper {
        padding: 15px;
    }
    
    #vistaPrevia {
        max-height: 250px;
    }
    
    .btn-eliminar {
        width: 100%;
        justify-content: center;
    }
    
    /* SweetAlert2 mobile */
    .swal2-confirm,
    .swal2-cancel {
        width: 100% !important;
        margin: 5px 0 !important;
    }
    
    .swal2-actions {
        flex-direction: column !important;
    }
}

/* ===== ESTADOS DE VALIDACIÓN ===== */
input:invalid {
    border-color: #e74c3c;
    background: linear-gradient(135deg, #fdf2f2, #f8d7da);
}

input:valid {
    border-color: #27ae60;
}

/* ===== EFECTO DE TRANSICIÓN PARA CAMBIOS DE ESTADO ===== */
.form-group {
    transition: all 0.3s ease;
}

.btn-ubicacion:disabled,
.btn-foto:disabled {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d) !important;
    transform: none !important;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3) !important;
}

/* Header con información de usuario */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
    flex-wrap: wrap;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    color: #2c3e50;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    .header {
        flex-direction: column;
        text-align: center;
    }
}