/**
 * Estilos del Módulo de Escandallo
 * Diseño minimalista estilo OpenAI para gestión de recetas
 */

/* ============================================== 
   LAYOUT PRINCIPAL
   ============================================== */

.escandallo-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    padding: 20px;
    gap: 20px;
}

/* ============================================== 
   TABS
   ============================================== */

.escandallo-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 20px;
    background: #ffffff;
    border-radius: 12px 12px 0 0;
    position: sticky;
    top: 50px;
    z-index: 99;
}

.escandallo-tab {
    padding: 14px 24px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    top: 1px;
}

.escandallo-tab:hover {
    color: #111827;
}

.escandallo-tab.active {
    color: #111827;
    border-bottom-color: #111827;
}

/* ============================================== 
   CONTENIDO DE TABS
   ============================================== */

.escandallo-tab-content {
    display: none;
    flex: 1;
    background: #ffffff;
    border-radius: 0 0 12px 12px;
    padding: 24px;
}

.escandallo-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ============================================== 
   TOOLBAR
   ============================================== */

.escandallo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
}

.escandallo-search {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.escandallo-search-input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.escandallo-search-input:focus {
    outline: none;
    border-color: #9ca3af;
}

.escandallo-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* ============================================== 
   GRID DE RECETAS
   ============================================== */

.recetas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.receta-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    background: #ffffff;
}

.receta-card:hover {
    border-color: #9ca3af;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.receta-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f9fafb;
}

.receta-card-body {
    padding: 16px;
}

