/* ==========================================================
   CALI TECH - PANEL DE ADMINISTRACION DE PRODUCTOS
   ========================================================== */
:root{
    --azul: #146b9e;
    --cian: #47fdee;
    --tinta: #0a1424;
    --verde: #1e9e5a;
    --rojo: #c1121f;
}

body.admin{
    margin: 0;
    min-height: 100vh;
    background: #eef2f7;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--tinta);
}

/* ---------- ENCABEZADO ---------- */
.admin .encabezado{
    background: linear-gradient(120deg, #050b16 0%, #0a1a33 55%, #0d2b4d 100%);
    border-bottom: 3px solid var(--cian);
    padding: 14px 0;
}
.admin .barra{
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 4%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.admin .marca{
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #ffffff;
}
.admin .marca img{
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 12px;
    background: #ffffff;
    padding: 4px;
}
.admin .marca span{
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 24px;
}
.admin .marca b{ color: var(--cian); }
.admin .rol{
    display: inline-block;
    margin-left: 10px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #04121f;
    background: var(--cian);
}
.admin .barra nav a{
    display: inline-block;
    margin-left: 6px;
    padding: 9px 15px;
    border-radius: 10px;
    font-size: 14px;
    color: #cfe0f0;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.admin .barra nav a:hover{
    background: rgba(71, 253, 238, 0.15);
    color: #ffffff;
}

/* ---------- CONTENEDOR ---------- */
.admin .contenido{
    max-width: 1200px;
    margin: 34px auto 70px;
    padding: 0 4%;
}
.admin h1{
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 32px;
    color: var(--azul);
    margin: 0 0 6px;
}
.admin .intro{
    color: #5a6b82;
    margin: 0 0 26px;
    font-size: 16px;
}

/* Aviso de base de datos sin migrar */
.aviso-migracion{
    display: none;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 22px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid #f0c14b;
    background: #fff8e2;
    color: #6b4e00;
    font-size: 14.5px;
    line-height: 1.5;
}
.aviso-migracion.visible{ display: flex; }
.aviso-migracion code{
    background: #f4e3b0;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 13px;
}

/* ---------- TARJETA DEL FORMULARIO ---------- */
.tarjeta{
    background: #ffffff;
    border: 1px solid #e6ecf3;
    border-radius: 18px;
    padding: 24px 26px;
    margin-bottom: 30px;
    box-shadow: 0 20px 40px -30px rgba(10, 20, 36, 0.5);
}
.tarjeta > h2{
    margin: 0 0 4px;
    font-size: 21px;
    color: var(--tinta);
}
.tarjeta > p.sub{
    margin: 0 0 20px;
    color: #5a6b82;
    font-size: 14.5px;
}

.campo{
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}
.campo label{
    font-size: 13.5px;
    font-weight: 700;
    color: #33465e;
}
.campo input,
.campo select,
.campo textarea{
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #d5e0ec;
    border-radius: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    color: var(--tinta);
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.campo textarea{
    resize: vertical;
    min-height: 70px;
}
.campo input:focus,
.campo select:focus,
.campo textarea:focus{
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(20, 107, 158, 0.15);
}
.campo .ayuda{
    font-size: 12.5px;
    color: #8494a8;
}
.campo.error input,
.campo.error select,
.campo.error textarea{
    border-color: var(--rojo);
    box-shadow: 0 0 0 3px rgba(193, 18, 31, 0.12);
}
.campo input[readonly]{
    background: #f4f7fb;
    color: #5a6b80;
    cursor: default;
}
.campo .ayuda code{
    background: #eef3f9;
    padding: 1px 5px;
    border-radius: 5px;
    font-size: 11.5px;
}
.campo .ayuda.limite{
    color: #b3370f;
    font-weight: 700;
}

/* ---------- Zona de subida de imagen ---------- */
/* Estas clases usan display:flex, que tiene mas peso que la regla del
   navegador para [hidden], asi que se fuerza el ocultado. */
.zona-subida [hidden]{
    display: none !important;
}

.zona-subida{
    position: relative;
    border: 2px dashed #b9cbe0;
    border-radius: 14px;
    background: #fbfdff;
    padding: 22px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.zona-subida:hover{
    border-color: var(--azul);
    background: #f4faff;
}
.zona-subida.arrastrando{
    border-color: var(--azul);
    background: #e6f2ff;
    transform: scale(1.01);
}
.zona-subida.subiendo{
    cursor: progress;
    opacity: 0.85;
}

.zona-vacia{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
    color: #5f7590;
}
.zona-vacia svg{
    width: 40px;
    height: 40px;
    color: var(--azul);
    margin-bottom: 3px;
}
.zona-vacia strong{
    font-size: 15.5px;
    color: var(--tinta);
}
.zona-vacia span{
    font-size: 13.5px;
}
.zona-vacia small{
    margin-top: 4px;
    font-size: 12px;
    color: #93a5ba;
}

.zona-previa{
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.zona-previa img{
    width: 92px;
    height: 92px;
    object-fit: contain;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #d5e0ec;
    padding: 6px;
    flex-shrink: 0;
}
.previa-datos{
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1 1 150px;
}
.previa-datos strong{
    font-size: 14.5px;
    color: var(--tinta);
    word-break: break-all;
}
.previa-datos span{
    font-size: 12.5px;
    color: #7d8fa5;
}
.previa-acciones{
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.barra-subida{
    height: 8px;
    border-radius: 99px;
    background: #e4edf7;
    overflow: hidden;
    margin-top: 4px;
}
.barra-relleno{
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--azul), #38b6ff);
    transition: width 0.2s ease;
}

.rejilla{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0 18px;
}
.campo-ancho{ grid-column: 1 / -1; }

.casilla{
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 14.5px;
    color: #33465e;
    font-weight: 600;
}
.casilla input{
    width: 18px;
    height: 18px;
    accent-color: var(--azul);
}

/* ---------- BOTONES ---------- */
.btn-admin{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 26px;
    border: none;
    border-radius: 12px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    color: #04121f;
    background: linear-gradient(135deg, var(--cian), var(--azul));
    box-shadow: 0 12px 24px -14px rgba(20, 107, 158, 0.9);
    transition: transform 0.15s, filter 0.2s, background 0.2s;
}
.btn-admin:hover{
    transform: translateY(-2px);
    filter: brightness(1.06);
}
.btn-admin:active{ transform: scale(0.98); }
.btn-admin.plano{
    color: var(--azul);
    background: #eef6fc;
    border: 1px solid rgba(20, 107, 158, 0.3);
    box-shadow: none;
}
.btn-admin.peligro{
    color: #ffffff;
    background: linear-gradient(135deg, #e05353, var(--rojo));
    box-shadow: 0 12px 24px -14px rgba(193, 18, 31, 0.9);
}
.btn-admin.chico{
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 9px;
}
.acciones-form{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 6px;
}

/* ---------- BUSCADOR Y FILTROS ---------- */
.herramientas{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}
.herramientas input[type="search"],
.herramientas select{
    padding: 10px 14px;
    border: 1px solid #d5e0ec;
    border-radius: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14.5px;
    color: var(--tinta);
    outline: none;
    background: #ffffff;
}
.herramientas input[type="search"]{ flex: 1 1 240px; }
.herramientas input[type="search"]:focus,
.herramientas select:focus{
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(20, 107, 158, 0.15);
}
.contador{
    font-size: 14px;
    color: #5a6b82;
    margin-left: auto;
}

/* ---------- TABLA ---------- */
.tabla-envoltura{
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid #e6ecf3;
    background: #ffffff;
}
table.productos{
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    min-width: 780px;
}
table.productos thead th{
    background: #f4f8fc;
    color: #33465e;
    text-align: left;
    padding: 13px 14px;
    font-size: 12.5px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    border-bottom: 2px solid #e0e8f1;
    white-space: nowrap;
}
table.productos tbody td{
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}
table.productos tbody tr:last-child td{ border-bottom: none; }
table.productos tbody tr:hover{ background: #fafcfe; }
table.productos tbody tr.inactivo{ opacity: 0.55; }

.cell-articulo{
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 230px;
}
.cell-articulo img{
    width: 52px;
    height: 52px;
    flex: none;
    object-fit: contain;
    border-radius: 10px;
    background: radial-gradient(circle at 50% 32%, #f8fcff 0%, #e6eff9 100%);
    padding: 4px;
}
.cell-articulo .sin-imagen{
    display: grid;
    place-items: center;
    color: #8fa6bd;
    font-size: 11px;
    font-weight: 700;
}
.cell-articulo strong{
    display: block;
    font-size: 15px;
    color: var(--tinta);
    line-height: 1.25;
}
.cell-articulo small{
    display: block;
    font-size: 12px;
    color: #8fa6bd;
    margin-top: 2px;
    word-break: break-all;
}
.precio-cell{
    font-weight: 800;
    color: var(--azul);
    font-size: 16px;
    white-space: nowrap;
}
.etiqueta-cat{
    display: inline-block;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: #eef6fc;
    color: var(--azul);
    text-transform: capitalize;
}
.etiqueta-cat.accesorio{
    background: #fdf0e6;
    color: #a5541b;
}

.estado{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.estado::before{
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #c0ccd8;
}
.estado.si{ color: var(--verde); }
.estado.si::before{ background: var(--verde); }
.estado.no{ color: var(--rojo); }
.estado.no::before{ background: var(--rojo); }

.acciones-fila{
    display: flex;
    gap: 7px;
    justify-content: flex-end;
    white-space: nowrap;
}

.vacio{
    padding: 44px 20px;
    text-align: center;
    color: #8fa6bd;
    font-size: 15px;
}
.vacio strong{
    display: block;
    font-size: 18px;
    color: #33465e;
    margin-bottom: 6px;
}

/* ---------- MENSAJES ---------- */
.mensaje{
    display: none;
    margin-bottom: 18px;
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 600;
}
.mensaje.visible{ display: block; }
.mensaje.bien{
    background: #e7f8ee;
    border: 1px solid #9ad9b6;
    color: #14603a;
}
.mensaje.mal{
    background: #fdeaec;
    border: 1px solid #f0a8ae;
    color: #8c0d18;
}

.cargando{
    padding: 30px;
    text-align: center;
    color: #8fa6bd;
    font-size: 15px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 700px){
    .admin .contenido{ margin-top: 24px; }
    .admin h1{ font-size: 26px; }
    .contador{ margin-left: 0; }
    .acciones-form .btn-admin{ flex: 1 1 100%; }
    .zona-previa{ justify-content: center; text-align: center; }
    .previa-acciones{ width: 100%; }
    .previa-acciones .btn-admin{ flex: 1 1 50%; }
}
