/* Estilos para el popup de precios especiales en el frontend */

/* Modal del frontend */
.os-frontend-modal {
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.os-frontend-modal.show {
    opacity: 1;
    visibility: visible;
}

/* Debug: Asegurar que el modal sea visible cuando se muestre */
.os-frontend-modal.show {
    display: flex !important;
}

.os-frontend-modal-content {
    background-color: #ffffff;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.os-frontend-modal.show .os-frontend-modal-content {
    transform: translateY(0) scale(1);
}

.os-frontend-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.os-frontend-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.os-frontend-modal-close {
    color: rgba(255,255,255,0.8);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.os-frontend-modal-close:hover {
    color: white;
    background-color: rgba(255,255,255,0.1);
}

.os-frontend-modal-body {
    padding: 25px;
}

/* Formulario */
.os-form-group {
    margin-bottom: 25px;
}

.os-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.os-form-group label strong {
    color: #1f2937;
    font-size: 15px;
}

.field-description {
    display: block;
    font-weight: normal;
    color: #6b7280;
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.4;
}

/* Visualizaci??n del cliente actual */
.os-current-user-display {
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px 20px;
    min-height: 50px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.os-user-name {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.os-user-name::before {
    content: '';
    font-size: 18px;
}

.os-user-email {
    font-size: 14px;
    font-weight: normal;
    color: #64748b;
    font-style: italic;
}

.os-form-group select,
.os-form-group input,
.os-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background-color: #ffffff;
}

.os-form-group select:focus,
.os-form-group input:focus,
.os-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.os-form-group select {
    cursor: pointer;
}

.os-form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.price-note {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #059669;
    font-style: italic;
}

/* Botones */
.os-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.os-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    gap: 8px;
}

.os-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.os-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.os-btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.os-btn-secondary:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
}

.os-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Bot??n flotante (FAB) */
.os-special-prices-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999998;
}

.os-fab-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.os-fab-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.os-fab-button .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.os-fab-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #374151;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.os-fab-tooltip::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 5px solid #374151;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.os-fab-button:hover .os-fab-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Bot??n en la interfaz de cliente */
.os-special-prices-button-container {
    margin: 15px 0;
    text-align: center;
}

.os-special-prices-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.os-special-prices-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.os-special-prices-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Resumen de precios especiales */
.os-special-prices-summary {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.os-special-prices-summary h4 {
    margin: 0 0 15px 0;
    color: #374151;
    font-size: 16px;
    font-weight: 600;
}

.os-special-prices-summary .os-special-prices-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.os-special-price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.os-service-name {
    font-weight: 500;
    color: #374151;
}

.os-special-price-value {
    font-weight: 600;
    color: #059669;
    font-size: 16px;
}

/* ===== PANEL INLINE (AGREGAR/EDITAR PRECIO DEBAJO DEL BOT?N) ===== */
.os-special-prices-inline-wrap {
    margin-top: 12px;
    margin-bottom: 16px;
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.os-special-prices-inline-form .os-inline-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

.os-special-prices-inline-form .os-form-group {
    margin-bottom: 0;
    min-width: 140px;
}

.os-special-prices-inline-form .os-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.os-special-prices-inline-form .os-form-group select,
.os-special-prices-inline-form .os-form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
}

.os-special-prices-inline-form .os-inline-form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 768px) {
    .os-special-prices-inline-form .os-inline-form-row {
        flex-direction: column;
        align-items: stretch;
    }
    .os-special-prices-inline-form .os-form-group {
        min-width: 0;
    }
}

/* ===== ESTILOS PARA LA INTEGRACI?N EN LA VENTANA DE EDITAR CLIENTE DE LATEPOINT ===== */

/* Ocultar secci??n de precios especiales cuando se visualiza dentro del formulario Nueva Orden (Quick Order) */
.quick-order-form-w .os-special-prices-customer-section{
    display:none !important;
}


/* Secci??n de precios especiales en la ventana de cliente */
.os-special-prices-customer-section {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin: 25px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    max-width: 100%;
    overflow: hidden;
}

/* Usar los estilos nativos de LatePoint para el header */
.os-special-prices-customer-section .os-form-sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
}

.os-special-prices-customer-section .os-form-sub-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.os-special-prices-customer-section .os-form-sub-header h3 .dashicons {
    color: #667eea;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Acciones del header */
.os-form-sub-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Tabla de precios especiales: cabe en el contenedor sin scroll horizontal */
.os-special-prices-table-container-wrap {
    max-width: 100%;
    margin-top: 15px;
}

/* Botón Agregar debajo de la tabla */
.os-special-prices-add-footer {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.os-special-prices-add-footer .lpda-add-special-price-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.os-special-prices-add-footer .lpda-add-special-price-btn:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.os-special-prices-add-footer .lpda-add-special-price-btn:active {
    transform: scale(0.98);
}

/* Ubicación bloqueada por precio especial en $0: gris, no clicable, mensaje encima */
.step-locations-w .os-selectable-item.lpda-zero-blocked {
    position: relative;
    filter: grayscale(1);
    opacity: 0.85;
    cursor: not-allowed;
}
.step-locations-w .os-selectable-item.lpda-zero-blocked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(120, 120, 120, 0.35);
    border-radius: inherit;
    pointer-events: none;
}
.step-locations-w .os-selectable-item.lpda-zero-blocked .lpda-zero-msg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    background: rgba(80, 80, 80, 0.88);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    line-height: 1.35;
    border-radius: inherit;
    pointer-events: none;
}

