/* ============================================
   NESTPRO - Create Quotation Builder Styles
   ============================================ */

.cq-section {
    padding: 60px 0 80px;
    background: var(--bg-light, #f8f9fa);
}

.cq-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
}

/* Progress */
.cq-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
}

.cq-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.cq-step.active, .cq-step.completed { opacity: 1; }

.cq-step .step-num {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary, #E86A2A); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
}

.cq-step.completed .step-num { background: #28a745; }

.cq-step .step-label {
    font-size: 12px; font-weight: 600;
    color: var(--text-dark, #1a1a2e); white-space: nowrap;
}

.cq-line {
    width: 60px; height: 2px; background: #ddd;
    margin: 0 8px; margin-bottom: 22px;
}

/* Step Title */
.cq-step-title {
    font-size: 22px; font-weight: 700;
    color: var(--text-dark, #1a1a2e); margin-bottom: 24px;
}

.cq-step-desc {
    color: var(--text-muted, #6c757d);
    margin-bottom: 24px; font-size: 14px; margin-top: -16px;
}

/* Grid */
.cq-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.cq-field-full { grid-column: 1 / -1; }

.cq-field label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text-dark, #1a1a2e); margin-bottom: 6px;
}

.req { color: #e74c3c; }

.cq-field input, .cq-field select, .cq-field textarea {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid #e0e0e0; border-radius: 10px;
    font-size: 14px; font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: #fafafa;
}

.cq-field input:focus, .cq-field select:focus, .cq-field textarea:focus {
    outline: none; border-color: var(--primary, #E86A2A);
    box-shadow: 0 0 0 3px rgba(232, 106, 42, 0.1); background: #fff;
}

/* Services */
.cq-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.cq-service-card {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px; border: 1.5px solid #e0e0e0;
    border-radius: 10px; cursor: pointer;
    transition: all 0.2s ease; font-size: 14px; font-weight: 500;
}

.cq-service-card:hover {
    border-color: var(--primary, #E86A2A);
    background: rgba(232, 106, 42, 0.03);
}

.cq-service-card input:checked + .cq-service-name {
    color: var(--primary, #E86A2A); font-weight: 700;
}

.cq-service-card input:checked { accent-color: var(--primary, #E86A2A); }

/* Items Table */
.cq-items-table-wrap {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 16px;
}

.cq-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cq-items-table th {
    background: #f8f9fa;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-dark, #1a1a2e);
    border-bottom: 1px solid #e0e0e0;
}

.cq-items-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.cq-items-table input {
    width: 100%; padding: 8px 10px;
    border: 1px solid #e0e0e0; border-radius: 6px;
    font-size: 13px; font-family: inherit;
}

.cq-items-table input:focus {
    outline: none; border-color: var(--primary, #E86A2A);
}

.cq-items-table .cq-row-total {
    font-weight: 700; color: var(--text-dark, #1a1a2e);
    text-align: right; padding-right: 10px;
}

.cq-remove-btn {
    background: none; border: none; color: #e74c3c;
    cursor: pointer; font-size: 18px; padding: 4px 8px;
    border-radius: 4px; transition: background 0.2s;
}

.cq-remove-btn:hover { background: rgba(231, 76, 60, 0.1); }

.cq-add-item-btn {
    display: block; width: 100%; padding: 12px;
    background: #f8f9fa; border: 2px dashed #d0d0d0;
    border-radius: 10px; color: var(--primary, #E86A2A);
    font-weight: 600; font-size: 14px; cursor: pointer;
    transition: all 0.2s ease; margin-bottom: 24px;
}

.cq-add-item-btn:hover {
    border-color: var(--primary, #E86A2A);
    background: rgba(232, 106, 42, 0.03);
}

/* Totals */
.cq-totals-wrap {
    display: flex; justify-content: flex-end;
}

.cq-totals {
    width: 350px; background: #f8f9fa;
    border-radius: 12px; padding: 20px;
}

.cq-total-row {
    display: flex; justify-content: space-between;
    align-items: center; padding: 8px 0;
    font-size: 14px;
}

.cq-total-input {
    width: 80px; padding: 6px 10px;
    border: 1px solid #ddd; border-radius: 6px;
    font-size: 13px; text-align: right;
}

.cq-grand-total {
    border-top: 2px solid var(--primary, #E86A2A);
    margin-top: 8px; padding-top: 12px;
    font-size: 18px; font-weight: 800;
    color: var(--primary, #E86A2A);
}

/* Navigation */
.cq-nav {
    display: flex; justify-content: space-between;
    align-items: center; margin-top: 30px;
    padding-top: 20px; border-top: 1px solid #eee;
}

/* Preview */
.cq-preview {
    border: 1px solid #e0e0e0; border-radius: 12px;
    padding: 30px; margin-bottom: 20px;
    background: #fff;
}

.cq-preview-header {
    display: flex; align-items: center; gap: 20px;
    padding-bottom: 20px; border-bottom: 2px solid var(--primary, #E86A2A);
    margin-bottom: 24px;
}

.cq-preview-logo { height: 60px; width: auto; }

.cq-preview-logo-text {
    font-size: 28px; font-weight: 800;
}

.cq-preview-company strong {
    font-size: 18px; display: block; margin-bottom: 4px;
}

.cq-preview-company p {
    font-size: 12px; color: #666; margin: 2px 0;
}

.cq-preview-info {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; margin-bottom: 24px;
    padding: 16px; background: #f8f9fa; border-radius: 10px;
}

.cq-preview-info-item { font-size: 13px; }
.cq-preview-info-item .label { color: #999; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.cq-preview-info-item .value { font-weight: 600; color: #1a1a2e; }

.cq-preview-items { margin-bottom: 24px; }

.cq-preview-items table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}

.cq-preview-items th {
    background: var(--primary, #E86A2A); color: #fff;
    padding: 10px 12px; text-align: left; font-size: 12px;
}

.cq-preview-items td {
    padding: 10px 12px; border-bottom: 1px solid #eee;
}

.cq-preview-totals {
    display: flex; justify-content: flex-end; margin-bottom: 20px;
}

.cq-preview-totals-table {
    width: 300px;
}

.cq-preview-totals-table .row {
    display: flex; justify-content: space-between;
    padding: 6px 0; font-size: 14px;
}

.cq-preview-totals-table .grand {
    border-top: 2px solid var(--primary, #E86A2A);
    padding-top: 10px; margin-top: 6px;
    font-weight: 800; font-size: 16px;
    color: var(--primary, #E86A2A);
}

.cq-preview-terms {
    padding: 16px; background: #f8f9fa;
    border-radius: 10px; font-size: 12px;
    color: #666; line-height: 1.8;
}

.cq-preview-terms h4 {
    font-size: 14px; margin-bottom: 8px; color: #333;
}

.cq-preview-actions {
    display: flex; gap: 10px;
}

.cq-preview-nav {
    flex-wrap: wrap; gap: 12px;
}

/* Success */
.cq-success {
    text-align: center; padding: 50px 20px;
}

.cq-success-icon {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: #fff; font-size: 40px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 24px;
    animation: cqScaleIn 0.5s ease;
}

@keyframes cqScaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.cq-success h2 { font-size: 28px; margin-bottom: 10px; }
.cq-success p { color: var(--text-muted, #6c757d); font-size: 15px; margin-bottom: 6px; }

.cq-ref-number {
    background: #f0f7ff; border: 1px solid #d0e3ff;
    border-radius: 10px; padding: 16px 30px;
    display: inline-block; margin: 20px 0 30px;
}

.cq-ref-number span {
    display: block; font-size: 12px; color: #6c757d;
    text-transform: uppercase; letter-spacing: 1px;
}

.cq-ref-number strong {
    font-size: 22px; color: var(--primary, #E86A2A); font-weight: 800;
}

/* ============================================
   Autocomplete Dropdown for Item Name
   ============================================ */
.cq-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 280px;
    overflow-y: auto;
    margin-top: 4px;
}

.cq-autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}

.cq-autocomplete-item:hover {
    background: #f0f7ff;
}

.cq-autocomplete-item:last-child {
    border-bottom: none;
}

.cq-ac-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.cq-ac-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.cq-ac-price {
    font-size: 12px;
    color: #0066cc;
    font-weight: 600;
    white-space: nowrap;
}

.cq-ac-desc {
    font-size: 12px;
    color: #666;
    margin-top: 3px;
    line-height: 1.3;
}

.cq-ac-cat {
    display: inline-block;
    font-size: 10px;
    color: #888;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}

.cq-autocomplete-empty {
    padding: 14px;
    text-align: center;
    color: #999;
    font-size: 13px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .cq-wrapper { padding: 24px 18px; }
    .cq-grid { grid-template-columns: 1fr; }
    .cq-services-grid { grid-template-columns: 1fr 1fr; }
    .cq-totals { width: 100%; }
    .cq-preview-info { grid-template-columns: 1fr; }
    .cq-preview-actions { flex-wrap: wrap; }
    .cq-nav { flex-direction: column; gap: 12px; }
    .cq-nav .btn { width: 100%; text-align: center; }
    .cq-autocomplete-dropdown {
        position: fixed;
        left: 10px;
        right: 10px;
        top: auto;
        max-height: 50vh;
    }
}

@media (max-width: 480px) {
    .cq-services-grid { grid-template-columns: 1fr; }
    .cq-step-title { font-size: 18px; }
}
