/* Theme Name: Mascotas en Red Modern UI (Final Fix) */

/* =========================================
1. VARIABLES Y GENERALES
========================================= */
:root {
--primary-blue: #3498db;
--dark-blue: #2c3e50;
--accent-blue: #0ea7d9;
--light-bg: #f8fbfe;
--input-bg: #f0f4f8;
--border-radius-card: 16px;
--border-radius-input: 8px;
--shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.08);
--font-stack: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
background-color: var(--light-bg);
font-family: var(--font-stack);
color: #555;
}

hr {
margin: 30px 0;
border: 0;
border-top: 1px solid #eee;
}

/* =========================================
2. CONTENEDOR PRINCIPAL
========================================= */
.mer-form-container {
max-width: 1280px; /* Un poco más ancho para que quepa la tabla */
width: 100%;
margin: 3rem auto;
padding: 2.5rem;
background-color: #ffffff;
border-radius: var(--border-radius-card);
box-shadow: var(--shadow-soft);
border: 1px solid rgba(255,255,255,0.8);
}

.mer-form-container h1 {
text-align: center;
margin-bottom: 2rem;
color: var(--dark-blue);
}

.mer-section {
background: #fff;
padding: 1rem 0;
margin-bottom: 2rem;
border-bottom: 1px dashed #eee;
}

.mer-section h2 {
font-size: 1.4rem;
margin-bottom: 1.2rem;
color: var(--primary-blue);
}

/* =========================================
3. BARRA DE PROGRESO (CORREGIDA)
========================================= */
.mer-progress-bar {
display: flex !important; /* Forzar horizontalidad */
flex-direction: row;
justify-content: space-between;
list-style: none;
padding: 0;
margin: 0 0 3rem 0;
position: relative;
width: 100%;
}

.mer-progress-bar li {
flex: 1;
text-align: center;
color: #bdc3c7;
font-weight: 600;
font-size: 0.9rem;
position: relative;
z-index: 1;
}

/* Línea conectora */
.mer-progress-bar li:not(:last-child)::after {
content: '';
position: absolute;
width: 100%;
height: 3px;
background-color: #ecf0f1;
top: 15px; /* Ajustado al centro del círculo */
left: 50%;
z-index: -1;
}

/* Círculo */
.mer-progress-bar li::before {
content: '';
display: block;
width: 30px;
height: 30px;
background-color: #fff;
border: 3px solid #ecf0f1;
border-radius: 50%;
margin: 0 auto 10px auto;
transition: all 0.3s ease;
}

/* Activo y Completado */
.mer-progress-bar li.active { color: var(--primary-blue); }
.mer-progress-bar li.active::before {
border-color: var(--primary-blue);
transform: scale(1.1);
}
.mer-progress-bar li.completed { color: var(--primary-blue); }
.mer-progress-bar li.completed::before {
background-color: var(--primary-blue);
border-color: var(--primary-blue);
}
.mer-progress-bar li.completed::after { background-color: var(--primary-blue); }


/* =========================================
4. INPUTS Y FORMULARIOS
========================================= */
.mer-registration-form label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: var(--dark-blue);
}

.mer-registration-form input[type="text"],
.mer-registration-form input[type="email"],
.mer-registration-form input[type="password"],
.mer-registration-form input[type="date"],
.mer-registration-form input[type="url"],
.mer-registration-form select,
.mer-registration-form textarea {
width: 100%;
padding: 12px;
margin-bottom: 20px;
background-color: var(--input-bg);
border: 1px solid #e0e6ed;
border-radius: var(--border-radius-input);
font-size: 1rem;
color: var(--dark-blue);
box-sizing: border-box;
}

.mer-registration-form input:focus,
.mer-registration-form select:focus,
.mer-registration-form textarea:focus {
background-color: #fff;
border-color: var(--primary-blue);
outline: none;
}

/* Select de Banderas */
select[name="mer_user_indicativo"] {
font-size: 1.1rem;
}

/* =========================================
5. BOTÓN DE FOTO (EL TRUCO RESTAURADO)
========================================= */
.mer-file-upload-wrapper {
margin-bottom: 20px;
text-align: left;
}

/* ¡AQUÍ ESTÁ EL TRUCO! Ocultamos el input original a la fuerza */
.mer-file-upload-wrapper input[type="file"] {
display: none !important;
opacity: 0;
width: 0.1px;
height: 0.1px;
position: absolute;
}