.os-special-prices-table-container {
    margin-top: 0;
    overflow: visible;
    max-width: 100%;
}

.os-special-prices-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 13px;
}

/* Columnas: servicio con m?s espacio, cabeceras cortas para que no se corten */
.os-special-prices-table th:nth-child(1),
.os-special-prices-table td:nth-child(1) {
    width: 40%;
    min-width: 0;
}
.os-special-prices-table th:nth-child(2),
.os-special-prices-table td:nth-child(2) {
    width: 22%;
    min-width: 0;
}
.os-special-prices-table th:nth-child(3),
.os-special-prices-table td:nth-child(3) {
    width: 22%;
    min-width: 0;
}
.os-special-prices-table th:nth-child(4),
.os-special-prices-table td:nth-child(4) {
    width: 16%;
    min-width: 0;
}

.os-special-prices-table thead {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.os-special-prices-table th {
    padding: 10px 10px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    vertical-align: middle;
}

.os-special-prices-table th.os-th-presencial,
.os-special-prices-table th.os-th-virtual {
    text-align: right;
}
.os-special-prices-table th.os-th-actions {
    text-align: center;
}

.os-special-prices-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

/* Servicio: una l?nea, ellipsis si es largo (title muestra nombre completo al pasar el rat?n) */
.os-special-prices-table td.os-td-service {
    overflow: hidden;
}
.os-special-prices-table td.os-td-service .os-service-name-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.os-special-prices-table tbody tr:hover {
    background-color: #f8fafc;
}

.os-special-prices-table td:nth-child(2) .os-price-value,
.os-special-prices-table td:nth-child(3) .os-price-value {
    display: block;
    text-align: right;
}
.os-special-prices-table .os-price-value {
    font-weight: 600;
    color: #059669;
    font-size: 13px;
    white-space: nowrap;
}

.os-special-prices-table td.os-actions {
    text-align: center;
}
.os-special-prices-table .os-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
}

.os-special-prices-table .os-actions .latepoint-btn {
    flex-shrink: 0;
    padding: 6px 8px;
    min-width: 0;
}

/* Mensaje cuando no hay precios especiales */
.os-no-special-prices {
    text-align: center;
    padding: 30px 20px;
    color: #64748b;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

.os-no-special-prices p {
    margin: 0;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .os-frontend-modal-content {
        width: 95%;
        margin: 20px;
        max-width: none;
    }
    
    .os-frontend-modal-header {
        padding: 15px 20px;
    }
    
    .os-frontend-modal-body {
        padding: 20px;
    }
    
    .os-form-actions {
        flex-direction: column;
    }
    
    .os-btn {
        width: 100%;
    }
    
    .os-special-prices-fab {
        bottom: 20px;
        right: 20px;
    }
    
    .os-fab-button {
        width: 50px;
        height: 50px;
    }
    
    .os-fab-button .dashicons {
        font-size: 20px;
        width: 20px;
        height: 20px;
    }
    
    /* Responsive para la secci??n de cliente */
    .os-special-prices-customer-section .os-form-sub-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .os-special-prices-table {
        font-size: 12px;
    }
    
    .os-special-prices-table th,
    .os-special-prices-table td {
        padding: 8px 6px;
    }
    
    .os-special-prices-table th:nth-child(1),
    .os-special-prices-table td:nth-child(1) { width: 38%; }
    .os-special-prices-table th:nth-child(2),
    .os-special-prices-table td:nth-child(2) { width: 22%; }
    .os-special-prices-table th:nth-child(3),
    .os-special-prices-table td:nth-child(3) { width: 22%; }
    .os-special-prices-table th:nth-child(4),
    .os-special-prices-table td:nth-child(4) { width: 18%; }
    
    .os-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .os-form-sub-header-actions {
        width: 100%;
    }
    
    .os-form-sub-header-actions .latepoint-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Responsive para la visualizaci??n del cliente */
    .os-current-user-display {
        padding: 12px 16px;
        min-height: 45px;
    }
    
    .os-user-name {
        font-size: 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .os-user-email {
        font-size: 12px;
    }
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.os-frontend-modal.show {
    animation: fadeInUp 0.3s ease-out;
}

/* Estados de carga */
.os-btn.loading {
    position: relative;
    color: transparent;
}

.os-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notificaciones del frontend */
.os-frontend-notice {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.os-frontend-notice.show {
    transform: translateX(0);
}

.os-frontend-notice.notice-success {
    background-color: #059669;
}

.os-frontend-notice.notice-error {
    background-color: #dc2626;
}

.modal-open {
    overflow: hidden;
}

.os-form-group input.error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

/* Debug: Asegurar que el modal sea visible */
#special-prices-frontend-modal {
    display: none;
}

#special-prices-frontend-modal.show {
    display: flex !important;
} 