/**
 * Frontend Styles for WySMart Connect B2B Extension
 * Designed to blend with Flatsome / WooCommerce themes
 */

/* B2B Welcome Message */
.wysmart-b2b-welcome {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border: 2px solid #007cba;
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 124, 186, 0.1);
}

.wysmart-b2b-welcome h3 {
    color: #007cba;
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
}

.wysmart-b2b-welcome p {
    margin: 5px 0;
    color: #333;
}

.wysmart-b2b-org-logo {
    max-height: 60px;
    margin: 0 10px 15px 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


/* ============================================
   EMBROIDERY OPTIONS - Flatsome-Compatible
   ============================================ */

/* Main container - blends with WooCommerce product form */
.wysmart-embroidery-options {
    border-top: 2px solid #eee;
    margin: 20px 0 8px;
    padding: 20px 0 0;
    background: transparent;
}

/* Header with toggle checkbox */
.wysmart-embroidery-header {
    margin-bottom: 0;
}

.wysmart-embroidery-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    font-weight: normal;
}

.wysmart-embroidery-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #333;
    flex-shrink: 0;
}

.wysmart-embroidery-toggle input[type="checkbox"]:disabled {
    cursor: default;
    opacity: 0.7;
}

.wysmart-embroidery-toggle-label {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.wysmart-embroidery-price-hint {
    font-weight: 400;
    color: #999;
    font-size: 13px;
    margin-left: 2px;
}

/* Required notice for B2B */
.wysmart-embroidery-required-notice {
    margin: 10px 0 0;
    padding: 8px 14px;
    background: #fff8e1;
    border-left: 3px solid #f9a825;
    color: #5d4037;
    font-size: 13px;
    border-radius: 0 4px 4px 0;
    line-height: 1.5;
}

/* Fields container - slides open */
.wysmart-embroidery-fields {
    padding: 20px 0 0;
}

/* Each field section */
.wysmart-embroidery-field {
    margin-bottom: 22px;
}

.wysmart-embroidery-field > label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #666;
    margin-bottom: 10px;
}


/* ---- Font Selector (Pill Style) ---- */
.wysmart-font-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.wysmart-font-option {
    display: inline-flex;
    align-items: center;
    padding: 9px 20px;
    border: 1px solid #ddd;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    background: #fff;
    transition: all 0.15s ease;
    line-height: 1.2;
    margin: 0;
    user-select: none;
}

.wysmart-font-option:hover {
    border-color: #aaa;
    color: #333;
    background: #fafafa;
}

/* Hide native radio inside pill */
.wysmart-font-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.wysmart-font-option.selected {
    background: #333;
    color: #fff;
    border-color: #333;
}

.wysmart-font-name {
    /* font-family is set inline by PHP */
}


/* ---- Placement Selector (Pill Style) ---- */
.wysmart-placement-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.wysmart-placement-option {
    display: inline-flex;
    align-items: center;
    padding: 9px 20px;
    border: 1px solid #ddd;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    background: #fff;
    transition: all 0.15s ease;
    line-height: 1.2;
    margin: 0;
    user-select: none;
}

.wysmart-placement-option:hover {
    border-color: #aaa;
    color: #333;
    background: #fafafa;
}

/* Hide native radio inside pill */
.wysmart-placement-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.wysmart-placement-option.selected {
    background: #333;
    color: #fff;
    border-color: #333;
}


/* ---- Color Swatches ---- */
.wysmart-color-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.wysmart-color-swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    padding: 0;
    position: relative;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    /* background-color set inline by PHP */
}

.wysmart-color-swatch:hover {
    transform: scale(1.15);
}

.wysmart-color-swatch.selected {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333;
    transform: scale(1.05);
}

.wysmart-color-swatch.selected::after {
    content: "\2713";
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}

/* Light colors need dark checkmark */
.wysmart-color-swatch[data-color="#FFFFFF"].selected::after,
.wysmart-color-swatch[data-color="#FFD700"].selected::after,
.wysmart-color-swatch[data-color="#ffffff"].selected::after,
.wysmart-color-swatch[data-color="#ffd700"].selected::after {
    color: #333;
    text-shadow: none;
}

/* White swatch needs visible border */
.wysmart-color-swatch[data-color="#FFFFFF"],
.wysmart-color-swatch[data-color="#ffffff"] {
    border-color: #ddd;
}

.wysmart-selected-color-name {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #888;
    font-style: italic;
}


/* ---- Text Line Inputs ---- */
.wysmart-text-line {
    margin-bottom: 10px;
}

.wysmart-text-line-input-wrap {
    position: relative;
}

