/* ===================================
   Early Access Email Forms
   Following B2B SaaS best practices for conversion optimization
   =================================== */

/* Form Container */
.early-access-form {
    width: 100%;
    max-width: 520px;
    margin: 0;
}

/* Form Group - Horizontal Layout */
.early-access-form .form-group {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
}

/* Email Input Field */
.early-access-form .email-input {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    padding: 16px 20px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.early-access-form .email-input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.early-access-form .email-input:focus {
    border-color: var(--primary);
    background-color: var(--bg-tertiary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Only show invalid state after first submit attempt */
.early-access-form.has-attempted-submit .email-input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

/* Submit Button */
.early-access-form .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Success Message */
.form-success {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    color: #10b981;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

.form-success svg {
    flex-shrink: 0;
    stroke: #10b981;
}

/* Error Message */
.form-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

/* Secondary CTA Link (Schedule Demo) */
.cta-secondary-link {
    display: inline-block;
    margin-top: 16px;
    font-size: 15px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.cta-secondary-link:hover {
    color: var(--primary);
    transform: translateX(4px);
}

/* CTA Note (for bottom section) */
.cta-note {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
    opacity: 0.9;
}

.cta-note svg {
    vertical-align: middle;
    stroke: var(--primary);
}

/* Loading State */
.early-access-form.is-loading .email-input {
    opacity: 0.6;
    pointer-events: none;
}

.early-access-form.is-loading .btn {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.early-access-form.is-loading .btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Slide Down Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Spin Animation for Loading */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   Responsive Design - Mobile Optimization
   =================================== */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    .early-access-form .form-group {
        flex-direction: column;
        gap: 12px;
    }

    .early-access-form .email-input {
        width: 100%;
    }

    .early-access-form .btn {
        width: 100%;
        text-align: center;
    }

    .cta-secondary-link {
        display: block;
        text-align: center;
    }
}

/* Small mobile (480px) */
@media (max-width: 480px) {
    .early-access-form .email-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .early-access-form .btn-lg {
        padding: 14px 24px;
        font-size: 15px;
    }
}

/* ===================================
   Light Mode Adjustments
   =================================== */

.light-mode .early-access-form .email-input {
    background-color: var(--bg-primary);
    border-color: var(--border-primary);
    color: var(--text-primary);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.light-mode .early-access-form .email-input:focus {
    border-color: var(--primary);
    background-color: var(--bg-primary);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.light-mode .form-success {
    background-color: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.light-mode .form-error {
    background-color: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

.light-mode .cta-secondary-link {
    color: #6b7280;
}

.light-mode .cta-secondary-link:hover {
    color: var(--primary);
}

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

/* Focus visible for keyboard navigation */
.early-access-form .email-input:focus-visible {
    outline: none;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .early-access-form .email-input,
    .early-access-form .btn,
    .form-success,
    .form-error,
    .cta-secondary-link {
        transition: none;
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .early-access-form .email-input {
        border-width: 3px;
    }

    .form-success,
    .form-error {
        border-width: 2px;
    }
}
