/* =========================================
   1. VARIABLES Y RESET GENERAL
   ========================================= */
:root {
    --azul-uanl: #004a8f;
    --azul-oscuro: #003366;
    --oro-uanl: #fcb131;
    --blanco: #ffffff;
    --gris-fondo: #f4f7f6; /* Un gris azulado muy suave, más moderno */
    --texto-oscuro: #2c3e50;
    --texto-gris: #6c757d;
    --borde-suave: #e1e4e8;
    --sombra-card: 0 8px 24px rgba(0, 74, 143, 0.08);
    --radio-borde: 12px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--gris-fondo);
    color: var(--texto-oscuro);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; padding: 0; margin: 0; }

/* =========================================
   2. ENCABEZADO (HEADER) PREMIUM
   ========================================= */
header {
    background-color: var(--azul-uanl);
    color: var(--blanco);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--oro-uanl);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.logo span { color: var(--oro-uanl); }

nav ul { display: flex; gap: 25px; }

nav a {
    font-weight: 600;
    opacity: 0.9;
    font-size: 0.95rem;
}
nav a:hover { opacity: 1; color: var(--oro-uanl); }

/* Menú de Usuario */
.user-menu { display: flex; align-items: center; gap: 15px; }
.user-info span { font-weight: 600; font-size: 0.9rem; }
.menu-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    width: 35px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    transition: 0.3s;
}
.menu-btn:hover { background: var(--oro-uanl); color: var(--azul-uanl); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 120%;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-radius: 12px;
    padding: 10px;
    z-index: 1001;
    border: 1px solid rgba(0,0,0,0.05);
    animation: fadeIn 0.2s ease;
}
.dropdown-content.show { display: block; }

.dropdown-content a {
    color: var(--texto-oscuro);
    padding: 10px 15px;
    border-radius: 8px;
    display: block;
    font-size: 0.9rem;
}
.dropdown-content a:hover {
    background-color: #f0f7ff;
    color: var(--azul-uanl);
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   3. FORMULARIOS E INPUTS (MODERNIZADOS)
   ========================================= */
/* Esto arregla lo "feo" y gris de los inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    color: #333;
    background-color: #ffffff;
    border: 2px solid #e1e4e8; /* Borde sutil */
    border-radius: var(--radio-borde);
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    appearance: none; /* Quita estilos nativos feos */
}

input:focus, select:focus, textarea:focus {
    border-color: var(--azul-uanl);
    box-shadow: 0 0 0 4px rgba(0, 74, 143, 0.1); /* Resplandor azul */
}

select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23004a8f%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 12px auto;
    cursor: pointer;
}

select:disabled {
    background-color: #f8f9fa;
    color: #999;
    cursor: not-allowed;
    border-color: #eee;
}

.input-group { margin-bottom: 20px; }
.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--texto-oscuro);
}

/* =========================================
   4. BOTONES (ESTÁNDAR)
   ========================================= */
button, .btn-auth, .btn-publicar, .btn-contact {
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-auth, .btn-publicar {
    background: linear-gradient(135deg, var(--azul-uanl), var(--azul-oscuro));
    color: white;
    padding: 14px;
    border-radius: var(--radio-borde);
    font-weight: bold;
    width: 100%;
    font-size: 1.05rem;
    box-shadow: 0 4px 10px rgba(0, 74, 143, 0.2);
}
.btn-auth:hover, .btn-publicar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 74, 143, 0.3);
}

.btn-cancelar {
    background: #fff;
    border: 2px solid #ff4d4d;
    color: #ff4d4d;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
}
.btn-cancelar:hover { background: #fff5f5; }

/* =========================================
   5. LOGIN Y REGISTRO (CORREGIDO)
   ========================================= */
/* Esto asegura que el header se quede arriba y el formulario en el centro */
body.auth-page {
    display: flex;
    flex-direction: column; /* Elementos uno debajo del otro */
    min-height: 100vh;
}

.auth-container {
    flex-grow: 1; /* Ocupa todo el espacio sobrante */
    display: flex;
    justify-content: center; /* Centrar horizontalmente */
    align-items: center;     /* Centrar verticalmente */
    padding: 20px;
    width: 100%;
}

.auth-card {
    background: white;
    width: 100%;
    max-width: 450px; /* Ancho ideal para el formulario */
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 74, 143, 0.1);
    border-top: 6px solid var(--azul-uanl);
    text-align: left; /* Texto alineado a la izquierda se ve mejor */
}

