/**
 * Frontend Styles for WooCommerce Sliding Door Quote
 */

/* Quote Button Container */
.wc-sdq-quote-button-container {
    margin: 15px 0;
}

.wc-sdq-quote-button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wc-sdq-quote-button:hover {
    background: #005a87;
    color: white;
}

/* Modal Styles */
.wc-sdq-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.wc-sdq-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.wc-sdq-modal-content {
    position: relative !important;
    background: white !important;
    border-radius: 8px !important;
    max-width: 600px !important;
    width: 90% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
    z-index: 1000000 !important;
}

.wc-sdq-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e1e8ed;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.wc-sdq-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.wc-sdq-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.wc-sdq-modal-close:hover {
    background: #e9ecef;
    color: #333;
}

/* Modal hidden by default */
.wc-sdq-modal[style*="display: none"] {
    display: none !important;
}

body.wc-sdq-modal-open {
    overflow: hidden;
}

/* Variation Error Styles */
.wc-sdq-variation-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 14px;
}

/* Main Container */
.wc-sdq-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Product Page Integration */
.wc-sdq-product-form-container {
    padding: 20px;
    font-family: inherit;
}

.wc-sdq-customer-details-section .wc-sdq-section-title {
    font-size: 22px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 10px 0;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.wc-sdq-section-description {
    color: #666;
    margin-bottom: 12px;
    font-size: 14px;
}

.wc-sdq-customer-fields {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-bottom: 12px;
}

.wc-sdq-request-quote-btn {
    width: 100%;
    font-size: 16px;
    padding: 15px 30px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wc-sdq-variation-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* Loading Overlay */
.wc-sdq-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.wc-sdq-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: wc-sdq-spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes wc-sdq-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form Sections */
.wc-sdq-section {
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wc-sdq-section-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

/* Form Validation */
.wc-sdq-field-invalid {
    border-color: #dc3545 !important;
}

.wc-sdq-field-error {
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
    display: block;
}

/* Address Display */
.wc-sdq-address-display {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #333;
}

.wc-sdq-address-placeholder {
    color: #999;
    font-style: italic;
}

.wc-sdq-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    margin-right: 12px;
}

.wc-sdq-subsection-title {
    font-size: 16px;
    font-weight: 600;
    color: #34495e;
    margin: 20px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #ecf0f1;
}

/* Form Fields */
.wc-sdq-field-group {
    margin-bottom: 12px;
    width: 100%;
}

.wc-sdq-field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.wc-sdq-address-error {
    width: 100%;
    order: 999;
}
.wc-sdq-field-half {
    flex: 1;
}

.wc-sdq-field-third {
    flex: 0 0 calc(33.333% - 10px);
}

.wc-sdq-field-third .wc-sdq-button {
    margin-top: 25px; /* Align with input fields that have labels */
}

.wc-sdq-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 14px;
}

.wc-sdq-label .required {
    color: #e74c3c;
    margin-left: 2px;
}

.wc-sdq-input,
.wc-sdq-select,
.wc-sdq-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e1e8ed;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
    box-sizing: border-box;
    height: 36px;
}

/* Inline form specific adjustments */
.wc-sdq-inline-form .wc-sdq-attr {
    width: 100%;
    margin-bottom: 10px;
    border-width: 2px;
}

.wc-sdq-inline-form .wc-sdq-attr-group {
    width: 100%;
}

.wc-sdq-inline-form .wc-sdq-config-fields .wc-sdq-input,
.wc-sdq-inline-form .wc-sdq-config-fields .wc-sdq-attr {
    border: 2px solid #000;
    border-radius: 0;
}

/* Align attribute labels to the left of dropdowns */
.wc-sdq-inline-form .wc-sdq-attr-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-sdq-inline-form .wc-sdq-attr-label {
    flex: 0 0 140px;
    font-weight: 600;
    color: #2c3e50;
}

.wc-sdq-inline-form .wc-sdq-attr-group .wc-sdq-attr {
    flex: 1 1 auto;
}

/* Border around inline form */
.wc-sdq-inline-form {
    border: 1px solid #000;
    border-radius: 0;
    padding: 12px;
}

.wc-sdq-input:focus,
.wc-sdq-select:focus,
.wc-sdq-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Invalid styling only applies after form submission */
.wc-sdq-form.wc-sdq-validated .wc-sdq-input:invalid,
.wc-sdq-form.wc-sdq-validated .wc-sdq-select:invalid,
.wc-sdq-form.wc-sdq-validated .wc-sdq-textarea:invalid {
    border-color: #e74c3c;
}

.wc-sdq-textarea {
    resize: vertical;
    min-height: 70px;
    height: auto;
}

