html{
    background-color: #0f0f0f;
    padding-bottom: 2em;
}

body{
    background-color: #0f0f0f;
    color:#eee;
    opacity: 0; /* Ocultar inicialmente */
    animation: fadeIn 1.2s forwards; /* Animación */
}
  /* Animación Fade-in */
  @keyframes fadeIn {
    to {
      opacity: 1;
    }
  }

/* Contenedor principal */
.container {
    width: 98%;
    margin: auto;
    padding: 1%;
}

/* Cabecera */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
header h1{
/*    font-family: 'Pacifico', cursive;*/
    font-family: "Londrina Sketch", sans-serif;
    margin:0px;
    color:#efefef;
    font-size: 4em;
  }


/* Tabla del catálogo */
.catalog-table {
    width: 100%;
    max-width: 1000px;
    border-collapse: collapse;
    margin: 20px auto 0;
}
.catalog-table thead th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.45);
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    white-space: nowrap;
}
.catalog-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    vertical-align: middle;
    color: #efefef;
}
.catalog-row:hover td {
    background-color: rgba(255,255,255,0.04);
}
.catalog-table tbody tr:nth-child(even) td {
    background-color: rgba(255,255,255,0.02);
}
.th-img { width: 68px; }
.table-thumb {
    width: 62px;
    height: 62px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}
.td-info {
    min-width: 160px;
}
.td-info span {
    display: block;
}
.table-marca {
    font-weight: 700;
    font-size: 0.95em;
    color: #fff;
}
.table-variedad {
    font-size: 0.82em;
    color: rgba(255,255,255,0.55);
}
.table-desc {
    font-size: 0.75em;
    color: rgba(255,255,255,0.35);
    font-style: italic;
}
.td-cat { white-space: nowrap; }
.cat-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.75em;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}
.td-tablero { white-space: nowrap; }
.catalog-table .tablero-div {
    float: none;
    display: inline-block;
    margin-right: 0;
}
.tablero-pos-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tablero-pos {
    font-size: 0.75em;
    color: rgba(255,255,255,0.35);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
}
.td-estado { white-space: nowrap; }
.td-actions {
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
}
.catalog-row:hover .td-actions {
    opacity: 1;
}
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.06);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    font-size: 0.85em;
    margin-right: 4px;
}
.action-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}
.action-del:hover {
    background: rgba(220,50,50,0.3);
    color: #ff8080;
}
/* Rating (1-10) */
.rating-cell {
    display: flex;
    align-items: center;
}

.rating-bar {
    width: 100px;
    height: 10px;
    background-color: #666;
    margin-right: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.rating-value {
    height: 100%;
    background-color: #5c7cfa;
}

.rating-cell span {
    font-weight: bold;
}

.btn-group { display: inline-flex; gap: 6px; }
.btn-group a { display: contents; }

/* Vista previa de la imagen al editar */
.preview-image {
    margin-top: 10px;
}

.preview-image img {
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-top: 10px;
}




/* Contenedor del formulario y la imagen */
.form-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width:80%;
    margin:auto;
}

.image-preview {
    flex: 1;
}