.wysmart-embroidery-line-input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    color: #333;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.wysmart-embroidery-line-input:focus {
    border-color: #333;
    outline: none;
    box-shadow: 0 0 0 1px #333;
}

.wysmart-embroidery-line-input::placeholder {
    color: #bbb;
}

.wysmart-char-count {
    display: block;
    text-align: right;
    font-size: 11px;
    color: #bbb;
    margin-top: 3px;
}

.wysmart-char-count.limit-reached {
    color: #d32f2f;
    font-weight: 600;
}

.wysmart-remove-line {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    color: #bbb;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
    padding: 0;
}

.wysmart-remove-line:hover {
    color: #d32f2f;
    background: #fef2f2;
}

/* Add line link */
.wysmart-add-line {
    display: inline-block;
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
    font-size: 13px;
    padding: 6px 0;
    margin-top: 2px;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
    font-family: inherit;
}

.wysmart-add-line:hover {
    color: #333;
}


/* ---- Preview Area ---- */
.wysmart-embroidery-preview-area {
    margin-top: 20px;
}

.wysmart-embroidery-preview-area > label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #666;
    margin-bottom: 10px;
}

.wysmart-preview-box {
    background: #f5f5f5;
    border: 1px dashed #d0d0d0;
    border-radius: 6px;
    padding: 24px 16px;
    text-align: center;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s ease;
}

/* Logo placement section */
.wysmart-logo-placement-field {
    border-top: 1px solid #eee;
    padding-top: 14px;
    margin-top: 6px;
}

.wysmart-logo-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.wysmart-logo-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.wysmart-logo-placement-options {
    margin-top: 12px;
}

.wysmart-logo-placement-options .wysmart-embroidery-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #666;
    margin-bottom: 8px;
}

.wysmart-logo-placements {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* Logo placement pills - independent from text placement */
.wysmart-logo-placement-option {
    display: inline-flex;
    align-items: center;
    padding: 9px 20px;
    border: 1px solid #ddd;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    background: #fff;
    transition: all 0.15s ease;
    line-height: 1.2;
    margin: 0;
    user-select: none;
}

.wysmart-logo-placement-option:hover {
    border-color: #aaa;
    color: #333;
    background: #fafafa;
}

.wysmart-logo-placement-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.wysmart-logo-placement-option.selected {
    background: #333;
    color: #fff;
    border-color: #333;
}

.wysmart-logo-preview-thumb {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    display: inline-block;
}

.wysmart-logo-preview-thumb img {
    max-width: 100px;
    max-height: 40px;
    object-fit: contain;
    display: block;
}

/* Preview logo */
.wysmart-preview-logo {
    max-width: 120px;
    max-height: 50px;
    object-fit: contain;
    margin-bottom: 10px;
    opacity: 0.85;
}

.wysmart-preview-content {
    width: 100%;
}

.wysmart-preview-line {
    font-size: 22px;
    line-height: 1.5;
    margin-bottom: 2px;
}

.wysmart-preview-line:last-child {
    margin-bottom: 0;
}

.wysmart-preview-placeholder {
    font-size: 14px;
    color: #ccc;
    font-style: italic;
}

.wysmart-preview-placement {
    margin-top: 8px;
    font-size: 12px;
    color: #aaa;
    font-style: italic;
}


/* ---- Pricing Bar ---- */
.wysmart-embroidery-pricing {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #eee;
}

.wysmart-pricing-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.wysmart-pricing-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.wysmart-pricing-amount {
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.wysmart-pricing-note {
    font-size: 12px;
    color: #999;
    font-style: italic;
    width: 100%;
}


/* ============================================
   REGISTRATION FORM
   ============================================ */

.wysmart-registration-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.wysmart-org-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.wysmart-org-logo {
    max-height: 80px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wysmart-org-header h1 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
}

.wysmart-org-subtitle {
    color: #666;
    font-size: 18px;
    margin: 0;
    font-weight: 500;
}

.wysmart-registration-form-content {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border: 1px solid #e1e5e9;
}

/* Form Sections */
.wysmart-form-section {
    margin-bottom: 40px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 30px;
}

.wysmart-form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.wysmart-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #007cba;
}

/* Form Rows and Fields */
.wysmart-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.wysmart-form-field {
    flex: 1;
    margin-bottom: 20px;
}

.wysmart-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.wysmart-form-field input,
.wysmart-form-field select,
.wysmart-form-field textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
}

.wysmart-form-field input:focus,
.wysmart-form-field select:focus,
.wysmart-form-field textarea:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.required {
    color: #e74c3c;
    font-weight: bold;
}

/* Checkbox Labels */
.wysmart-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
}

.wysmart-checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Submit Section */
.wysmart-form-submit {
    text-align: center;
    padding-top: 20px;
}

