/* ============================================================
   ai-email-generator.css
   Scoped styles for /ai-email-generator.php
   Does NOT override global.css
   ============================================================ */

/* ── Hero ──────────────────────────────────────────────────── */
.aew-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 60%, #6366f1 100%);
    padding: 72px 0 80px;
    text-align: center;
    color: #fff;
}

.aew-hero__orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.aew-orb {
    position: absolute;
    border-radius: 50%;
    opacity: 0.18;
    animation: orbFloat 8s ease-in-out infinite alternate;
}

.aew-orb--1 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, #ff8a65, transparent 70%);
    top: -120px;
    left: -80px;
}

.aew-orb--2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #f472b6, transparent 70%);
    bottom: -100px;
    right: -60px;
    animation-delay: -4s;
}

@keyframes orbFloat {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(20px, -20px) scale(1.06);
    }
}

.aew-hero__inner {
    position: relative;
    z-index: 1;
}

.aew-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-full);
    padding: 6px 18px;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--space-5);
}

.aew-hero__title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 3.8rem);
    font-weight: var(--weight-black);
    color: #fff;
    line-height: 1.1;
    margin-bottom: var(--space-5);
}

.aew-hero__title .highlight {
    background: linear-gradient(90deg, #fde68a, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.aew-hero__subtitle {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: rgba(255, 255, 255, 0.88);
    max-width: 600px;
    margin: 0 auto var(--space-6);
    line-height: 1.65;
}

/* Usage badge */
.aew-usage-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    padding: 7px 18px;
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.92);
    font-weight: var(--weight-medium);
}

.aew-usage-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fcd34d;
    display: inline-block;
    animation: pulse 1.8s ease-in-out infinite;
}

.aew-usage-dot--green {
    background: #34d399;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.85);
    }
}

/* ── Tool Card ──────────────────────────────────────────────── */
.aew-tool {
    padding: 60px 0 48px;
    background: var(--color-bg);
}

.aew-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border-light);
    padding: 40px;
    max-width: 860px;
    margin: 0 auto;
}

/* Input area */
.aew-input-area {
    margin-bottom: var(--space-6);
}

.aew-label {
    display: block;
    font-weight: var(--weight-semibold);
    font-size: var(--text-base);
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
}

.aew-input-wrap {
    position: relative;
    width: 100%;
    margin-bottom: var(--space-4);
}

.aew-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 16px;
    color: var(--color-text-muted);
}

.aew-input {
    width: 100%;
    height: 54px;
    padding: 0 var(--space-5) 0 44px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    color: var(--color-text-primary);
    background: var(--color-surface);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    outline: none;
    box-sizing: border-box;
}

.aew-input--full {
    padding: 0 var(--space-5);
}

.aew-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.aew-input::placeholder {
    color: var(--color-text-muted);
}

/* Options row */
.aew-options-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.aew-option-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.aew-option-label {
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
    color: var(--color-text-primary);
}

.aew-select {
    height: 48px;
    padding: 0 36px 0 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    color: var(--color-text-primary);
    background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    outline: none;
    width: 100%;
}

.aew-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

/* Generate button */
.aew-generate-btn {
    height: 54px;
    padding: 0 28px;
    flex-shrink: 0;
    white-space: nowrap;
}

.aew-generate-btn--full {
    width: 100%;
    height: 52px;
    border-radius: var(--radius-md);
}

.aew-btn-text,
.aew-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Ensure [hidden] always hides — overrides any display rule above */
.aew-generate-btn [hidden] {
    display: none !important;
}

.aew-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.aew-input-hint {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* ── Error / alerts ────────────────────────────────────────── */
.aew-error-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    color: #dc2626;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-5);
}

/* ── Signup CTA (limit reached) ────────────────────────────── */
.aew-signup-cta {
    text-align: center;
    padding: 40px var(--space-6);
    background: linear-gradient(135deg, #fff5f5 0%, #fff0f0 100%);
    border-radius: var(--radius-lg);
    border: 2px dashed #fca5a5;
    margin-top: var(--space-6);
}

.aew-signup-cta__icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
}

.aew-signup-cta h3 {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    margin-bottom: var(--space-3);
    color: var(--color-text-primary);
}

.aew-signup-cta p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
    max-width: 420px;
    margin-inline: auto;
}

.aew-login-link {
    display: block;
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    text-decoration: underline;
}

.aew-login-link:hover {
    color: var(--color-primary);
}

/* ── Results ───────────────────────────────────────────────── */
.aew-results {
    margin-top: var(--space-8);
    animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aew-results__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-6);
}

.aew-results__title {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--color-text-primary);
}

.aew-results__count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(229, 45, 39, 0.1);
    color: #e52d27;
    border-radius: var(--radius-full);
    padding: 4px 14px;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
}

/* Topics grid */
.aew-topics-grid {
    display: grid;
    gap: var(--space-4);
}

/* Topic card */
.aew-topic-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
    animation: fadeUp 0.35s ease both;
}

.aew-topic-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.aew-topic-card__num {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    color: #fff;
    margin-top: 2px;
}

.aew-topic-card__text {
    flex: 1;
    min-width: 0;
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: var(--color-text-primary);
    line-height: 1.5;
}