/* Títulos y textos */
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-header h2 { margin: 0 0 10px; color: var(--azul-uanl); font-size: 1.8rem; }
.auth-header p { margin: 0; color: #666; font-size: 0.95rem; }

/* Links de abajo */
.switch-auth { margin-top: 25px; text-align: center; font-size: 0.9rem; display: block;}
.switch-auth a { color: var(--azul-uanl); font-weight: bold; }

/* =========================================
   6. PAGINA DE INICIO (HOME)
   ========================================= */
.hero {
    background: linear-gradient(135deg, var(--azul-uanl), #002855);
    color: white;
    text-align: center;
    padding: 60px 20px 90px;
    border-radius: 0 0 40px 40px;
    margin-bottom: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.hero h2 { font-size: 2.2rem; margin-bottom: 10px; }
.hero p { opacity: 0.9; font-size: 1.1rem; max-width: 600px; margin: 0 auto 30px; }

.search-container {
    background: white;
    padding: 8px;
    border-radius: 50px;
    display: flex;
    max-width: 650px;
    margin: 0 auto;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    transform: translateY(20px); /* Efecto flotante */
}
.search-container input {
    border: none;
    background: transparent;
    box-shadow: none; /* Quitar sombra del input genérico */
}

/* Categorías */
.categories-wrapper {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 40px 0;
}
.cat-chip {
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--texto-gris);
    border: 1px solid #eee;
    cursor: pointer;
    transition: 0.2s;
}
.cat-chip:hover, .cat-chip.active {
    background: var(--azul-uanl);
    color: white;
    border-color: var(--azul-uanl);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 74, 143, 0.2);
}

/* =========================================
   7. PRODUCTOS Y GRID
   ========================================= */
main { max-width: 1200px; margin: 0 auto; padding: 20px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 30px;
}

.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid rgba(0,0,0,0.02);
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #f0f0f0;
}

.product-info { padding: 15px; }
.product-info h4 { margin: 0 0 5px; font-size: 1.1rem; }
.price { color: var(--azul-uanl); font-size: 1.3rem; font-weight: 800; margin: 5px 0; display: block;}

.btn-contact {
    display: block;
    width: 100%;
    background: #25D366;
    color: white;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 10px;
}

/* =========================================
   8. VENDER Y UPLOAD
   ========================================= */
.vender-container { max-width: 700px; margin: 40px auto; }
.vender-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--sombra-card);
}