.receta-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.receta-card-category {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.receta-card-ingredientes-badge {
    background-color: #e0e7ff;
    color: #4f46e5;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.receta-card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.receta-stat {
    display: flex;
    flex-direction: column;
}

.receta-stat-label {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.receta-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.receta-stat-value.positive {
    color: #059669;
}

.receta-stat-value.negative {
    color: #ef4444;
}

/* ============================================== 
   DETALLE DE RECETA
   ============================================== */

.receta-detalle {
    display: none;
}

.receta-detalle.active {
    display: flex;
    flex-direction: column;
}

.receta-detalle-header {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.receta-image-container {
    position: relative;
    width: 200px;
    height: 200px;
    flex-shrink: 0;
}

.receta-detalle-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    background: #f9fafb;
}

.btn-change-image {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
}

.receta-image-container:hover .btn-change-image {
    opacity: 1;
}

.btn-change-image:hover {
    background: rgba(16, 163, 127, 0.9);
    transform: scale(1.05);
}

.receta-detalle-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.receta-detalle-title {
    font-size: 28px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.receta-detalle-category {
    font-size: 14px;
    color: #6b7280;
}

.receta-detalle-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: auto;
}

.receta-metric {
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.receta-metric-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.receta-metric-value {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
}

.receta-metric-value-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.receta-metric-input {
    width: 120px;
    padding: 4px 8px;
    font-size: 20px;
    font-weight: 600;
    border: 1px solid #10a37f;
    border-radius: 6px;
    background: #ffffff;
    color: #111827;
}

.receta-metric-input:focus {
    outline: none;
    border-color: #0d8868;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

/* ============================================== 
   TABLA DE INGREDIENTES
   ============================================== */

.ingredientes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ingredientes-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.ingredientes-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.ingredientes-table thead {
    background: #f9fafb;
}

.ingredientes-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
}

.ingredientes-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

.ingredientes-table tbody tr:last-child td {
    border-bottom: none;
}

.ingredientes-table tbody tr:hover {
    background: #f9fafb;
}

.ingredientes-table .actions {
    text-align: right;
}

.btn-icon-small {
    padding: 6px;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-icon-small:hover {
    background: #f3f4f6;
    color: #111827;
}

.btn-icon-small.delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* ============================================== 
   LISTA DE INGREDIENTES
   ============================================== */

.ingredientes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.ingrediente-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: #ffffff;
}

.ingrediente-card:hover {
    border-color: #9ca3af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ingrediente-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.ingrediente-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.ingrediente-card-ref {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.ingrediente-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ingrediente-card-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.ingrediente-card-label {
    color: #6b7280;
}

.ingrediente-card-value {
    color: #111827;
    font-weight: 500;
}

/* ============================================== 
   LISTA DE UNIDADES
   ============================================== */

.unidades-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.unidad-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    transition: all 0.2s ease;
}

.unidad-card:hover {
    border-color: #9ca3af;
}

.unidad-card-info {
    flex: 1;
}

.unidad-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
}

.unidad-card-acronym {
    font-size: 13px;
    color: #6b7280;
}

/* ============================================== 
   MODAL
   ============================================== */

.escandallo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.escandallo-modal.active {
    display: flex;
}

.escandallo-modal-content {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.escandallo-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.escandallo-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.escandallo-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.escandallo-modal-close:hover {
    background: #f3f4f6;
}

.escandallo-modal-body {
    padding: 24px;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.escandallo-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ============================================== 
   ESTADO VACÍO
   ============================================== */

.escandallo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    grid-column: 1 / -1;
    padding: 40px 0 !important;


}

.escandallo-empty svg {
    width: 64px;
    height: 64px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.escandallo-empty h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.escandallo-empty p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

/* ============================================== 
   SELECTOR DE ITEMS
   ============================================== */

.items-list-modal {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding: 8px 0;
}

.item-select-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.item-select-card:hover {
    border-color: #9ca3af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.item-select-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    background: #f9fafb;
    flex-shrink: 0;
}

.item-select-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}

.item-select-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-select-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
    flex-wrap: wrap;
}

.item-categoria {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
}

.badge-receta-existe,
.badge-sin-receta {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-receta-existe {
    background: #dbeafe;
    color: #1e40af;
}

.badge-sin-receta {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-info {
    padding: 2px 8px;
    border-radius: 12px;
    background: #dcfce7;
    color: #15803d;
    font-weight: 600;
}

/* ============================================== 
   TAGS INPUT
   ============================================== */

.tags-input-wrapper {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 5px 0px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    background: #ffffff;
    transition: border-color 0.2s ease;
    margin-bottom: 6px;
}

.tags-input-wrapper:focus-within {
    border-color: #9ca3af;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tags-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 4px 8px;
    min-width: 150px;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
}

.tag-badge-small {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
}

.tag-remove {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #ffffff;
    padding: 0;
    transition: background 0.2s ease;
}

.tag-remove:hover {
    background: rgba(255, 255, 255, 0.5);
}

.ingrediente-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 0 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.loading-spinner{
    margin:0 auto;
}

.tags-suggestions {
    position: absolute;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
    width: calc(100% - 24px);
}

.tag-suggestion {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: background 0.15s ease;
}

.tag-suggestion:hover {
    background: #f9fafb;
}

.tag-suggestion:not(:last-child) {
    border-bottom: 1px solid #f3f4f6;
}

/* ============================================== 
   RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
    .escandallo-container {
        padding: 12px;
    }

    .escandallo-tabs {
        padding: 0 12px;
        overflow-x: auto;
    }

    .escandallo-tab {
        padding: 12px 16px;
        white-space: nowrap;
    }

    .escandallo-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .escandallo-search {
        max-width: none;
    }

    .recetas-grid {
        grid-template-columns: 1fr;
    }

    .receta-detalle-header {
        flex-direction: column;
    }

    .receta-detalle-image {
        width: 100%;
        height: 200px;
    }

    .receta-detalle-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .ingredientes-list,
    .unidades-list {
        grid-template-columns: 1fr;
    }

    .ingredientes-table {
        font-size: 12px;
    }

    .ingredientes-table th,
    .ingredientes-table td {
        padding: 8px 12px;
    }

    .items-list-modal {
        grid-template-columns: 1fr;
    }

    .item-select-image {
        width: 50px;
        height: 50px;
    }

    /* Modal de escandallo mejorado para móvil */
    .escandallo-modal {
        padding: 0;
        align-items: flex-end;
    }

    .escandallo-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 16px 16px 0 0;
        margin: 0;
        animation: slideUpMobile 0.3s ease;
    }

    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .escandallo-modal-header {
        padding: 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .escandallo-modal-header h2 {
        font-size: 18px;
        flex: 1;
        min-width: 0;
    }

    .escandallo-modal-close {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .escandallo-modal-body {
        padding: 16px;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Formularios en modal */
    .escandallo-form {
        gap: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Asegurar que todos los inputs dentro del modal no se desborden */
    .escandallo-modal-body input,
    .escandallo-modal-body textarea,
    .escandallo-modal-body select,
    .escandallo-modal-body .input-field {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 16px !important;
        min-height: 48px;
        padding: 14px 16px;
    }

    /* Cards de opciones de receta */
    .receta-option-card {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .receta-option-icon {
        margin: 9px auto;
    }

    .receta-option-content {
        text-align: center;
    }

    /* Área de selección de items */
    #items-selection-area {
        width: 100%;
        box-sizing: border-box;
    }

    #items-selection-area > div[style*="display: flex"] {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    #items-selection-area .btn {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }

    #items-selection-area .form-group {
        width: 100%;
    }

    #items-selection-area .form-input,
    #search-items-modal {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 16px !important;
        min-height: 48px;
        padding: 14px 16px;
    }

    #items-selection-area h3 {
        font-size: 16px;
        width: 100%;
        text-align: center;
    }

    /* Lista de items */
    .items-list-modal {
        gap: 12px;
    }

    .item-select-card {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .item-select-image {
        width: 100%;
        height: 150px;
        margin-bottom: 12px;
    }

    .item-select-info {
        width: 100%;
    }
}

/* ============================================== 
   MODAL DE INGREDIENTES - TABS
   ============================================== */

.ingrediente-form-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.ingrediente-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    top: 1px;
}

.ingrediente-tab:hover {
    color: #111827;
}

.ingrediente-tab.active {
    color: #111827;
    border-bottom-color: #3b82f6;
}

.ingrediente-tab-content {
    display: none;
}

.ingrediente-tab-content.active {
    display: block;
}

/* ============================================== 
   SECCIÓN DE STOCK
   ============================================== */

.stock-section {
    padding: 20px 0;
}

/* ============================================== 
   SECCIÓN DE PRECIOS POR PROVEEDOR
   ============================================== */

.precios-proveedor-section {
    padding: 20px 0;
}

/* Estilos para histórico de precios */
.historial-precios-section {
    padding: 20px 0;
    text-align: center;
}

/* Estilos para edición de nombre de receta */
.receta-title-container {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.btn-edit-nombre {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(-4px);
}

.receta-title-container:hover .btn-edit-nombre {
    opacity: 1;
    transform: translateX(0);
}

.btn-edit-nombre:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    color: #374151;
    transform: translateX(0) scale(1.05);
}

.receta-nombre-edit-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.receta-nombre-edit-container:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.receta-nombre-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    flex: 1;
    min-width: 0;
    font-family: inherit;
}

.receta-nombre-input::placeholder {
    color: #9ca3af;
}

.receta-nombre-edit-actions {
    display: flex;
    gap: 4px;
}

.btn-save-nombre, .btn-cancel-nombre {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.btn-save-nombre:hover {
    background: #10b981;
    color: white;
    transform: scale(1.1);
}

.btn-cancel-nombre:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* Estilos para tabs de receta */
.receta-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e5e7eb;
    margin: 24px 0;
}

.receta-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    top: 1px;
}

