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

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

@media (max-width: 600px) {
    .aih-hero {
        padding: 48px 0 !important;
    }
}

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

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

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

.aih-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);
    }
}

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

.aih-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);
}

.aih-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);
}

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

.aih-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 */
.aih-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);
}

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

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

@keyframes pulse {

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

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

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

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

/* Split Layout */
.aih-split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 500px;
}

.aih-split-left {
    padding: 24px;
    border-right: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
}

.aih-split-right {
    padding: 24px;
    background: #fafbfc;
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
}

.aih-placeholder-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    text-align: center;
    padding: 40px;
}

/* Vertical / Stacked Layout Override (Desktop & Dashboard) */
.aih-layout-stacked {
    grid-template-columns: 1fr !important;
    min-height: auto !important;
}

.aih-layout-stacked .aih-split-left {
    border-right: none !important;
    border-bottom: 1px solid var(--color-border-light) !important;
    padding: 32px !important;
}

.aih-layout-stacked .aih-split-right {
    border-radius: 0 0 var(--radius-xl) var(--radius-xl) !important;
    min-height: 400px !important;
    padding: 32px !important;
}

.aih-placeholder-state > svg {
    margin-bottom: 16px;
    stroke: var(--color-border);
}

@media (max-width: 900px) {
    .aih-split-layout {
        grid-template-columns: 1fr;
    }
    .aih-split-left {
        padding: 16px;
        border-right: none;
        border-bottom: 1px solid var(--color-border-light);
    }
    .aih-split-right {
        padding: 16px;
        border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    }
    .aih-hero__title {
        font-size: 2rem;
    }
}

.aih-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.aih-clear-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444 !important;
}

/* Editor area */
.aih-editor-wrapper {
    background: transparent;
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    box-shadow: none;
    margin-bottom: 0;
}

.aih-textarea {
    flex-grow: 1;
    width: 100%;
    border: none;
    resize: none;
    padding: 24px 24px 80px 24px;
    font-size: 16px;
    color: var(--color-text-primary, #1e293b);
    background: transparent;
    outline: none;
    font-family: inherit;
    line-height: 1.6;
    height: 100%;
    min-height: 400px;
}

.aih-textarea::placeholder {
    color: var(--color-text-muted, #94a3b8);
}

.aih-editor-actions {
    margin-top: 12px;
    margin-left: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    z-index: 10;
}

.aih-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--color-primary, #6366f1);
    border-radius: 20px;
    background: #ffffff;
    color: var(--color-primary, #6366f1);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.aih-action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.aih-action-btn:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

@media (max-width: 600px) {
    .aih-editor-actions {
        position: relative; /* Switch to relative on small screens */
        top: 0;
        left: 0;
        margin: 16px 24px 0 24px;
        z-index: 10;
    }
    
    .aih-textarea {
        padding-top: 16px !important;
        min-height: 300px;
    }

    .aih-hero {
        padding: 40px 0;
    }
}

.aih-action-or {
    font-size: 14px;
    color: #94a3b8;
}

.aih-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #fff;
    border-top: 1px solid var(--color-border-light, #e2e8f0);
}

.aih-word-count {
    color: #64748b;
    font-size: 14px;
}

.aih-humanize-btn {
    appearance: none;
    -webkit-appearance: none;
    background: var(--color-primary, #6366f1) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 24px !important;
    padding: 10px 24px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
    line-height: 1;
    width: auto !important;
    min-width: 120px !important;
    min-height: 42px !important;
    flex-shrink: 0 !important;
}

.aih-humanize-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.aih-humanize-btn:active {
    transform: scale(0.98);
}

.aih-btn-loading[hidden] {
    display: none !important;
}

.aih-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);
    }
}

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

/* ── Error / alerts ────────────────────────────────────────── */
.aih-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) ────────────────────────────── */
.aih-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);
}

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

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

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

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

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

/* ── Results ───────────────────────────────────────────────── */
.aih-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);
    }
}

.aih-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);
}

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

.aih-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 */
.aih-topics-grid {
    display: grid;
    gap: var(--space-4);
}

/* Topic card */
.aih-topic-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    animation: fadeUp 0.35s ease both;
    margin-bottom: 16px;
}

.aih-topic-card:hover {
    border-color: var(--color-border);
}

.aih-topic-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.aih-topic-card__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.aih-topic-card__text {
    font-size: 15px;
    font-weight: 400;
    color: var(--color-text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

.aih-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;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

.aih-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);
}

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

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

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

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

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

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

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

.aih-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);
}

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

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

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

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

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

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

    .aih-step__arrow {
        display: none;
    }

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

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

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

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

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

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

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

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

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

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

/* Question button */
.aih-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);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Card Styling */
.aih-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);
}

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

.aih-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;
}

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

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

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

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

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

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

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