.wysmart-submit-btn {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
}

.wysmart-submit-btn:hover {
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
    box-shadow: 0 6px 12px rgba(0, 124, 186, 0.4);
    transform: translateY(-2px);
}

.wysmart-submit-btn:active {
    transform: translateY(0);
}

.wysmart-form-note {
    margin-top: 15px;
    color: #666;
    font-style: italic;
    font-size: 14px;
}

.description {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    line-height: 1.4;
}

/* Messages */
.wysmart-form-messages {
    margin-top: 20px;
    text-align: center;
}

.wysmart-success-message {
    color: #155724;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
    font-weight: 500;
}

.wysmart-error-message {
    color: #721c24;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    font-weight: 500;
}

.wysmart-loading {
    color: #007cba;
    font-weight: 600;
    font-size: 16px;
}

/* Loading Animation */
.wysmart-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: wysmart-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes wysmart-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .wysmart-registration-container {
        padding: 0 15px;
    }

    .wysmart-registration-form-content {
        padding: 25px;
    }

    .wysmart-form-row {
        flex-direction: column;
        gap: 0;
    }

    .wysmart-b2b-welcome {
        padding: 20px;
        margin: 20px 0;
    }

    .wysmart-org-header {
        padding: 20px;
    }

    .wysmart-org-header h1 {
        font-size: 24px;
    }

    .wysmart-form-section h3 {
        font-size: 18px;
    }

    /* Embroidery responsive */
    .wysmart-font-options,
    .wysmart-placement-options,
    .wysmart-logo-placements {
        gap: 8px;
    }

    .wysmart-font-option,
    .wysmart-placement-option,
    .wysmart-logo-placement-option {
        padding: 8px 14px;
        font-size: 13px;
    }

    .wysmart-color-swatches {
        gap: 8px;
    }

    .wysmart-color-swatch {
        width: 30px;
        height: 30px;
    }

    .wysmart-preview-line {
        font-size: 18px;
    }

    .wysmart-pricing-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .wysmart-submit-btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }

    .wysmart-embroidery-toggle-label {
        font-size: 14px;
    }

    .wysmart-embroidery-price-hint {
        display: block;
        margin-left: 0;
        margin-top: 2px;
    }
}


/* ============================================
   PRINT
   ============================================ */

@media print {
    .wysmart-b2b-welcome,
    .wysmart-embroidery-options {
        box-shadow: none;
    }

    .wysmart-submit-btn,
    .wysmart-form-messages {
        display: none;
    }
}


/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .wysmart-font-option,
    .wysmart-placement-option,
    .wysmart-logo-placement-option,
    .wysmart-color-swatch,
    .wysmart-embroidery-line-input,
    .wysmart-submit-btn {
        transition: none;
    }

    .wysmart-loading::before {
        animation: none;
    }

    .wysmart-submit-btn:hover {
        transform: none;
    }

    .wysmart-color-swatch:hover,
    .wysmart-color-swatch.selected {
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .wysmart-embroidery-options {
        border-top-width: 3px;
    }

    .wysmart-font-option,
    .wysmart-placement-option,
    .wysmart-logo-placement-option {
        border-width: 2px;
    }

    .wysmart-embroidery-line-input {
        border-width: 2px;
    }

    .wysmart-submit-btn {
        border: 2px solid #000;
    }
}

/* Enforced embroidery header (always on, no toggle) */
.wysmart-embroidery-enforced {
    padding: 12px 0;
}

.wysmart-embroidery-enforced-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: block;
    margin-bottom: 4px;
}

.wysmart-embroidery-required-notice {
    font-size: 13px;
    color: #666;
    font-style: italic;
    margin: 4px 0 0;
}

/* Locked field styles (B2B group defaults) - single option visible, no interaction */
.wysmart-field-locked .wysmart-font-option,
.wysmart-field-locked .wysmart-placement-option,
.wysmart-field-locked .wysmart-color-swatch {
    cursor: default;
    pointer-events: none;
}

.wysmart-field-locked .wysmart-font-option.selected,
.wysmart-field-locked .wysmart-placement-option.selected {
    background: #333;
    color: #fff;
    border-color: #333;
}

.wysmart-locked-notice {
    display: inline-block;
    font-size: 12px;
    font-style: italic;
    color: #888;
    margin-top: 0;
    margin-left: 6px;
}

/* Locked text line styles */
.wysmart-line-locked .wysmart-embroidery-line-input {
    background: #f5f5f5;
    color: #555;
    cursor: not-allowed;
    border-color: #ddd;
}

.wysmart-line-locked .wysmart-remove-line {
    display: none;
}