.receta-tab:hover {
    color: #111827;
}

.receta-tab.active {
    color: #111827;
    border-bottom-color: #3b82f6;
}

.receta-tab-content {
    display: none;
}

.receta-tab-content.active {
    display: block;
}

/* Estilos para histórico de cambios de receta */
.historial-cambios-section {
    padding: 20px 0;
}


.historial-cambio-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.historial-cambio-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.historial-cambio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.historial-cambio-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.historial-cambio-info strong {
    color: #111827;
    font-size: 14px;
}

.historial-cambio-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.coste-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.coste-info .coste {
    font-weight: 600;
    color: #111827;
    font-size: 16px;
}

.coste-info .precio-venta {
    color: #6b7280;
    font-size: 14px;
}

.beneficio-margen {
    display: flex;
    gap: 12px;
    font-size: 14px;
}

.beneficio.positive {
    color: #059669;
    font-weight: 600;
}

.beneficio.negative {
    color: #dc2626;
    font-weight: 600;
}

.margen {
    color: #6b7280;
    font-weight: 500;
}

.ingrediente-modificado, .notas-cambio {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    color: #374151;
}

.ingrediente-modificado strong, .notas-cambio strong {
    color: #111827;
}

/* Estilos para indicadores de cambio en histórico */
.receta-metric-value-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.indicador-cambio {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: all 0.2s ease;
}

