/**
 * MW Editing Order Form Styles
 * Simplified, compact design for cohesive checkout experience
 *
 * @package MW_Editing_Orders
 */

/* ==========================================================================
   Base Form Wrapper
   ========================================================================== */

.mw-editing-form-wrapper {
    max-width: 640px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    color: #333;
}

/* ==========================================================================
   Notices
   ========================================================================== */

.mw-notice {
    padding: 0.875rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: 6px;
    text-align: center;
}

.mw-notice-demo {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.mw-notice-demo p {
    margin: 0;
    font-weight: 600;
    color: #856404;
    font-size: 0.9375rem;
}

/* ==========================================================================
   Header
   ========================================================================== */

.mw-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.mw-title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.5px;
}

.mw-subtitle {
    margin: 0;
    font-size: 1rem;
    color: #666;
    font-weight: 400;
}

/* ==========================================================================
   Form Sections
   ========================================================================== */

.mw-form-section {
    margin-bottom: 1.25rem;
}

.mw-form-section:last-child {
    margin-bottom: 0;
}

.mw-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 1rem;
    letter-spacing: -0.3px;
}

/* ==========================================================================
   Options Group (Services & Add-ons)
   ========================================================================== */

.mw-options-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.mw-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

/* Push price to the right */
.mw-option .mw-option-label {
    flex: 1;
}

.mw-option:hover {
    border-color: #666;
    background: #fafafa;
    transform: translateX(3px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.mw-option:has(.mw-option-input:checked) {
    border-color: #0066cc;
    background: #f0f7ff;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15), 0 0 0 3px rgba(0, 102, 204, 0.05);
}

.mw-option-input {
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    pointer-events: auto;
}

.mw-option-input[type="radio"],
.mw-option-input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0066cc;
}

.mw-option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mw-option-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}

.mw-option-label {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.4;
}

.mw-option-meta {
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.mw-option-description {
    font-size: 0.8125rem;
    color: #666;
    line-height: 1.4;
}

/* Disabled addons */
.mw-option.mw-addon-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mw-option.mw-addon-disabled:hover {
    border-color: #e0e0e0;
    background: #fff;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Form Groups
   ========================================================================== */

.mw-form-group {
    margin-bottom: 1rem;
}

.mw-form-group:last-child {
    margin-bottom: 0;
}

.mw-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    letter-spacing: -0.1px;
}

.mw-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    color: #1a1a1a;
    background: #fff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.mw-input:hover {
    border-color: #999;
}

.mw-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.mw-input::placeholder {
    color: #aaa;
}

textarea.mw-input {
    min-height: 100px;
    resize: vertical;
}

.mw-hint {
    display: block;
    font-size: 0.8125rem;
    color: #777;
    margin-top: 0.375rem;
    line-height: 1.4;
}

/* ==========================================================================
   File Upload
   ========================================================================== */

.mw-file-wrapper {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

.mw-file-wrapper:hover {
    border-color: #0066cc;
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.1);
}

.mw-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.mw-file-label {
    display: block;
    color: #666;
    font-size: 0.9375rem;
    font-weight: 500;
}

.mw-file-label.has-file {
    color: #1a1a1a;
    font-weight: 600;
}

/* ==========================================================================
   Quote Display
   ========================================================================== */

.mw-quote-section {
    padding: 1rem 0;
}

.mw-quote {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.mw-quote-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.mw-quote-breakdown {
    font-size: 0.8125rem;
    color: #666;
    line-height: 1.5;
}

.mw-quote-label {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
}

.mw-quote-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    transition: color 0.2s ease;
}

.mw-quote-amount.has-value {
    color: #28a745;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.mw-button {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.1px;
}
/* Terms Checkbox */
.mw-terms-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-bottom: 1rem;
    cursor: pointer;
}

.mw-terms-checkbox input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #0066cc;
}

.mw-terms-label {
    font-size: 0.9375rem;
    color: #495057;
    line-height: 1.5;
}

.mw-terms-label a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
}

.mw-terms-label a:hover {
    text-decoration: underline;
}
.mw-button-primary {
    background: #0066cc;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.2);
}

.mw-button-primary:hover:not([disabled]) {
    background: #0052a3;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
    transform: translateY(-1px);
}

.mw-button-primary:active:not([disabled]) {
    transform: translateY(0);
}

