/**
 * Animation Addons AppSumo Connect - Styles
 * Modern, responsive styling inspired by TailwindCSS
 */

/* Reset and Base Styles */
.animationaddons-signup-form,
.animationaddons-login-form {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: #374151;
    box-sizing: border-box;
}

.animationaddons-signup-form *,
.animationaddons-login-form *,
.animationaddons-signup-form *::before,
.animationaddons-login-form *::before,
.animationaddons-signup-form *::after,
.animationaddons-login-form *::after {
    box-sizing: border-box;
}

/* Form Container */
.animationaddons-form-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 2.5rem 2.25rem;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
}

/* Form Title */
.animationaddons-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    text-align: center;
    margin: 0 0 1.75rem 0;
    line-height: 1.25;
}

/* Form Groups */
.animationaddons-form-group {
    margin: 0 0 1.125rem 0;
}

.animationaddons-form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Labels */
.animationaddons-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin: 0 0 0.5rem 0;
    line-height: 1.25;
}

.required {
    color: #dc2626;
    margin-left: 0.125rem;
}

/* Input Fields */
.animationaddons-form-input {
    width: 100%;
    height: 48px;
    margin: 0;
    font-family: inherit;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #111827;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.15s ease-in-out;
    outline: none;
}

.animationaddons-form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.animationaddons-form-input::placeholder {
    color: #9ca3af;
    opacity: 1;
}

/* Only flag errors after interaction (not on page load) */
.animationaddons-form-input.invalid,
.animationaddons-form-input:user-invalid {
    border-color: #dc2626;
}

.animationaddons-form-input.invalid:focus,
.animationaddons-form-input:user-invalid:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Two-column row (first / last name) */
.animationaddons-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

/* Input with icon */
.animationaddons-input-wrap {
    position: relative;
}

.animationaddons-input-wrap .animationaddons-form-input {
    padding-left: 2.75rem;
}

.animationaddons-input-wrap.has-toggle .animationaddons-form-input {
    padding-right: 2.75rem;
}

.animationaddons-input-icon {
    position: absolute;
    top: 50%;
    left: 0.95rem;
    transform: translateY(-50%);
    display: inline-flex;
    width: 1.125rem;
    height: 1.125rem;
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.15s ease-in-out;
}

.animationaddons-input-icon svg,
.animationaddons-password-toggle svg {
    width: 100%;
    height: 100%;
    display: block;
}

.animationaddons-input-wrap:focus-within .animationaddons-input-icon {
    color: #3b82f6;
}

.animationaddons-input-wrap:has(.invalid) .animationaddons-input-icon,
.animationaddons-input-wrap:has(:user-invalid) .animationaddons-input-icon {
    color: #dc2626;
}

/* Show / hide password */
.animationaddons-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.6rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0.4rem;
    margin: 0;
    color: #9ca3af;
    background: transparent;
    border: 0;
    border-radius: 0.375rem;
    box-shadow: none;
    cursor: pointer;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.animationaddons-password-toggle:hover,
.animationaddons-password-toggle:focus-visible {
    color: #374151;
    background-color: #f3f4f6;
    outline: none;
}

.animationaddons-password-toggle .icon-eye-off,
.animationaddons-password-toggle.is-visible .icon-eye {
    display: none;
}

.animationaddons-password-toggle.is-visible .icon-eye-off {
    display: block;
}

/* Help Text */
.animationaddons-form-help {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Checkbox */
.animationaddons-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin: 0;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.5;
}

.animationaddons-checkbox {
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
    accent-color: #3b82f6;
    flex-shrink: 0;
    margin-top: 0.1875rem;
}

.animationaddons-checkbox-text {
    color: #4b5563;
    line-height: 1.5;
}

/* Buttons */
.animationaddons-btn {
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    outline: none;
    position: relative;
    overflow: hidden;
}

.animationaddons-btn:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

.animationaddons-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.animationaddons-btn-primary {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.animationaddons-btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
    border-color: #2563eb;
}

.animationaddons-btn-primary:active:not(:disabled) {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

.animationaddons-btn-full {
    width: 100%;
    min-height: 48px;
    margin-top: 0.375rem;
}

/* Button Spinner */
.animationaddons-btn-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.animationaddons-spinner {
    width: 1rem;
    height: 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Links */
.animationaddons-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease-in-out;
}

.animationaddons-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.animationaddons-link-primary {
    color: #3b82f6;
}

.animationaddons-link-secondary {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Form Messages */
.animationaddons-form-message {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    margin-top: 1rem;
}

.animationaddons-form-message.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.animationaddons-form-message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Form Footer */
.animationaddons-form-footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f3f4f6;
    text-align: center;
}

.animationaddons-form-text {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.25;
}

/* Responsive Design */
@media (max-width: 640px) {
    .animationaddons-form-container {
        padding: 2rem 1.5rem;
    }
    
    .animationaddons-form-title {
        font-size: 1.375rem;
        margin-bottom: 1.5rem;
    }

    .animationaddons-form-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

@media (max-width: 420px) {
    .animationaddons-form-container {
        padding: 1.75rem 1.25rem;
        border-radius: 0.625rem;
    }

    .animationaddons-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading State */
.animationaddons-form.loading .animationaddons-btn-text {
    opacity: 0;
}

.animationaddons-form.loading .animationaddons-btn-spinner {
    display: inline-flex;
}

/* Focus Management */
.animationaddons-form-input:focus,
.animationaddons-checkbox:focus,
.animationaddons-btn:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .animationaddons-form-input {
        border-width: 2px;
    }
    
    .animationaddons-btn {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .animationaddons-form-input,
    .animationaddons-btn,
    .animationaddons-link {
        transition: none;
    }
    
    .animationaddons-spinner {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .animationaddons-signup-form,
    .animationaddons-login-form {
        display: none;
    }
}

/* Partner Connect page: Animation Addons watermark */
#appsumo-connect-page {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

#appsumo-connect-page::before,
#appsumo-connect-page::after {
    content: "";
    position: absolute;
    top: 50%;
    z-index: -1;
    width: clamp(220px, 24vw, 360px);
    aspect-ratio: 570 / 160;
    background: url("../images/animation-addons-logo.svg") center / contain no-repeat;
    opacity: 0.045;
    pointer-events: none;
}

#appsumo-connect-page::before {
    left: 3%;
    transform: translateY(-50%) rotate(-10deg);
}

#appsumo-connect-page::after {
    right: 3%;
    transform: translateY(-50%) rotate(10deg);
}

@media (max-width: 1024px) {
    #appsumo-connect-page::before {
        top: 6%;
        left: -40px;
        transform: rotate(-10deg);
    }

    #appsumo-connect-page::after {
        top: auto;
        bottom: 4%;
        right: -40px;
        transform: rotate(-10deg);
    }
}

@media (max-width: 640px) {
    #appsumo-connect-page {
        padding-top: 2rem;
    }

    #appsumo-connect-page::before,
    #appsumo-connect-page::after {
        display: none;
    }
}

/* Partner Connect page: hide header menu toggle for logged-out visitors */
body:not(.logged-in):has(#appsumo-connect-page) .wcs-header__toggle {
    display: none !important;
}