.aew-topic-card__copy {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
    background: transparent;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.aew-topic-card__copy:hover {
    border-color: #e52d27;
    color: #e52d27;
    background: rgba(229, 45, 39, 0.06);
}

.aew-topic-card__copy.copied {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(16, 185, 129, 0.08);
}

/* Staggered animation delay */
.aew-topic-card:nth-child(1) {
    animation-delay: 0.02s;
}

.aew-topic-card:nth-child(2) {
    animation-delay: 0.05s;
}

.aew-topic-card:nth-child(3) {
    animation-delay: 0.08s;
}

.aew-topic-card:nth-child(4) {
    animation-delay: 0.11s;
}

.aew-topic-card:nth-child(5) {
    animation-delay: 0.14s;
}

.aew-topic-card:nth-child(6) {
    animation-delay: 0.17s;
}

.aew-topic-card:nth-child(7) {
    animation-delay: 0.20s;
}

.aew-topic-card:nth-child(8) {
    animation-delay: 0.23s;
}

.aew-topic-card:nth-child(9) {
    animation-delay: 0.26s;
}

.aew-topic-card:nth-child(10) {
    animation-delay: 0.29s;
}

/* ── Info row ───────────────────────────────────────────────── */
.aew-info-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
    max-width: 860px;
    margin: var(--space-10) auto 0;
}

.aew-info-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    padding: var(--space-6);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.aew-info-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}

.aew-info-card__icon {
    font-size: 2rem;
    margin-bottom: var(--space-3);
}

.aew-info-card h3 {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-2);
}

.aew-info-card p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* ── How it works ──────────────────────────────────────────── */
.aew-how {
    padding: 60px 0 80px;
    background: var(--color-surface-alt);
    text-align: center;
}

.aew-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-10);
    flex-wrap: wrap;
}

.aew-step {
    flex: 1;
    min-width: 180px;
    max-width: 240px;
}

.aew-step__num {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    font-size: var(--text-xl);
    font-weight: var(--weight-extrabold);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.aew-step h3 {
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    margin-bottom: var(--space-2);
}

.aew-step p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.aew-step__arrow {
    font-size: 1.5rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .aew-card {
        padding: 28px 20px;
    }

    .aew-options-row {
        grid-template-columns: 1fr;
    }

    .aew-info-row {
        grid-template-columns: 1fr;
    }

    .aew-step__arrow {
        display: none;
    }

    .aew-results__header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .aew-hero {
        padding: 52px 0 60px;
    }

    .aew-topic-card {
        flex-wrap: wrap;
    }

    .aew-topic-card__copy {
        width: 100%;
        justify-content: center;
    }
}

/* ── FAQ Section ─────────────────────────────────────────────── */
.aew-faq {
    padding: 72px 0 88px;
    background: white;
}

.aew-faq .section-label {
    display: block;
    text-align: center;
    margin-bottom: var(--space-3);
}

.aew-faq .section-title {
    text-align: center;
    margin-bottom: var(--space-12);
}

.aew-faq__list {
    max-width: 760px;
    margin: 0 auto;
}

/* Each FAQ item */
.aew-faq__item {
    border-top: 1px solid var(--color-border);
}

.aew-faq__item:last-child {
    border-bottom: 1px solid var(--color-border);
}

/* Question button */
.aew-faq__question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    padding: 22px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    gap: var(--space-4);
    transition: color var(--transition-fast);
}

.aew-faq__question:hover {
    color: var(--color-primary);
}

/* Chevron icon */
.aew-faq__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: var(--color-text-muted);
    transition: transform var(--transition-base), color var(--transition-fast);
}

.aew-faq__item--open .aew-faq__icon {
    transform: rotate(0deg);
    color: var(--color-primary);
}

/* closed state: icon points down */
.aew-faq__item:not(.aew-faq__item--open) .aew-faq__icon {
    transform: rotate(180deg);
}

/* Answer panel */
.aew-faq__answer {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease, padding 0.25s ease;
    padding-bottom: 0;
}

.aew-faq__item--open .aew-faq__answer {
    max-height: 400px;
    padding-bottom: 22px;
}

.aew-faq__answer p {
    font-size: var(--text-sm);
    color: #4f5b8b;
    line-height: 1.75;
    margin: 0;
}

.aew-faq__answer strong {
    color: var(--color-primary);
    font-weight: var(--weight-semibold);
}

@media (max-width: 768px) {
    .aew-faq {
        padding: 52px 0 64px;
    }

    .aew-faq__question {
        font-size: var(--text-sm);
        padding: 18px 0;
    }
}

/* ── Explore Tools Section ────────────────────────────────── */
.aew-explore {
    padding: 80px 0 100px;
    background: #f8fafc;
}

.aew-explore__header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 50px;
}

.aew-explore__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Card Styling */
.aew-explore__card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border: 1.5px solid #edf2f7;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.aew-explore__card:hover {
    transform: translateY(-3px);
    border-color: var(--color-primary);
    box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.12);
}

.aew-explore__icon {
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.aew-explore__card:hover .aew-explore__icon {
    color: var(--color-primary);
}

.aew-explore__icon svg {
    width: 22px;
    height: 22px;
}

.aew-explore__name {
    font-size: 14.5px;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aew-explore__card:hover .aew-explore__name {
    color: var(--color-primary);
}

/* Responsive Grid */
@media (max-width: 1200px) {
    .aew-explore__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .aew-explore__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 540px) {
    .aew-explore__grid {
        grid-template-columns: 1fr;
    }
    
    .aew-explore {
        padding: 60px 0 80px;
    }
    
    .aew-explore__header {
        margin-bottom: 30px;
    }
    
    .aew-explore__card {
        padding: 14px 18px;
    }
}
