/**
 * ServiceQuoteBuilder Frontend Styles
 * Modern, responsive design for the quote builder interface
 */

/* Reset and base styles */
.sqb-quote-builder * {
    box-sizing: border-box;
}

.sqb-quote-builder {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Loading overlay */
.sqb-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
}

.sqb-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: sqb-spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes sqb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Step containers */
.sqb-step {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.sqb-step-active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.sqb-step-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
}

.sqb-step-header h3 {
    color: #1e293b;
    font-size: 28px;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.sqb-step-header p {
    color: #64748b;
    font-size: 16px;
    margin: 0;
}

/* Buttons */
.sqb-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    min-width: 120px;
    text-align: center;
}

.sqb-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sqb-btn-primary {
    background: #3b82f6;
    color: white;
}

.sqb-btn-primary:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
}

.sqb-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.sqb-btn-secondary:hover {
    background: #e2e8f0;
}

.sqb-btn-outline {
    background: transparent;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}

.sqb-btn-outline:hover {
    background: #3b82f6;
    color: white;
}

/* Step 1: Occurrence selection */
.sqb-occurrence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.sqb-occurrence-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.sqb-occurrence-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.sqb-occurrence-card.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.sqb-occurrence-header h4 {
    margin: 0 0 8px 0;
    color: #1e293b;
    font-size: 20px;
    font-weight: 600;
}

