/**
 * SMW Assessment - Hero Form Styles
 *
 * Horizontal layout designed for hero sections
 * Theme-compatible with CSS custom properties
 */

/* CSS Custom Properties for easy theme customization */
.smw-hero-wrapper {
    --smw-hero-font-family: inherit;
    --smw-hero-input-bg: #ffffff;
    --smw-hero-input-border: #d1d5db;
    --smw-hero-input-focus-border: #3b82f6;
    --smw-hero-input-text: #1f2937;
    --smw-hero-input-placeholder: #9ca3af;
    --smw-hero-label-color: inherit;
    --smw-hero-button-bg: #2563eb;
    --smw-hero-button-hover-bg: #1d4ed8;
    --smw-hero-button-text: #ffffff;
    --smw-hero-error-color: #dc2626;
    --smw-hero-success-color: #16a34a;
    --smw-hero-terms-color: #6b7280;
    --smw-hero-border-radius: 6px;
    --smw-hero-spacing: 12px;
}

/* Main Wrapper */
.smw-hero-wrapper {
    font-family: var(--smw-hero-font-family);
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* Form Container */
.smw-hero-form {
    width: 100%;
}

/* Horizontal Fields Layout */
.smw-hero-fields {
    display: flex;
    flex-wrap: wrap;
    gap: var(--smw-hero-spacing);
    align-items: flex-end;
}

/* Field Groups */
.smw-hero-field {
    display: flex;
    flex-direction: column;
    position: relative;
}

.smw-hero-field-email,
.smw-hero-field-url {
    flex: 1;
    min-width: 200px;
}

.smw-hero-field-submit {
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 20px; /* Aligns button with inputs (accounts for error span height) */
}

/* Labels */
.smw-hero-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--smw-hero-label-color);
}

/* Inputs */
.smw-hero-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--smw-hero-input-text);
    background-color: var(--smw-hero-input-bg);
    border: 2px solid var(--smw-hero-input-border);
    border-radius: var(--smw-hero-border-radius);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.smw-hero-input::placeholder {
    color: var(--smw-hero-input-placeholder);
}

.smw-hero-input:focus {
    outline: none;
    border-color: var(--smw-hero-input-focus-border);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.smw-hero-input.smw-hero-input-error {
    border-color: var(--smw-hero-error-color);
}

.smw-hero-input.smw-hero-input-error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Error Messages */
.smw-hero-error {
    display: block;
    min-height: 20px;
    margin-top: 4px;
    font-size: 13px;
    color: var(--smw-hero-error-color);
}

/* Submit Button */
.smw-hero-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: var(--smw-hero-button-text);
    background-color: var(--smw-hero-button-bg);
    border: none;
    border-radius: var(--smw-hero-border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
    min-height: 48px;
}

.smw-hero-button:hover {
    background-color: var(--smw-hero-button-hover-bg);
}

.smw-hero-button:active {
    transform: scale(0.98);
}

.smw-hero-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Button Spinner */
.smw-hero-button-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.smw-spinner {
    width: 20px;
    height: 20px;
    animation: smw-spin 1s linear infinite;
}

.smw-spinner-circle {
    stroke-dasharray: 50;
    stroke-dashoffset: 20;
}

@keyframes smw-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Terms Text */
.smw-hero-terms {
    margin-top: var(--smw-hero-spacing);
    font-size: 13px;
    color: var(--smw-hero-terms-color);
    text-align: center;
}

/* Progress Section */
.smw-hero-progress {
    padding: 24px;
    text-align: center;
}

.smw-hero-progress-steps {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 16px;
}

.smw-hero-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.smw-hero-step.active {
    opacity: 1;
}

.smw-hero-step.completed {
    opacity: 1;
}

.smw-hero-step-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smw-hero-step-icon svg {
    width: 24px;
    height: 24px;
}

.smw-step-spinner {
    display: block;
    animation: smw-spin 1s linear infinite;
    color: var(--smw-hero-button-bg);
}

.smw-step-check {
    display: none;
    color: var(--smw-hero-success-color);
}

.smw-hero-step.completed .smw-step-spinner {
    display: none;
}

.smw-hero-step.completed .smw-step-check {
    display: block;
}

.smw-hero-step:not(.active):not(.completed) .smw-step-spinner {
    animation: none;
    opacity: 0.3;
}

.smw-hero-step-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--smw-hero-label-color);
}

.smw-hero-progress-message {
    font-size: 14px;
    color: var(--smw-hero-terms-color);
    margin: 0;
}

/* Recent Assessment Notice */
.smw-hero-recent-notice {
    padding: 16px;
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: var(--smw-hero-border-radius);
    text-align: center;
}

.smw-hero-recent-message {
    margin: 0;
    font-size: 14px;
    color: var(--smw-hero-input-text);
}

/* Error Box */
.smw-hero-error-box {
    padding: 12px 16px;
    background-color: rgba(220, 38, 38, 0.1);
    border: 1px solid var(--smw-hero-error-color);
    border-radius: var(--smw-hero-border-radius);
    margin-top: var(--smw-hero-spacing);
}

.smw-hero-error-box .smw-hero-error-message {
    color: var(--smw-hero-error-color);
    font-size: 14px;
}

/* Honeypot - visually hidden */
.smw-hp-field {
    position: absolute;
    left: -9999px;
    visibility: hidden;
}

/* Responsive - Stack on mobile */
@media (max-width: 768px) {
    .smw-hero-fields {
        flex-direction: column;
    }

    .smw-hero-field-email,
    .smw-hero-field-url {
        width: 100%;
        min-width: 100%;
    }

    .smw-hero-field-submit {
        width: 100%;
    }

    .smw-hero-button {
        width: 100%;
    }

    .smw-hero-progress-steps {
        gap: 16px;
    }

    .smw-hero-step-text {
        font-size: 12px;
    }
}

/* Dark theme support - uses CSS custom properties */
@media (prefers-color-scheme: dark) {
    .smw-hero-wrapper {
        --smw-hero-input-bg: #1f2937;
        --smw-hero-input-border: #374151;
        --smw-hero-input-text: #f9fafb;
        --smw-hero-input-placeholder: #6b7280;
    }
}

/* Divi compatibility - increase specificity */
.et_pb_section .smw-hero-wrapper,
.et_pb_module .smw-hero-wrapper {
    font-family: inherit;
}

.et_pb_section .smw-hero-input,
.et_pb_module .smw-hero-input {
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
}

.et_pb_section .smw-hero-button,
.et_pb_module .smw-hero-button {
    font-family: inherit;
}
