/* -----------------------------
   CONTENEDOR
--------------------------------*/
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
}

h2 {
    color: #2c3e50;
    margin-bottom: 24px;
    font-size: 24px;
}

/* -----------------------------
   TABS
--------------------------------*/
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab {
    padding: 8px 14px;
    border-radius: 6px;
    background-color: #f0f0f0;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    user-select: none;
}

.tab:hover {
    background: #f5f7fa;
}

.tab.active {
    background-color: #007bff;
    color: #fff;
    transform: translateY(2px);
}

.tab .badge {
    display: inline-block;
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-size: 12px;
}

.tab.active .badge {
    background: rgba(255,255,255,0.2);
}

.tab-content {
    display: none;
}

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




/* -----------------------------
   CARD
--------------------------------*/
.mapping-card {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    border: 2px solid #e1e8ed;
    margin-bottom: 16px;
    background-color: #fff;
    transition: all 0.3s;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.mapping-card:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
}

/* Estados */
.mapping-card.unmapped {
    border-left: 4px solid #aaa;
    opacity: 0.7;
}

.mapping-card.mapped {
    border-left: 4px solid #28a745;
    background-color: #e8f5e9;
}

.mapping-card.ignored {
    border-left: 4px solid #dc3545;
    background-color: #f8d7da;
    opacity: 0.8;
}

/* -----------------------------
   HEADER
--------------------------------*/
.mapping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 1;
}

.supplier-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.supplier-code {
    font-size: 13px;
    font-weight: 600;
    color: #657786;
}

.supplier-description {
    font-size: 15px;
    font-weight: 500;
    color: #14171a;
}

.supplier-price-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    white-space: nowrap;
}

/* -----------------------------
   SWITCH
--------------------------------*/
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #e0e0e0; /* un gris más marcado que el fondo */
    border: 1px solid #ccc;   /* borde para que se vea */
    border-radius: 24px;
    transition: 0.2s;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2); /* sombra para destacarlo */
    transition: 0.2s;
}

input:checked + .slider {
    background-color: #28a745;
}
input:checked + .slider:before {
    transform: translateX(26px);
}

/* -----------------------------
   ACTIONS
--------------------------------*/
.mapping-actions {
    display: none;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #dee2e6;
}

.mapping-card.mapped .mapping-actions,
.mapping-card.ignored .mapping-actions {
    display: flex;
}

.action-type {
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    border: 1px solid #ccc;
    transition: all 0.2s;
}

.action-type.active {
    color: #fff;
}

.action-type.map.active {
    background-color: #28a745;
    border-color: #28a745;
}

.action-type.ignore.active {
    background-color: #dc3545;
    border-color: #dc3545;
}

/* -----------------------------
   DETAILS
--------------------------------*/
.mapping-details {
    display: none;
    padding: 12px 16px;
    background-color: #fefefe;
}

.mapping-card.mapped .mapping-details {
    display: block;
}

.mapping-form-group label {
    font-weight: bold;
    margin-bottom: 4px;
    display: block;
}

.mapping-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.quantity-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quantity-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-input {
    width: 70px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.unit-text {
    font-size: 0.9em;
    color: #555;
}

.price-result {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.price-result-value {
    font-weight: bold;
    font-size: 1.1em;
}

.price-result-breakdown {
    font-size: 0.85em;
    color: #555;
}

/* -----------------------------
   SAVE BUTTON
--------------------------------*/
.save-mapping-btn {
    margin-top: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    background-color: #007bff;
    color: #fff;
    transition: all 0.2s;
}

.save-mapping-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* -----------------------------
   RESPONSIVE
--------------------------------*/
@media (max-width: 900px) {
    .mapping-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .mapping-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .mapping-details {
        padding: 8px 12px;
    }
}