/**
 * Estilos para sistema de cotizaciones
 * Reutiliza estilos de followups y añade específicos para modal
 */

/* ========================================
   MODAL DE COTIZACIONES
   ======================================== */

.quotation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.quotation-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.quotation-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.quotation-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.quotation-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.quotation-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.quotation-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.quotation-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.quotation-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.quotation-modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.quotation-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

body.quotation-modal-open {
    overflow: hidden;
}

/* ========================================
   FORMULARIO
   ======================================== */

.quotation-lead-info {
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.quotation-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.quotation-form-field {
    display: flex;
    flex-direction: column;
}

.quotation-form-field label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.quotation-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.quotation-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.quotation-input.error {
    border-color: #ef4444;
}

.quotation-input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ========================================
   SECCIÓN DE SERVICIOS
   ======================================== */

.quotation-services-section {
    margin: 24px 0;
}

.quotation-services-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.quotation-services-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.quotation-add-service-btn {
    padding: 8px 16px;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.quotation-add-service-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.quotation-services-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quotation-service-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #fafafa;
    transition: all 0.2s;
}

.quotation-service-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.service-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.service-item-number {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
}

.remove-service-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #ef4444;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.remove-service-btn:hover {
    background: #fee2e2;
}

.service-item-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-form-row {
    display: grid;
    gap: 12px;
}

.service-name-field {
    grid-column: 1 / -1;
}

.service-pricing-row {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.service-total-field {
    display: flex;
    flex-direction: column;
}

.service-total {
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    text-align: right;
}

/* ========================================
   TOTALES
   ======================================== */

.quotation-totals-section {
    margin: 24px 0;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.quotation-total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: #374151;
}

.quotation-total-row.quotation-grand-total {
    padding-top: 12px;
    margin-top: 8px;
    border-top: 2px solid #d1d5db;
    font-size: 18px;
    color: #111827;
}

/* ========================================
   BOTONES
   ======================================== */

.quotation-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.quotation-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.quotation-btn-primary {
    background: #3b82f6;
    color: #fff;
}

.quotation-btn-primary:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.quotation-btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.quotation-btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* ========================================
   HISTORIAL DE COTIZACIONES (reutiliza followups)
   ======================================== */

.quotation-entry-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.quotation-number {
    font-weight: 600;
    color: #111827;
    font-size: 15px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.status-draft {
    background: #f3f4f6;
    color: #6b7280;
}

.status-badge.status-sent {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.status-accepted {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.status-expired {
    background: #fef3c7;
    color: #92400e;
}

.quotation-items {
    margin: 12px 0;
}

.quotation-items-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.quotation-items-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quotation-item {
    padding: 6px 0;
    font-size: 14px;
    color: #4b5563;
}

.quotation-item::before {
    content: "•";
    color: #9ca3af;
    margin-right: 8px;
}

.item-discount {
    color: #10b981;
    font-size: 12px;
}

.quotation-totals {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.quotation-discount {
    color: #10b981;
}

.quotation-notes {
    margin-top: 16px;
    padding: 12px;
    background: #fef3c7;
    border-radius: 6px;
    border-left: 3px solid #f59e0b;
}

.quotation-notes-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 6px;
}

.quotation-notes-content {
    font-size: 14px;
    color: #78350f;
}

/* ========================================
   BADGE EN TABLA ADMIN
   ======================================== */

.quotation-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.quotation-badge.badge-pending {
    background: #f3f4f6;
    color: #6b7280;
}

.quotation-badge.badge-accepted {
    background: #d1fae5;
    color: #065f46;
}

.quotation-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .quotation-modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
    }

    .quotation-form-row {
        grid-template-columns: 1fr;
    }

    .service-pricing-row {
        grid-template-columns: 1fr 1fr;
    }

    .service-total-field {
        grid-column: 1 / -1;
    }

    .quotation-modal-footer {
        flex-direction: column-reverse;
    }

    .quotation-btn {
        width: 100%;
    }
}