.mw-button-primary[disabled] {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* ==========================================================================
   Error Messages
   ========================================================================== */

.mw-errors {
    padding: 0.875rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.mw-error-message {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.875rem;
}

.mw-error-message p {
    margin: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.mw-footer {
    text-align: center;
    border-top: 1px solid #e8e8e8;
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.mw-footer-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.8125rem;
    color: #666;
}

.mw-icon {
    flex-shrink: 0;
    color: #28a745;
}

/* ==========================================================================
   Question Validation States
   ========================================================================== */

/* Question validation states */
.mw-question-error {
    display: none;
    color: #dc2626;
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    font-weight: 500;
}

.mw-question-invalid .mw-question-error {
    display: block;
}

.mw-question-invalid .mw-input {
    border-color: #dc2626;
    background: #fef2f2;
}

.mw-question-invalid .mw-option {
    border-color: #fecaca;
    background: #fef2f2;
}

/* Success message (shared across all forms) */
.mw-success,
.mw-questionnaire-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    padding: 1.5rem;
    text-align: center;
    color: #065f46;
}

.mw-success h3,
.mw-questionnaire-success h3 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: #065f46;
}

.mw-success p,
.mw-questionnaire-success p {
    margin: 0;
    font-size: 0.9375rem;
}

/* Error container (shared) */
.mw-questionnaire-errors,
.mw-questionnaire-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
}

.mw-questionnaire-errors p {
    margin: 0;
}

/* Order success page integration */
.mw-order-success-details {
    max-width: 640px;
    margin: 0 auto;
}

/* ==========================================================================
   Submit Section
   ========================================================================== */

.mw-submit-section {
    padding-top: 0.5rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
    .mw-editing-form-wrapper {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }
    
    .mw-form {
        padding: 1.25rem;
    }
    
    .mw-title {
        font-size: 1.5rem;
    }
    
    .mw-quote {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .mw-option {
        padding: 0.75rem 0.875rem;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .mw-option,
    .mw-input,
    .mw-file-wrapper,
    .mw-button,
    .mw-quote-amount {
        transition: none;
    }
}

.mw-option:focus-within {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.mw-file-wrapper:focus-within {
    border-color: #111;
    outline: 2px solid #111;
    outline-offset: 2px;
}

/* ==========================================================================
   Legacy/Compatibility Classes
   ========================================================================== */

.mw-addon-disabled .mw-option-input {
    pointer-events: none;
}

/* Legacy class for JavaScript compatibility */
.mw-addon-selected {
    border-color: #0066cc;
    background: #f0f7ff;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15), 0 0 0 3px rgba(0, 102, 204, 0.05);
}

/* ==========================================================================
   Questionnaire Completion Page (Standalone)
   ========================================================================== */

.mw-questionnaire-completion-wrapper {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.mw-questionnaire-completion-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.mw-questionnaire-completion-header h2 {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 600;
    color: #1a1a1a;
}

.mw-questionnaire-completion-header p {
    margin: 0;
    font-size: 1rem;
    color: #666;
}

/* ==========================================================================
   Modal Styles (for embedded checkout)
   ========================================================================== */

.mw-checkout-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
}

.mw-checkout-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.mw-checkout-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 100%;
    max-height: 90vh;
    margin: 5vh auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mw-checkout-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    color: #666;
    transition: all 0.2s ease;
    padding: 0;
}

.mw-checkout-close:hover:not(:disabled) {
    background: #f5f5f5;
    color: #333;
    border-color: #ccc;
}

.mw-checkout-close:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.mw-checkout-header {
    position: relative;
    padding: 15px;
    border-bottom: 1px solid #e8e8e8;
    background: #f9f9f9;
}

.mw-checkout-warning {
    margin: 0;
    font-size: 0.8rem;
    color: #999;
    font-weight: 500;
    line-height: 1.4;
    padding-right: 40px;
}

#mw-checkout-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ==========================================================================
   Questionnaire Modal & Forms
   ========================================================================== */

.mw-questionnaire-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.mw-questionnaire-modal.active {
    display: block;
}

.mw-questionnaire-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.mw-questionnaire-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    max-height: 90vh;
    width: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mw-questionnaire-header {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    flex-shrink: 0;
    position: relative;
}

.mw-questionnaire-header h3 {
    margin: 0 2rem 0.5rem 0;
    font-size: 1.25rem;
    color: #333;
}

.mw-questionnaire-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.mw-questionnaire-close:hover {
    color: #333;
}

.mw-questionnaire-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
}

.mw-questionnaire-footer {
    padding: 1rem 2rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

.mw-questionnaire-errors {
    margin: 1rem 2rem 0;
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    color: #dc2626;
}

/* Button loading states */
.mw-btn-loading {
    display: none;
}

.mw-button.is-loading .mw-btn-text {
    display: none;
}

.mw-button.is-loading .mw-btn-loading {
    display: inline;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .mw-checkout-content {
        max-width: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .mw-questionnaire-completion-wrapper {
        padding: 1.5rem 0.75rem;
    }
    
    .mw-questionnaire-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .mw-questionnaire-body {
        padding: 1rem;
    }
    
    .mw-questionnaire-footer {
        padding: 1rem;
        flex-direction: column;
    }
}