.image-preview img {
    max-width: 300px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-image: linear-gradient(45deg, #bbb 25%, transparent 25%),
                      linear-gradient(-45deg, #bbb 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #bbb 75%),
                      linear-gradient(-45deg, transparent 75%, #bbb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    background-color: #eee;
}

/* Formulario */
form {
    flex: 2;
}

.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.form-group label {
    flex: 1 0 150px;
    font-weight: bold;
}

.form-group input[type="text"], 
.form-group textarea, 
.form-group select, 
.form-group input[type="file"] {
    flex: 2;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}

form input[type="submit"], button {
    background-color: #392b8d;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

form input[type="submit"]:hover {
    background-color: #392b8d;
}

.item-image {
    width: 100px;
    height: auto;
    margin-right: 10px;
}

.item-image2 {
    width: 180px;
    height: auto;
    margin-left: 10px;
}

.filter-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 15px;
}

.filter-group {
    float:left;
    margin-right: 10px;
}
.filter-group label {
    display: inline-block;
}

.rating-bar {
    width: 100px;
    height: 15px;
    background-color: #ddd;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.filled-bar {
    height: 100%;
    background-color: darkcyan;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.autocomplete-wrapper {
    position: relative;
    max-width: 40%; /* Ajustar según sea necesario */
    min-width: 200px;
    display: inline-block;

}

#filtro_texto_libre {
    width: 100%;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#suggestions {
    position: absolute;
    min-width: 220px;
    max-width: 80%;
    max-height: 260px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.suggestion-item:hover {
    background-color: #f0f0f0;
}

.suggestion-marca {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    padding: 8px 10px;
}
.sg-marca { color: #222; }
.sg-count {
    font-size: 0.75em;
    background: #e0e0e0;
    color: #555;
    border-radius: 10px;
    padding: 1px 7px;
    font-weight: 400;
    margin-left: 6px;
}
.suggestion-sub {
    padding: 5px 10px 5px 20px;
    border-left: 2px solid #e8e8e8;
    margin-left: 10px;
}
.sg-variedad {
    color: #666;
    font-size: 0.9em;
}
.suggestion-sub:hover { background-color: #f5f5f5; }

.clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #999;
    cursor: pointer;
}

.clear-btn:hover {
    color: #333;
}

select {
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.grupo2{
    padding-top:14px;
    clear:both;
}
.grupo3, .grupo4{
    float:right;
}


#filtro-mini{
    display: none;
}
#sort-mini{
    display: none;
}


.btn-filter, .btn-sort {
    display: inline-flex;
    align-items: center;
    background-color: #007bff; /* Color de fondo azul */
    color: white;
    border: none;
    padding: 10px 15px;
    margin: 5px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.btn-filter:hover, .btn-sort:hover {
    background-color: #0056b3; /* Cambia el color al pasar el ratón */
}

.btn-filter i, .btn-sort i {
    margin-right: 8px; /* Espacio entre el ícono y el texto */
}

.tipo_vista{
    display: inline-block;
    cursor: pointer;
    margin:5px 5px;
    padding: 5px 10px;
    border-radius: 3px;
    border: 1px solid #999;

}

.vistaicons{
    float:right;
}

.item{
    float:left;
    padding: 0.5em;
    border-radius: 10px;
    border: 1px solid #999;
    margin: 0.5em;
    text-align: center;
    width: 250px;
    height: 260px;
}

.item:hover{
    background-color: rgb(36, 0, 104);
}
.item a img {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='white' stroke='black' stroke-width='1' d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E") 0 20, pointer;
}
.item img{
    margin-top: 15px;
    text-align: center;
}
.item .icons, .item-tablero .icons{
    position: absolute;
}
.item .icons .edit-button, .item-tablero .icons .edit-button{
    color: #eee;
}
.icon-tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-left:5px;
  }

  /* Tooltip oculto por defecto */
  .icon-tooltip .tooltip-text {
    visibility: hidden;
    min-width: 250px;
    max-width: 380px;
    background-color: black;
    color: #fff;
    text-align: left;
    border-radius: 5px;
    padding: 10px;
    position: absolute;
    /*
    bottom: 125%; 
    left: 50%;
    transform: translateX(-50%);*/
    opacity: 0;
    transition: opacity 0.3s;
  }

  /* Mostrar el tooltip al hacer hover */
  .icon-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    z-index: 10;
  }

.delete-button {
    background-color: #8b0000;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
.delete-button:hover {
    background-color: #b22222;
}
.msg{
    position: fixed;
    width: 40%;
    background-color: #3e1069;
    color:white;
    padding: 2em;
    margin: 30%;
    text-align: center;
    border: 1px solid #efefef;
    border-radius: 1em;
}
.tablero-filter-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 0.85em;
    opacity: 0.55;
    transition: opacity 0.15s, border-color 0.15s;
    vertical-align: middle;
}
.tablero-filter-chip:hover {
    opacity: 0.85;
}
.tablero-filter-active {
    opacity: 1;
    border-color: rgba(255,255,255,0.7);
}
.tablero-div{
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #392b8d;
    width: 20px;
    text-align: center;
    float: right;
    margin-right:30px;
    cursor: help;
}
.tablero-div.sm {
    padding: 2px 5px;
    font-size: 0.75em;
    width: auto;
    min-width: 16px;
    float: none;
    margin: 0;
    display: inline-block;
    color: #000;
    font-weight: bold;
}



.tablero{
    border-radius: 3em;
    width: 45%;
    margin:auto;
    padding-top:3em;
    float:left;
    margin-top: 2em;
        border-width: 0.7em;
        border-style: solid;
    box-shadow: inset 2px 2px 4px #666,
              inset -2px -2px 4px #999;
}

.tablero-grid {
    display: grid;
    gap: 4px;
    padding: 6px;
    margin: 4em 0.2em 1em 0.2em;
}
.item-tablero{
    text-align: center;
    min-width: 0;
}
a.item-tablero-link {
    display: block;
    text-decoration: none;
    cursor: grab;
}
a.item-tablero-link:active {
    cursor: grabbing;
}
a.item-tablero-link:hover {
    outline: 2px solid rgba(255,255,255,0.4);
    border-radius: 4px;
}
.item-tablero-link.dragging {
    opacity: 0.3;
}
.item-tablero-empty.drag-over {
    border-color: rgba(100,200,255,0.9);
    background-color: rgba(100,200,255,0.15);
    color: rgba(100,200,255,0.9);
}
.stack-container {
    margin-bottom: 2em;
    padding: 0.8em 1.2em 1.2em;
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 10px;
}
.stack-title {
    font-size: 0.8em;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.8em;
}
.stack-count {
    background: rgba(255,255,255,0.1);
    padding: 0 6px;
    border-radius: 10px;
}
.stack-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.stack-item {
    position: relative;
    width: 70px;
    text-align: center;
}
[draggable="true"].stack-item {
    cursor: grab;
}
[draggable="true"].stack-item:active {
    cursor: grabbing;
}
.stack-label {
    font-size: 0.65em;
    color: rgba(255,255,255,0.55);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}
.stack-label span {
    color: rgba(255,255,255,0.35);
}
.item-tablero-empty {
    border: 2px dashed rgba(255,255,255,0.25);
    border-radius: 6px;
    background-color: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 75px;
    font-size: 1.4em;
    color: rgba(255,255,255,0.2);
    text-decoration: none;
    line-height: 1;
}
.item-tablero-empty:hover {
    border: 2px dashed rgba(255,255,255,1);
    background-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
}
 .numero{
  background-image: url('chapas_img/num-tablero.png');
  background-size: contain;         /* O "contain", según el caso */
  background-position: center;
  background-repeat: no-repeat;
    font-family: 'Dancing Script';  
    font-size:3em; color:black;
    font-weight: bold;
  width: 10%;
  padding-top:1%;
  padding-bottom:1%;
  margin:-1.5em 45%;
  text-align: center;
  z-index: 9;
}

.item-image-tablero {
    width: 100%;
    height: auto;
    margin-left: 3%;
}
.tablero-selector{
    border:1px solid #ccc;
    padding:0.5em 1.5em;
    border-radius: 3px;
    cursor:pointer;
    margin:0px 5px;
    opacity:0.5;
}

.tablero-selector:hover{
    opacity:0.8;
    scale: 1.1;
}

.tablero-selector-seleccionado{
    border:4px solid #B22222;
    color:white;
    font-weight: bold;
    opacity:1;
}

.rating-sprite {
    display: inline-block;
    width: 52px;
    height: 57px;
    background-image: url('chapas_img/rating-2.png');
    background-size: 156px 57px;
    background-repeat: no-repeat;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s, transform 0.15s;
    vertical-align: middle;
}
.rating-sprite[data-val="1"] { background-position: 0px 0px; }
.rating-sprite[data-val="2"] { background-position: -52px 0px; }
.rating-sprite[data-val="3"] { background-position: -104px 0px; }
.rating-sprite.active,
.rating-sprite:hover {
    opacity: 1;
    transform: scale(1.1);
}
.rating-sprite.display {
    cursor: default;
    opacity: 1;
    transform: none !important;
}
.rating-sprite.display.inactive {
    opacity: 0.2;
    filter: grayscale(80%);
}
.rating-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.rating-sprite.sm {
    width: 34px;
    height: 37px;
    background-size: 102px 37px;
}
.rating-sprite.sm[data-val="2"] { background-position: -34px 0px; }
.rating-sprite.sm[data-val="3"] { background-position: -68px 0px; }
.item { position: relative; }

.tablero .tooltip-text {
    margin-top:15px;
}
.select-sm {
    max-width: 65px;
    padding: 4px;
    font-size: 13px;
}
.item .rating-sprite.display.sm {
    position: absolute;
    top: 6px;
    right: 6px;
}
.tablero-spacer {
    width: 3%;
    float: left;
}
.clear {
    clear: both;
}

/* Estilos responsivos */
@media (max-width: 1024px) {
    .container {
        width: 95%;
    }

    .catalog-table th, .catalog-table td {
        padding: 10px;
    }

    .catalog-table td img {
        width: 80px;
    }
    .autoexpand{
        width:60%;
    }
    .filter-row{
        clear:both;
        margin:1em 0em;
    }
    .grupo1, .grupo2, .grupo3{
        display: none;
        margin: 10px 0px;
        float:left;
    }
    .grupo2 .filter-group:first-child {
        float: left;
        width: 100%;
        margin-bottom: 8px;
    }
    #filtro-mini{
        display: block;
        float:right;
    }
    #sort-mini{
        display: block;
        float:right;
    }
    .filter-button{
        margin-left:1em !important;
    }
    .tablero{
        width: 96%;
        margin: auto;
        padding-top:1.3em;
        border-width: 0.3em;
        border-style: solid;
        border-radius: 2em;
        }
    .tablero .icons{
        display: none;
    }
    .numero{
        font-size: 1em;
        margin:-2em 45%;

    }

    header h1{ 
        font-size: 2.4em;
    }
    .vistaicons{
        display: none;
    }
    #tablero-filters{
      display: none;
    }
    #filtro_categoria{
        display: none;
    }
    .hide-on-mobile{
        display: none !important;
    }
    #orden_direccion, #orden_campo, #filtro_marca{
         font-size:13px;
    }
}

