/* =============================================
   FARMACIA - CSS básico (mala calidad intencional)
   PROBLEMAS:
   - Sin variables CSS
   - Sin media queries (no responsive)
   - Estilos repetidos en varios lugares
   - Sin metodología (no BEM, no OOCSS)
   - Colores hardcodeados en múltiples lugares
   ============================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: Arial, sans-serif;
    background: #f0f0f0;
    color: #333;
}

/* NAVBAR */
.navbar {
    background: #2d6a4f;
    color: white;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: bold; }
.logo-icon { font-size: 24px; }
.navbar-links { display: flex; gap: 20px; }
.navbar-links a { color: white; text-decoration: none; padding: 8px 12px; border-radius: 4px; }
.navbar-links a:hover, .navbar-links a.activo { background: rgba(255,255,255,0.2); }
.navbar-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }

/* CONTAINER */
.container { max-width: 1200px; margin: 0 auto; padding: 30px 20px; }

/* PAGE HEADER */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 26px; color: #2d6a4f; margin-bottom: 4px; }
.page-header p { color: #666; }

/* ALERTAS */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* BOTONES */
.btn {
    display: inline-block; padding: 8px 16px; border-radius: 6px;
    border: none; cursor: pointer; font-size: 14px; text-decoration: none;
    font-family: Arial, sans-serif; transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary  { background: #2d6a4f; color: white; }
.btn-secondary{ background: #6b7280; color: white; }
.btn-success  { background: #059669; color: white; }
.btn-danger   { background: #dc2626; color: white; }
.btn-outline  { background: transparent; color: white; border: 1px solid white; }
.btn-sm       { padding: 4px 10px; font-size: 13px; }
.btn-block    { display: block; width: 100%; text-align: center; padding: 12px; }

/* FILTROS CATEGORÍA */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.btn-filtro {
    padding: 6px 14px; border-radius: 20px; border: 1px solid #2d6a4f;
    color: #2d6a4f; text-decoration: none; font-size: 13px;
}
.btn-filtro:hover, .btn-filtro.activo { background: #2d6a4f; color: white; }

/* GRILLA DE PRODUCTOS */
.productos-grid {
    display: grid;
    /* PROBLEMA: grid fijo sin media queries, en pantalla chica queda mal */
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.producto-card {
    background: white; border-radius: 8px; border: 1px solid #e5e7eb;
    padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.producto-badge { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
    font-size: 11px; padding: 3px 8px; border-radius: 12px; font-weight: bold;
}
.badge-receta { background: #fef3c7; color: #92400e; }
.badge-cat    { background: #d1fae5; color: #065f46; }
.producto-info { flex: 1; }
.producto-info h3 { font-size: 15px; color: #111; margin-bottom: 6px; }
.producto-desc { font-size: 13px; color: #555; margin-bottom: 4px; line-height: 1.4; }
.producto-lab  { font-size: 12px; color: #888; }
.producto-stock{ font-size: 12px; color: #2d6a4f; font-weight: bold; margin-top: 4px; }
.producto-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.producto-precio { font-size: 20px; font-weight: bold; color: #2d6a4f; }
.cantidad-control { display: flex; gap: 6px; align-items: center; }
.input-cantidad {
    width: 55px; padding: 6px; border: 1px solid #d1d5db;
    border-radius: 4px; text-align: center; font-size: 14px;
}
.form-agregar { margin: 0; }
.sin-resultados { color: #666; padding: 20px; }

/* TABLA */
.tabla-wrap { overflow-x: auto; }
.carrito-tabla-wrap { overflow-x: auto; margin-bottom: 20px; }
.tabla { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; }
.tabla th { background: #2d6a4f; color: white; padding: 12px 16px; text-align: left; font-size: 14px; }
.tabla td { padding: 12px 16px; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.tabla tbody tr:hover { background: #f9fafb; }
.tabla tfoot td { border-top: 2px solid #e5e7eb; font-size: 16px; }

/* CARRITO */
.carrito-vacio { text-align: center; padding: 60px; color: #666; }
.carrito-vacio p { font-size: 18px; margin-bottom: 16px; }
.carrito-acciones { display: flex; gap: 12px; justify-content: flex-end; margin-top: 16px; }

/* HISTORIAL */
.sin-compras { text-align: center; padding: 60px; color: #666; }
.sin-compras p { font-size: 18px; margin-bottom: 16px; }

/* LOGIN */
.page-login {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: #f0fdf4;
}
.login-box {
    background: white; border-radius: 12px; border: 1px solid #e5e7eb;
    padding: 32px; width: 100%; max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .logo-icon { font-size: 48px; display: block; }
.login-logo h1 { font-size: 22px; color: #2d6a4f; margin: 8px 0 4px; }
.login-logo p  { color: #666; font-size: 14px; }
.form-login { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 13px; font-weight: bold; color: #374151; }
.form-group input {
    padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 14px; font-family: Arial, sans-serif;
}
.form-group input:focus { outline: none; border-color: #2d6a4f; box-shadow: 0 0 0 2px rgba(45,106,79,0.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.login-footer { text-align: center; margin-top: 20px; font-size: 13px; color: #666; }
.login-footer a { color: #2d6a4f; }
.badge-carrito {
    background: #dc2626; color: white; border-radius: 50%;
    width: 18px; height: 18px; display: inline-flex;
    align-items: center; justify-content: center; font-size: 11px;
    margin-left: 4px;
}
