/* Location Stock Popup - Socomarca ERP */

/* Boton trigger */
.sm-location-popup-wrapper {
    display: inline-block;
    margin: 8px 0;
}

.sm-location-popup-trigger {
    cursor: pointer;
}

.sm-trigger-change {
    font-size: 0.8em;
    font-weight: normal;
    opacity: 0.7;
    margin-left: 4px;
}

/* Bloquear scroll del body cuando el modal esta abierto */
body.sm-modal-open {
    overflow: hidden;
}

/* Overlay del modal */
.sm-location-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-location-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
}

/* Contenedor */
.sm-location-modal-container {
    position: relative;
    background: #fff;
    border-radius: 6px;
    width: 100%;
    max-width: 460px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    margin: 16px;
}

/* Header */
.sm-location-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.sm-location-modal-header h3 {
    margin: 0;
    font-size: 1.05em;
    font-weight: 600;
}

.sm-location-modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.sm-location-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Body */
.sm-location-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Formulario de seleccion */
.sm-location-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sm-location-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sm-location-field label {
    font-weight: 500;
    font-size: 0.95em;
    color: #333;
}

.sm-location-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.15s;
}

.sm-location-field select:focus {
    outline: none;
    border-color: #2c6e49;
    box-shadow: 0 0 0 2px rgba(44, 110, 73, 0.15);
}

.sm-location-field select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: default;
}

/* Acciones */
.sm-location-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}

.sm-location-confirm {
    cursor: pointer;
}

.sm-location-confirm:disabled {
    opacity: 0.5;
    cursor: default;
}

.sm-location-loading {
    font-size: 0.9em;
    color: #666;
}

/* Mensaje sin regiones */
.sm-no-locations {
    text-align: center;
    color: #777;
    padding: 24px 20px;
    margin: 0;
}

/* Toasts de cambio de bodega */
.sm-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
}

.sm-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 6px;
    color: #fff;
    font-size: 0.9em;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    animation: sm-toast-in 0.2s ease;
}

@keyframes sm-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sm-toast-success { background: #2e7d32; }
.sm-toast-warning { background: #e65100; }
.sm-toast-error   { background: #c62828; }

.sm-toast-icon {
    font-size: 1.1em;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Comparativa de stock al cambiar de bodega */
.sm-location-modal--comparison {
    max-width: 580px;
}

.sm-stock-comparison {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sm-stock-notice {
    background: #fff8e1;
    border-left: 4px solid #f9a825;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 0.88em;
    color: #555;
    line-height: 1.5;
}

.sm-stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
}

.sm-stock-table thead th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 600;
    color: #444;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.sm-stock-table tbody td {
    padding: 9px 10px;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
    vertical-align: middle;
}

.sm-stock-center {
    text-align: center;
}

.sm-stock-row-error td {
    background: #ffebee;
    color: #c62828;
    font-weight: 600;
}

.sm-stock-row-warning td {
    background: #fff3e0;
    color: #bf360c;
}

.sm-stock-question {
    margin: 0;
    font-weight: 600;
    font-size: 0.95em;
    color: #333;
}

.sm-stock-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.sm-stock-proceed {
    background-color: #3F7C30 !important;
    color: #fff !important;
    border: 1px solid #3F7C30 !important;
}

.sm-stock-proceed:hover {
    background-color: #5bb943 !important;
    color: #fff !important;
    border: 1px solid #3F7C30 !important;
}

.sm-stock-cancel {
    background: #fff !important;
    color: #3F7C30 !important;
    border: 1px solid #3F7C30 !important;
}

.sm-stock-cancel:hover {
    background: #f5f5f5 !important;
    color: #333 !important;
}

/* Responsive */
@media (max-width: 480px) {
    .sm-toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: 100%;
    }

    .sm-location-modal-container {
        max-height: 90vh;
        margin: 8px;
        border-radius: 4px;
    }

    .sm-stock-actions {
        flex-direction: column-reverse;
    }

    .sm-stock-actions button {
        width: 100%;
        text-align: center;
    }
}