/* ── Tableros management page ─────────────────────────────────────────────── */
.tableros-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 1.5em 0 2em;
}
.tablero-card {
    width: 110px;
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.tablero-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
.tablero-card.active { box-shadow: 0 0 0 3px #fff; }
.tablero-card-preview {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2em;
    font-family: 'Dancing Script', cursive;
    font-weight: bold;
}
.tablero-card-footer {
    padding: 6px 8px;
    background: rgba(0,0,0,0.35);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72em;
    color: rgba(255,255,255,0.7);
}
.tablero-card-footer .card-actions a {
    color: rgba(255,255,255,0.5);
    margin-left: 6px;
    text-decoration: none;
}
.tablero-card-footer .card-actions a:hover { color: #fff; }
.tablero-card-footer .card-actions a.del:hover { color: #ff7070; }
.tablero-card-hidden { opacity: 0.35; filter: grayscale(70%); }

.tablero-form-box {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1.5em 2em;
    max-width: 480px;
}
.tablero-form-box h2 {
    margin: 0 0 1.2em;
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.5);
}
.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.color-picker-input {
    width: 40px;
    height: 34px;
    padding: 2px;
    border-radius: 5px;
    border: 1px solid #555;
    background: none;
    cursor: pointer;
}
.color-text-input {
    flex: 1;
    padding: 7px 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background: rgba(255,255,255,0.06);
    color: #eee;
    font-size: 0.9em;
}
.msg.error { background: rgba(200,50,50,0.15); border: 1px solid rgba(200,50,50,0.4); color: #ff9090; padding: 8px 14px; border-radius: 6px; margin-bottom: 1em; }
.msg.ok    { background: rgba(50,200,80,0.1);  border: 1px solid rgba(50,200,80,0.3);  color: #80e090; padding: 8px 14px; border-radius: 6px; margin-bottom: 1em; }
.numero-input {
    width: 80px;
    padding: 7px 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background: rgba(255,255,255,0.06);
    color: #eee;
    font-size: 1em;
}
.section-title {
    margin: 2em 0 0.8em;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.35);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 0.4em;
}
.reassign-box {
    background: rgba(200,120,30,0.12);
    border: 1px solid rgba(200,120,30,0.35);
    border-radius: 10px;
    padding: 1em 1.4em;
    margin-bottom: 1.2em;
    color: #f0c070;
}
.reassign-box p { margin: 0 0 0.8em; }
.reassign-box select {
    padding: 7px 10px;
    border-radius: 5px;
    border: 1px solid #777;
    background: rgba(255,255,255,0.08);
    color: #eee;
    font-size: 0.95em;
    min-width: 200px;
}
.categorias-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 480px;
    margin-bottom: 1em;
}
.categoria-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    transition: background 0.15s;
}
.categoria-row:hover { background: rgba(255,255,255,0.07); }
.categoria-row.active { border-color: rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); }
.categoria-nombre { flex: 1; font-size: 0.95em; }
.categoria-count  { font-size: 0.8em; color: rgba(255,255,255,0.4); min-width: 60px; text-align:right; }
.categoria-row .card-actions { margin-left: 10px; }