/* Estilo del Label que actúa como botón */
.mer-custom-file-upload {
display: inline-block;
background: linear-gradient(135deg, var(--primary-blue), #2980b9);
color: white;
padding: 12px 25px;
border-radius: 50px;
cursor: pointer;
font-weight: 700;
text-transform: uppercase;
font-size: 0.9rem;
box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
transition: all 0.3s ease;
}
label.button.mer-custom-file-upload {
    color: #fff !important;
}
.mer-custom-file-upload:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.mer-custom-file-upload i {
margin-right: 8px;
}

/* Nombre del archivo seleccionado (si usas el JS para mostrarlo) */
#mer-file-name-display {
margin-left: 15px;
font-style: italic;
color: #7f8c8d;
}


/* =========================================
6. TABLAS Y REPETIDORES (SOLUCIÓN DESKTOP)
========================================= */
.mer-repeater-container {
background: #fff;
border: 1px solid #eee;
border-radius: var(--border-radius-card);
padding: 15px;
margin-bottom: 20px;
/* Esto habilita el scroll horizontal si la tabla es muy ancha en pantallas medianas */
overflow-x: auto; 
}

.mer-vacunas-table {
width: 100%;
min-width: 700px; /* Forzamos un ancho mínimo para que no se apachurre en desktop */
border-collapse: collapse; 
border-spacing: 0;
}

.mer-vacunas-table th {
text-align: left;
color: #7f8c8d;
font-size: 0.85rem;
text-transform: uppercase;
padding: 10px;
border-bottom: 2px solid #eee;
white-space: nowrap; /* Evita que los títulos se rompan en dos líneas */
}

.mer-vacunas-table td {
padding: 10px;
vertical-align: middle;
}

/* Ajuste de inputs dentro de la tabla */
.mer-vacunas-table input, .mer-vacunas-table select {
margin-bottom: 0; 
padding: 8px;
font-size: 0.9rem;
min-width: 100px; /* Asegura que los inputs no sean microscópicos */
}

/* Botones de acción (Agregar/Eliminar) */
#mer_add_vacuna, #mer_add_red_social {
background: transparent;
color: var(--primary-blue);
border: 2px solid var(--primary-blue);
border-radius: var(--border-radius-input);
padding: 8px 15px;
font-weight: 600;
cursor: pointer;
margin-top: 10px;
}

#mer_add_vacuna:hover, #mer_add_red_social:hover {
background: var(--primary-blue);
color: #fff;
}

.remove-repeater-row, .mer-remove-item {
background-color: #ffecec;
color: #e74c3c;
border: 1px solid #ffdbdb;
border-radius: 6px;
padding: 6px 12px;
cursor: pointer;
white-space: nowrap;
}

.remove-repeater-row:hover {
background-color: #e74c3c;
color: #fff;
}

/* =========================================
7. BOTONES GENERALES
========================================= */
.mer-form-nav {
display: flex;
justify-content: space-between;
margin-top: 3rem;
padding-top: 1rem;
border-top: 1px dashed #eee;
}

.mer-registration-form input[type="submit"],
.button.mer-cta-button {
background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
color: #fff;
border: none;
padding: 12px 30px;
border-radius: 50px;
font-size: 1rem;
font-weight: 700;
cursor: pointer;
text-transform: uppercase;
transition: all 0.3s;
}

.mer-registration-form input[type="submit"]:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.mer-form-nav .prev-btn {
background: #ecf0f1;
color: #7f8c8d;
padding: 10px 25px;
border-radius: 50px;
border: none;
font-weight: 600;
cursor: pointer;
}

/* =========================================
8. ESTILOS SINGLE MASCOTA (FICHA)
========================================= */
.mer-id-card-wrapper {
    width: 100%;
    max-width: 1280px;
    margin: 3rem auto;
    font-family: var(--font-stack);
}

.mer-id-card {
background: #fff;
border-radius: var(--border-radius-card);
box-shadow: var(--shadow-soft);
overflow: hidden;
}

.mer-card-header {
background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
padding: 2rem;
display: flex;
align-items: center;
color: #fff;
}

