@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap");

/* RESET GLOBAL */
* { box-sizing: border-box; }

body {
  font-family: "Poppins", sans-serif !important;
  background: #f4f4f5;
  margin: 0;
  padding: 20px;
  color: #333;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

/* HEADER */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-bottom: 2px solid #eee;
  padding-bottom: 20px;
}
h2 { color: #e3000f; margin: 0; font-weight: 700; }

/* BOTONES - ENCUADRE PERFECTO */
.btn { 
    padding: 12px 24px; 
    border-radius: 6px; 
    font-weight: 600; 
    cursor: pointer; 
    border: none; 
    text-decoration: none; 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem; 
    transition: 0.2s;
    font-family: "Poppins", sans-serif !important;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Espaciado solo entre botones de cabecera */
.header .btn { margin-left: 10px; }

.btn-primary { background: #E3000F; color: #fff; }
.btn-success { background: #14832e; color: #fff; }
.btn-secondary { background: #3d3838; color: #fff; }
.btn-usuarios { background: #204daf; color: #fff; }
.btn-logout { background: #312f2f; color: #fff; }

.btn-container { text-align: center; margin-top: 30px; width: 100%; display: block; }
.btn-lg { padding: 18px 60px; font-size: 1.1rem; border-radius: 8px; width: 100% !important; }

/* FORMULARIOS - CORRECCIÓN DE TIPOGRAFÍA Y ANCHOS */
.form-group { 
    margin-bottom: 14px; /* aire vertical */
    width: 100%; 
}
label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.85rem; color: #666; text-transform: uppercase; }
input, select, textarea {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    font-family: "Poppins", sans-serif !important; /* FUENTE FORZADA */
    background: #fff;
    color: #1e293b;
    display: block;
    box-sizing: border-box; /* Asegura que el padding no desplace el ancho */
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #e3000f;
    box-shadow: 0 0 0 3px rgba(227, 0, 15, 0.1);
}
.row { 
    display: flex; 
    gap: 25px; /* Aumentamos la separación horizontal entre columnas */
    width: 100%; 
    margin-bottom: 8px; /* Separa una fila de la siguiente fila */
}
.col { flex: 1; }
form { display: flex; flex-direction: column; width: 100%; }

.form-inline-grid {
    display: grid;
    /* Creamos 4 columnas: Usuario, Pass, Rol y Botón */
    grid-template-columns: 1.2fr 1fr 1fr 180px; 
    gap: 15px;
    align-items: flex-end; /* Alinea el botón con la base de los inputs */
    background: #fff;
    padding: 0;
    margin-bottom: 10px;
}

/* Forzamos que en esta barra todos tengan el mismo alto */
.form-inline-grid input, 
.form-inline-grid select, 
.form-inline-grid button {
    height: 48px !important;
    margin: 0 !important; /* Quita márgenes que desalinean */
}

/* Ajuste para móviles: que pase a ser una sola columna */
@media (max-width: 768px) {
    .form-inline-grid {
        grid-template-columns: 1fr;
    }
}

/* TABLAS LIMPIAS */
table {
    width: 100%;
    background: #fff;
    border-collapse: separate; /* Permite bordes redondeados en la tabla */
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0; /* Marco sutil */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    margin-top: 10px;
}
th {
    background: #eceef0;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 18px 20px;
    border-bottom: 2px solid #f1f5f9;
    text-align: left;
}
td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.95rem;
}
/* Efecto Cebra Sutil */
tbody tr:nth-child(even) {
    background-color: #fcfcfd;
}
tbody tr:hover {
    background-color: #f1f5f9; /* Efecto hover en fila */
}

/* --- BADGES (ROLES) --- */
.badge-rol {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-admin { 
    background: #1a1a1a; 
    color: #ffffff !important; /* CORRECCIÓN: Letras blancas en fondo negro */
}
.badge-editor { 
    background: #e2e8f0; 
    color: #475569; 
}

.action-links a { margin-right: 15px; font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.action-links a.delete { color: #e3000f; }

/* SWEET ALERT 2 - TODAS LAS LÍNEAS RESTAURADAS PARA POPPINS */
.swal2-container, 
.swal2-popup, 
.swal2-title, 
.swal2-html-container, 
.swal2-content,
.swal2-confirm,
.swal2-cancel { 
    font-family: 'Poppins', sans-serif !important; 
}
.swal2-title { font-weight: 700 !important; }
.swal2-popup { border-radius: 15px !important; }
.swal2-confirm { border-radius: 8px !important; text-transform: uppercase !important; }

/* ALERTAS PHP */
.success { color: #155724; background-color: #d4edda; padding: 15px; border-radius: 6px; margin-bottom: 20px; border: 1px solid #c3e6cb; }
.error { color: #721c24; background-color: #f8d7da; padding: 15px; border-radius: 6px; margin-bottom: 20px; border: 1px solid #f5c6cb; }

/* --- UI DE PREVISUALIZACIÓN DE IMAGEN --- */
.image-meta-box {
    display: flex; gap: 20px; background: #f8fafc; padding: 15px;
    border: 1px solid #e2e8f0; border-radius: 8px; align-items: center;
}
.img-preview-container {
    flex: 0 0 250px; /* Ancho fijo para no romper la pantalla */
    height: 140px;   /* Alto fijo */
    border-radius: 6px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: #000;
}
.preview-img-bounded {
    width: 100%; height: 100%; 
    object-fit: cover; /* Encaja la imagen sin deformarla */
    object-position: top; /* Muestra siempre la parte superior */
}
.img-details { flex: 1; }
.img-details p { margin: 0 0 5px 0; font-size: 0.85rem; color: #475569; }
.img-details strong { color: #1e293b; }