.sqb-occurrence-frequency {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.sqb-occurrence-card.selected .sqb-occurrence-frequency {
    background: #dbeafe;
    color: #1d4ed8;
}

.sqb-occurrence-description {
    margin-top: 12px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

/* Step 2: Option selection */
.sqb-option-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.sqb-option-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.sqb-option-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.sqb-option-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.sqb-option-card h4 {
    margin: 0 0 12px 0;
    color: #1e293b;
    font-size: 22px;
    font-weight: 600;
}

.sqb-option-card p {
    color: #64748b;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

/* Packages grid */
.sqb-packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.sqb-package-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    position: relative;
}

.sqb-package-card.featured {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.sqb-package-card.featured::before {
    content: 'Popular';
    position: absolute;
    top: -1px;
    right: 20px;
    background: #f59e0b;
    color: white;
    padding: 6px 16px;
    border-radius: 0 0 8px 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.sqb-package-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.sqb-package-card.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.sqb-package-header h4 {
    margin: 0 0 8px 0;
    color: #1e293b;
    font-size: 20px;
    font-weight: 600;
}

.sqb-package-price {
    font-size: 24px;
    font-weight: 700;
    color: #059669;
    margin-bottom: 12px;
}

.sqb-package-services {
    margin: 16px 0;
}

.sqb-package-services ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sqb-package-services li {
    padding: 6px 0;
    color: #475569;
    font-size: 14px;
    position: relative;
    padding-left: 20px;
}

.sqb-package-services li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #059669;
    font-weight: bold;
}

/* Custom builder layout */
.sqb-custom-builder {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.sqb-services-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 24px;
}

.sqb-selected-panel {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.sqb-selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.sqb-selected-header h4 {
    margin: 0;
    color: #1e293b;
    font-size: 18px;
    font-weight: 600;
}

#sqb-selected-count {
    background: #eff6ff;
    color: #1d4ed8;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Service categories */
.sqb-service-category {
    margin-bottom: 24px;
}

.sqb-category-header {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.sqb-category-header:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.sqb-category-header.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.sqb-category-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

.sqb-category-toggle {
    transition: transform 0.2s ease;
}

.sqb-category-header.active .sqb-category-toggle {
    transform: rotate(180deg);
}

.sqb-category-services {
    display: none;
    padding: 16px 0 0 0;
}

.sqb-category-header.active + .sqb-category-services {
    display: block;
}

/* Service items */
.sqb-service-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sqb-service-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.sqb-service-item.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.sqb-service-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.sqb-service-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 16px;
    margin: 0;
    flex: 1;
}

.sqb-service-price {
    font-weight: 700;
    color: #059669;
    font-size: 16px;
    white-space: nowrap;
    margin-left: 12px;
}

.sqb-service-price.quote {
    color: #dc2626;
    font-style: italic;
}

.sqb-service-description {
    color: #64748b;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.sqb-service-code {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
}

/* Selected services panel */
.sqb-selected-services {
    min-height: 200px;
}

.sqb-empty-selection {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.sqb-empty-selection p {
    margin: 0 0 8px 0;
}

.sqb-help-text {
    font-size: 14px;
    font-style: italic;
}

.sqb-selected-service {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sqb-selected-service-info {
    flex: 1;
}

.sqb-selected-service-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
    margin: 0 0 4px 0;
}

.sqb-selected-service-price {
    color: #059669;
    font-size: 14px;
    font-weight: 500;
}

.sqb-remove-service {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sqb-remove-service:hover {
    background: #dc2626;
    color: white;
}

/* Total section */
.sqb-total-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid #e2e8f0;
}

.sqb-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.sqb-total-final {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    margin-top: 12px;
}

/* Step actions */
.sqb-step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 2px solid #f1f5f9;
}

.sqb-step-actions .sqb-btn {
    margin: 0 8px;
}

/* Review step */
.sqb-review-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.sqb-review-section,
.sqb-contact-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 24px;
}

.sqb-review-section h4,
.sqb-contact-section h4 {
    margin: 0 0 20px 0;
    color: #1e293b;
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.sqb-review-services {
    margin-bottom: 20px;
}

.sqb-review-service {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sqb-review-service-info {
    flex: 1;
}

.sqb-review-service-name {
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.sqb-review-service-details {
    color: #64748b;
    font-size: 14px;
}

.sqb-review-service-price {
    font-weight: 700;
    color: #059669;
    font-size: 16px;
}

.sqb-review-total {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

/* Contact form */
.sqb-contact-form {
    margin: 0;
}

.sqb-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.sqb-form-group {
    margin-bottom: 16px;
}

.sqb-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.sqb-form-group input,
.sqb-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.sqb-form-group input:focus,
.sqb-form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.sqb-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Success step */
.sqb-success-message {
    text-align: center;
    padding: 60px 40px;
}

.sqb-success-icon {
    font-size: 72px;
    margin-bottom: 24px;
    animation: sqb-bounce 0.6s ease;
}

@keyframes sqb-bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    80% {
        transform: translateY(-10px);
    }
}

.sqb-success-message h3 {
    color: #059669;
    font-size: 32px;
    margin: 0 0 16px 0;
    font-weight: 700;
}

.sqb-success-message p {
    color: #64748b;
    font-size: 18px;
    margin: 0 0 32px 0;
    line-height: 1.6;
}

.sqb-success-actions {
    margin-top: 32px;
}

/* Error messages */
.sqb-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
}

.sqb-warning {
    background: #fffbeb;
    border: 1px solid #fed7aa;
    color: #d97706;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
}

.sqb-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
}

/* Form validation */
.sqb-form-group.error input,
.sqb-form-group.error textarea {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.sqb-field-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Responsive design */
@media (max-width: 768px) {
    .sqb-quote-builder {
        padding: 16px;
        margin: 16px;
    }
    
    .sqb-occurrence-grid {
        grid-template-columns: 1fr;
    }
    
    .sqb-option-selector {
        grid-template-columns: 1fr;
    }
    
    .sqb-packages-grid {
        grid-template-columns: 1fr;
    }
    
    .sqb-custom-builder {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sqb-selected-panel {
        position: static;
        order: -1;
    }
    
    .sqb-review-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sqb-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .sqb-step-actions {
        flex-direction: column-reverse;
        gap: 12px;
    }
    
    .sqb-step-actions .sqb-btn {
        width: 100%;
        margin: 0;
    }
    
    .sqb-step-header h3 {
        font-size: 24px;
    }
    
    .sqb-success-message {
        padding: 40px 20px;
    }
    
    .sqb-success-icon {
        font-size: 56px;
    }
    
    .sqb-success-message h3 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .sqb-quote-builder {
        margin: 8px;
        padding: 12px;
    }
    
    .sqb-step-header {
        margin-bottom: 20px;
    }
    
    .sqb-occurrence-card,
    .sqb-option-card,
    .sqb-package-card {
        padding: 16px;
    }
    
    .sqb-services-panel,
    .sqb-selected-panel,
    .sqb-review-section,
    .sqb-contact-section {
        padding: 16px;
    }
}

/* Animation utilities */
.sqb-fade-in {
    animation: sqb-fadeIn 0.3s ease;
}

@keyframes sqb-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sqb-pulse {
    animation: sqb-pulse 2s infinite;
}

@keyframes sqb-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Accessibility improvements */
.sqb-quote-builder *:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.sqb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Print styles */
@media print {
    .sqb-quote-builder {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .sqb-step-actions {
        display: none;
    }
    
    .sqb-btn {
        display: none;
    }
}