.mascota-foto img {
width: 150px;
height: 150px;
border-radius: 50%;
object-fit: cover;
border: 5px solid #fff;
margin-right: 2rem;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.mer-mascota-titulo h1 {
color: #fff;
margin: 0;
font-size: 2rem;
}

.mer-card-body { padding: 2rem; }

.mer-card-section h2 {
border-bottom: 2px solid #f0f4f8;
padding-bottom: 10px;
margin-bottom: 20px;
color: var(--primary-blue);
}

.mer-datos-lista li {
    padding: 10px 0;
    border-bottom: 1px solid #f9f9f9;
    display: flex;
    justify-content: left;
    gap: 30px !important;
}
.mer-location-notifier {
    text-align: center;
}
.mer-datos-lista p {
background: var(--input-bg);
padding: 5px 15px;
border-radius: 20px;
font-weight: 600;
color: var(--dark-blue);
margin: 0;
}

/* Redes Sociales en Ficha */
.mer-social-buttons li a {
background: #25D366; /* WhatsApp default */
color: white;
padding: 8px 20px;
border-radius: 50px;
text-decoration: none;
font-weight: 600;
display: flex;
align-items: center;
gap: 8px;
}
a[href*="facebook"] { background: #1877F2 !important; }
a[href*="instagram"] { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) !important; }

/* =========================================
   10. ALERTAS Y NOTIFICACIONES
   ========================================= */
.mer-alert {
    padding: 15px 20px;
    margin: 0 auto 20px auto; /* Centrado y separado */
    border-radius: var(--border-radius-input);
    font-weight: 600;
    text-align: center;
    max-width: 900px; /* Mismo ancho que el formulario */
    width: 95%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    animation: slideDown 0.4s ease;
}

/* Error (Rojo suave) */
.mer-alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.mer-alert-error::before {
    content: '⚠️'; /* Icono simple */
    font-size: 1.2rem;
}

/* Éxito (Verde suave) */
.mer-alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.mer-alert-success::before {
    content: '✅';
    font-size: 1.2rem;
}

/* Información (Azul suave) */
.mer-alert-info {
    background-color: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
}
.mer-alert-info::before {
    content: 'ℹ️';
}

/* Animación de entrada */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   10. RESPONSIVE (MÓVIL - MODO TARJETAS)
   ========================================= */
@media (max-width: 768px) {
    /* Ajustes generales del contenedor en móvil */
    .mer-form-container {
        padding: 1.5rem;
        margin: 1rem auto;
        width: 100% !important;
    }

    /* --- TRANSFORMACIÓN MÁGICA DE TABLA A TARJETAS --- */
    
    /* 1. Desactivamos el comportamiento de tabla */
    .mer-repeater-table, 
    .mer-repeater-table tbody, 
    .mer-repeater-table tr, 
    .mer-repeater-table td {
        display: block;
        width: 100%;
        min-width: 0; /* Anulamos el ancho mínimo de escritorio */
    }
    
    /* 2. Ocultamos los encabezados de la tabla (no sirven en vertical) */
    .mer-repeater-table thead { 
        display: none; 
    }

    /* 3. Convertimos cada FILA (tr) en una TARJETA */
    .mer-repeater-table tr {
        background: #fff;
        border: 1px solid #e0e6ed;
        border-radius: 12px; /* Bordes redondeados */
        margin-bottom: 20px; /* Separación entre vacunas */
        padding: 20px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.03); /* Sombra suave */
        position: relative;
    }

    /* 4. Estilo de cada celda (td) */
    .mer-repeater-table td {
        padding: 0 0 15px 0;
        border: none;
        text-align: left;
    }

    /* 5. Agregamos ETIQUETAS visuales antes de cada input 
       (Ya que ocultamos el thead, necesitamos decir qué es qué) */
    .mer-repeater-table td:nth-of-type(1)::before { content: "Nombre Vacuna:"; }
    .mer-repeater-table td:nth-of-type(2)::before { content: "Laboratorio:"; }
    .mer-repeater-table td:nth-of-type(3)::before { content: "Lote:"; }
    .mer-repeater-table td:nth-of-type(4)::before { content: "Fecha Aplicación:"; }
    .mer-repeater-table td:nth-of-type(5)::before { content: "Próxima Aplicación:"; }

    /* Estilo para estas etiquetas generadas */
    .mer-repeater-table td::before {
        display: block;
        font-weight: 700;
        color: var(--primary-blue);
        margin-bottom: 5px;
        font-size: 0.9rem;
        text-transform: uppercase;
    }

    /* 6. Hacemos que los inputs ocupen todo el ancho disponible */
    .mer-repeater-table input, 
    .mer-repeater-table select {
        width: 100% !important; /* Forzar ancho completo */
        min-width: 100%;
        margin-bottom: 0;
        background-color: var(--input-bg);
        border: 1px solid #dcdcdc;
    }

    /* 7. Botón de Eliminar Fila */
    .remove-repeater-row {
        width: 100%;
        padding: 12px;
        margin-top: 5px;
        text-align: center;
        background-color: #ffecec;
        color: #e74c3c;
        border: 1px solid #ffdbdb;
    }

    /* Ajustes visuales extra para la ficha de mascota */
    .mer-card-header {
        flex-direction: column;
        text-align: center;
    }
    .mascota-foto img { margin-right: 0; margin-bottom: 1rem; }
    
    .mer-datos-lista li {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    /* Botón flotante de WhatsApp que no tape contenido importante */
    .mer-whatsapp-float {
        bottom: 80px; /* Subirlo un poco */
    }
    
    .mer-form-nav {
        flex-direction: column;
        gap: 20px;
    }
}