/* Product Details */
.wc-sdq-product-details {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.wc-sdq-product-image {
    flex-shrink: 0;
}

.wc-sdq-product-image img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wc-sdq-product-info h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #2c3e50;
}

/* Variation Fields */
.wc-sdq-variation-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* Price Display */
.wc-sdq-price-display {
    background: none;
    border: none;
    padding: 0;
    margin-top: 12px;
}

.wc-sdq-price-box {
    background: none;
    border: none;
    padding: 0;
}

.wc-sdq-inline-form .wc-sdq-price-text {
    color: inherit;
}

.wc-sdq-inline-form .wc-sdq-price-text.is-notice {
    color: #c00;
    font-size: 16px;
}

.wc-sdq-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.wc-sdq-price-row:last-child {
    border-bottom: none;
}

.wc-sdq-total-row {
    font-size: 18px;
    font-weight: bold;
    color: #27ae60;
    border-top: 2px solid #27ae60;
    margin-top: 10px;
    padding-top: 15px;
}

.wc-sdq-price-label {
    font-weight: 600;
    color: #495057;
}

.wc-sdq-price-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Buttons */
.wc-sdq-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 40px;
    box-sizing: border-box;
}

.wc-sdq-button-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.wc-sdq-button-primary:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.4);
    transform: translateY(-1px);
}

.wc-sdq-button-secondary {
    background: #6c757d;
    color: white;
}

.wc-sdq-button-secondary:hover {
    background: #545b62;
}

.wc-sdq-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.wc-sdq-button-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: wc-sdq-spin 1s linear infinite;
    margin-left: 8px;
}

/* Messages */
.wc-sdq-messages {
    margin-top: 20px;
}

/* Modal specific message styles */
.wc-sdq-modal .wc-sdq-messages {
    margin-top: 0;
    padding: 20px;
}

.wc-sdq-modal .wc-sdq-message {
    margin-bottom: 0;
}

.wc-sdq-message {
    display: flex;
    align-items: flex-start;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wc-sdq-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #c3e6cb;
    color: #155724;
}

.wc-sdq-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.wc-sdq-message-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    font-size: 16px;
}

.wc-sdq-success .wc-sdq-message-icon {
    background: #28a745;
    color: white;
}

.wc-sdq-error .wc-sdq-message-icon {
    background: #dc3545;
    color: white;
}

.wc-sdq-message-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.wc-sdq-message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Inline form loader */
.wc-sdq-inline-form .wc-sdq-inline-loader {
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid #e1e8ed;
    background: #f8f9fa;
    color: #333;
    border-radius: 4px;
    font-size: 14px;
}

/* Privacy Notice */
.wc-sdq-privacy-notice {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.wc-sdq-small-text {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
    line-height: 1.4;
}

/* Address Section */
.wc-sdq-address-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wc-sdq-form-container {
        padding: 15px;
    }
    
    .wc-sdq-section {
        padding: 20px;
    }
    
    .wc-sdq-field-row {
        flex-direction: column;
        gap: 0;
    }
    
    .wc-sdq-product-details {
        flex-direction: column;
        text-align: center;
    }
    
    .wc-sdq-variation-fields {
        grid-template-columns: 1fr;
    }
    
    .wc-sdq-section-title {
        font-size: 18px;
    }
    
    .wc-sdq-step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    /* Modal responsive styles */
    .wc-sdq-modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
    }
    
    .wc-sdq-modal-header {
        padding: 15px 20px;
    }
    
    .wc-sdq-modal-header h3 {
        font-size: 18px;
    }
    
    .wc-sdq-product-form-container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .wc-sdq-form-container {
        padding: 10px;
    }
    
    .wc-sdq-section {
        padding: 15px;
    }
    
    .wc-sdq-input,
    .wc-sdq-select,
    .wc-sdq-textarea {
        padding: 10px 12px;
    }
    
    .wc-sdq-button {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* Animation for smooth transitions */
.wc-sdq-section {
    opacity: 0;
    transform: translateY(20px);
    animation: wc-sdq-fadeInUp 0.6s ease forwards;
}

@keyframes wc-sdq-fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus states for accessibility */
.wc-sdq-button:focus,
.wc-sdq-input:focus,
.wc-sdq-select:focus,
.wc-sdq-textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wc-sdq-section {
        border-width: 2px;
    }
    
    .wc-sdq-input,
    .wc-sdq-select,
    .wc-sdq-textarea {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .wc-sdq-spinner,
    .wc-sdq-button-spinner {
        animation: none;
    }
    
    .wc-sdq-section {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    * {
        transition: none !important;
    }
}