.file-upload-wrapper {
    background: #fafafa;
    border: 2px dashed #ccc;
    border-radius: 12px;
    height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
}
.file-upload-wrapper:hover { border-color: var(--azul-uanl); background: #f0f7ff; }
.file-upload-wrapper input {
    position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.preview-image {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover;
    display: none;
}

.fila-responsive { display: flex; gap: 20px; margin-bottom: 20px; }
.fila-responsive > div { flex: 1; }

/* =========================================
   9. ADMIN & MAESTROS (Integrados)
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: white; padding: 25px; border-radius: 16px;
    text-align: center; box-shadow: var(--sombra-card);
    border-bottom: 4px solid var(--oro-uanl);
}
.stat-card p { font-size: 2.5rem; font-weight: bold; color: var(--azul-uanl); margin: 0; }

.user-row, .profe-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.profe-card { flex-direction: column; text-align: center; border-left: 5px solid var(--azul-uanl); }

/* Etiquetas de Admin */
.badge-admin {
    background: var(--oro-uanl); color: black;
    padding: 4px 8px; border-radius: 4px; font-weight: bold; font-size: 0.7rem;
}
.banned { background-color: #ffeaea; border: 1px solid #ff4d4d; }

/* Botones Admin */
.btn-ban { background: #dc3545; color: white; padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; }
.btn-unban { background: #28a745; color: white; padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; }
.btn-verify { background: #1da1f2; color: white; padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; margin-right: 5px; }

/* Navegación de Pestañas Admin */
.admin-tabs { display: flex; gap: 10px; overflow-x: auto; margin-bottom: 20px; padding-bottom: 5px; }
.tab-btn {
    background: white; border: 1px solid #ddd; color: #666;
    padding: 10px 20px; border-radius: 30px; font-weight: 600; white-space: nowrap;
}
.tab-btn.active { background: var(--azul-uanl); color: white; border-color: var(--azul-uanl); }

/* =========================================
   10. MEDIA QUERIES (MÓVIL)
   ========================================= */
@media (max-width: 768px) {
    header { flex-direction: column; gap: 15px; padding: 15px; }
    nav ul { gap: 15px; font-size: 0.9rem; }
    
    .hero { border-radius: 0 0 30px 30px; padding-bottom: 60px; }
    .hero h2 { font-size: 1.8rem; }
    
    .search-container { width: 90%; }
    .categories-wrapper { justify-content: flex-start; overflow-x: auto; padding-bottom: 10px; flex-wrap: nowrap; }
    
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .product-card img { height: 140px; }
    .product-info h4 { font-size: 0.95rem; }
    
    /* Formularios en móvil */
    .fila-responsive, .user-row { flex-direction: column; gap: 10px; align-items: stretch; }
    .vender-card, .auth-card { padding: 20px; }
}

@media (max-width: 400px) {
    .product-grid { grid-template-columns: 1fr; }
}
/* --- ARREGLO VISUAL: TARJETAS DE MAESTROS --- */
.profe-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 6px solid var(--azul-uanl); /* Borde azul a la izquierda */
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.profe-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

/* Parte superior: Nombre a la izq, Botón a la der */
.profe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Alineados arriba */
    margin-bottom: 20px;
    gap: 15px;
}

.profe-info h3 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1.1rem;
    line-height: 1.3;
}

.badge-facultad {
    display: inline-block;
    background-color: #f0f2f5;
    color: #666;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Botón de calificar más bonito */
.btn-calificar {
    background-color: var(--oro-uanl);
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap; /* Que no se rompa el texto */
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.btn-calificar:hover {
    background-color: #eec151;
    transform: scale(1.05);
}

/* Rejilla de estadísticas (Popo/Barco/Votos) */
.rating-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr; /* 3 columnas iguales */
    gap: 10px;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-item .icon { font-size: 1.4rem; margin-bottom: 2px; }
.stat-item .value { font-weight: 800; font-size: 1.1rem; color: var(--azul-uanl); }
.stat-item .label { font-size: 0.7rem; color: #888; text-transform: uppercase; letter-spacing: 1px; }


/* --- ARREGLO VISUAL: FOOTER (PIE DE PÁGINA) --- */
footer {
    text-align: center; /* Centrar todo el texto */
    padding: 40px 20px;
    background-color: white; /* Fondo blanco para separar */
    margin-top: 60px; /* Separar del contenido de arriba */
    border-top: 1px solid #eee;
    color: #666;
}

footer p {
    margin: 5px 0;
}
/* --- CORRECCIÓN FINAL: TARJETAS DE MAESTROS --- */

/* 1. Contenedor de la tarjeta */
.profe-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 6px solid var(--azul-uanl);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    display: block; /* Aseguramos que sea bloque */
    width: 100%;
}

/* 2. Cabecera (Nombre + Botón) */
.profe-header {
    display: flex;
    justify-content: space-between; /* Uno a cada extremo */
    align-items: center; /* Centrados verticalmente */
    width: 100%;
    margin-bottom: 20px;
}

/* 3. Información del Profe (Nombre) */
.profe-info {
    text-align: left; /* Forzar alineación izquierda */
    flex: 1; /* Que ocupe todo el espacio disponible */
}

.profe-info h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
    white-space: nowrap; /* EVITA QUE EL NOMBRE SE ROMPA EN LÍNEAS */
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-facultad {
    display: inline-block;
    background-color: #eee;
    color: #555;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* 4. Botón Calificar (Arreglado para que no sea gigante) */
.btn-calificar {
    background-color: var(--oro-uanl);
    color: black;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    width: auto !important; /* IMPORTANTE: No ocupar 100% */
    min-width: 100px;
    flex-shrink: 0; /* Evita que se aplaste */
}
.btn-calificar:hover { background-color: #eec151; }

/* 5. Estadísticas (Cajita gris abajo) */
.rating-grid {
    display: flex;
    justify-content: space-around; /* Distribución equitativa */
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

/* --- CORRECCIÓN FINAL: FOOTER --- */
/* Esto empuja el footer al fondo y centra el contenido */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1; /* Esto hace que el contenido empuje al footer hacia abajo */
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

footer {
    width: 100%;
    background: white;
    text-align: center;
    padding: 30px;
    margin-top: auto; /* Truco para pegarlo al fondo */
    border-top: 1px solid #ddd;
}