.cambio-subida {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.cambio-bajada {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.cambio-igual {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* Hover effects para indicadores */
.indicador-cambio:hover {
    transform: scale(1.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Ajustar métricas del histórico para que se vean mejor */
.historial-cambio-item .receta-detalle-metrics {
    margin-top: 12px;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.historial-cambio-item .receta-metric {
    margin-bottom: 8px;
}

.historial-cambio-item .receta-metric:last-child {
    margin-bottom: 0;
}

.historial-list {
    max-height: 400px;
    overflow-y: auto;
}

.historial-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.historial-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.historial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.proveedor-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.proveedor-info strong {
    color: #111827;
    font-size: 14px;
}

.fecha-cambio {
    color: #6b7280;
    font-size: 12px;
}

.historial-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.precio-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

.precio-info .precio {
    font-weight: 600;
    color: #111827;
    font-size: 16px;
}

.precio-info .unidad {
    color: #6b7280;
    font-size: 12px;
}

.detalles-adicionales {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6b7280;
}

.cambio-positivo {
    color: #059669;
    font-weight: 600;
    font-size: 12px;
}

.cambio-negativo {
    color: #dc2626;
    font-weight: 600;
    font-size: 12px;
}

.cambio-neutro {
    color: #6b7280;
    font-weight: 600;
    font-size: 12px;
}

.no-data {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 40px 20px;
}

.error-message {
    text-align: center;
    color: #dc2626;
    padding: 40px 20px;
}

.usuarios-error-message {
    text-align: left;
    color: #dc2626;
    padding: 0;
    font-size: 0.8em;
    margin-bottom: 8px;
    margin-top: 4px;
}

.motivo-cambio, .notas-cambio {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    color: #374151;
}

.motivo-cambio strong, .notas-cambio strong {
    color: #111827;
}

.precios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.precio-form {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.proveedor-search-wrapper {
    position: relative;
}

.proveedor-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.proveedor-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

.proveedor-suggestion:hover {
    background-color: #f9fafb;
}

.proveedor-suggestion:last-child {
    border-bottom: none;
}

.precios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.precio-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.precio-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.precio-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.precio-card-proveedor {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.precio-card-actions {
    display: flex;
    gap: 4px;
}

.precio-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.precio-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.precio-card-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.precio-card-value {
    font-size: 13px;
    color: #111827;
    font-weight: 600;
}

/* Clases de utilidad para colores */
.text-danger {
    color: #dc2626 !important;
}

.text-warning {
    color: #f59e0b !important;
}

.text-success {
    color: #16a34a !important;
}

/* ============================================== 
   CHECKBOXES DE SINCRONIZACIÓN
   ============================================== */

.checkbox-container {
    margin: 16px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    color: #374151;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.checkbox-text {
    font-size: 14px;
    font-weight: 500;
}

.checkbox-description {
    margin: 8px 0 0 26px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

