/* ==========================================================================
   AI Tagline Generator — Public Styles v2 (Single Search Bar)
   ========================================================================== */

.atg-wrapper *,
.atg-wrapper *::before,
.atg-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.atg-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    color: #1a1a2e;
    max-width: 780px;
    margin: 0 auto;
    position: relative;
}

/* ── Card ──────────────────────────────────────────────────────────────────── */
.atg-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 8px 40px rgba(102, 126, 234, 0.13);
    overflow: hidden;
}

/* ── Hero Section ──────────────────────────────────────────────────────────── */
.atg-hero {
    text-align: center;
    padding: 48px 40px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.atg-hero-icon {
    font-size: 52px;
    display: block;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.atg-title {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
    line-height: 1.2;
}

.atg-subtitle {
    font-size: 0.95rem;
    opacity: 0.88;
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto;
}

/* ── Search Wrap ───────────────────────────────────────────────────────────── */
.atg-search-wrap {
    padding: 32px 40px 8px;
}

/* ── Single Search Bar ─────────────────────────────────────────────────────── */
.atg-search-bar {
    display: flex;
    align-items: center;
    background: #f7f8ff;
    border: 2.5px solid #e0e4ff;
    border-radius: 100px;
    padding: 6px 6px 6px 20px;
    gap: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.atg-search-bar:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 5px rgba(102, 126, 234, 0.12);
    background: #fff;
}

.atg-search-icon {
    color: #aab0d5;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.atg-search-bar:focus-within .atg-search-icon {
    color: #667eea;
}

.atg-input.atg-field-query {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: #1a1a2e;
    outline: none;
    padding: 10px 0;
    font-family: inherit;
    min-width: 0;
}

.atg-input.atg-field-query::placeholder {
    color: #aab0d5;
    font-weight: 400;
}

/* ── Generate Button (inside bar) ──────────────────────────────────────────── */
.atg-btn-generate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.35);
    letter-spacing: 0.2px;
}

.atg-btn-generate:hover {
    opacity: 0.93;
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(102, 126, 234, 0.45);
}

.atg-btn-generate:active {
    transform: scale(0.97);
}

.atg-btn-arrow {
    transition: transform 0.2s;
}

.atg-btn-generate:hover .atg-btn-arrow {
    transform: translateX(3px);
}

/* ── Hint & Privacy ────────────────────────────────────────────────────────── */
.atg-hint {
    font-size: 12.5px;
    color: #aab0d5;
    margin-top: 10px;
    padding-left: 8px;
}

.atg-hint em {
    font-style: italic;
    color: #8890c0;
}

.atg-privacy-note {
    font-size: 12px;
    color: #c0c5e0;
    text-align: center;
    padding: 16px 40px 28px;
}

/* ── Overlay & Popup ───────────────────────────────────────────────────────── */
.atg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 30, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

.atg-overlay.atg-open {
    opacity: 1;
    pointer-events: all;
}

.atg-popup {
    background: #fff;
    border-radius: 24px;
    padding: 44px 40px 36px;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.22);
    transform: translateY(28px) scale(0.96);
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.atg-overlay.atg-open .atg-popup {
    transform: translateY(0) scale(1);
}

.atg-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f2f3fa;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    transition: background 0.2s, color 0.2s;
}

.atg-popup-close:hover {
    background: #e4e6f5;
    color: #333;
}

.atg-popup-header {
    text-align: center;
    margin-bottom: 28px;
}

.atg-popup-icon {
    font-size: 44px;
    display: block;
    margin-bottom: 12px;
}

.atg-popup-header h3 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.atg-popup-header p {
    font-size: 14px;
    color: #777;
    line-height: 1.5;
}

/* ── Lead Form ─────────────────────────────────────────────────────────────── */
.atg-lead-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.atg-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.atg-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.atg-field-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.2px;
}

.atg-req     { color: #e53e3e; }
.atg-optional { color: #bbb; font-weight: 400; font-style: italic; }

.atg-field-group .atg-input {
    width: 100%;
    padding: 11px 15px;
    border: 2px solid #e8eaf6;
    border-radius: 12px;
    font-size: 14.5px;
    font-family: inherit;
    color: #1a1a2e;
    background: #fafbff;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

.atg-field-group .atg-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: #fff;
}

.atg-field-group .atg-input::placeholder { color: #c0c5e0; }

/* ── Submit Button ─────────────────────────────────────────────────────────── */
.atg-btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 24px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.35);
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.15s;
    margin-top: 4px;
}

.atg-btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(245, 87, 108, 0.42);
}

.atg-btn-submit:disabled { opacity: 0.65; cursor: not-allowed; }

.atg-btn-loading {
    display: none;
    align-items: center;
    gap: 8px;
}

.atg-btn-submit.atg-loading .atg-btn-label  { display: none; }
.atg-btn-submit.atg-loading .atg-btn-loading { display: flex; }

@keyframes atg-spin { to { transform: rotate(360deg); } }
.atg-spinner {
    width: 18px;
    height: 18px;
    animation: atg-spin 0.75s linear infinite;
}

.atg-form-error {
    background: #fff5f5;
    border: 1.5px solid #fed7d7;
    color: #c53030;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    display: none;
    line-height: 1.4;
}

.atg-form-error.atg-visible { display: block; }

/* ── Results ───────────────────────────────────────────────────────────────── */
.atg-results { display: none; margin-top: 28px; }
.atg-results.atg-visible { display: block; }

.atg-results-header {
    text-align: center;
    margin-bottom: 22px;
}

.atg-results-header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 6px;
    letter-spacing: -0.4px;
}

.atg-results-brand {
    font-size: 13.5px;
    color: #667eea;
    font-weight: 600;
}

/* ── 3×3 Grid ──────────────────────────────────────────────────────────────── */
.atg-taglines-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

@media (max-width: 640px) {
    .atg-taglines-grid { grid-template-columns: 1fr; }
}

@media (min-width: 641px) and (max-width: 900px) {
    .atg-taglines-grid { grid-template-columns: repeat(2, 1fr); }
}

.atg-tagline-card {
    background: #fff;
    border: 2px solid #eef0fb;
    border-radius: 16px;
    padding: 18px 16px 14px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 96px;
    animation: atg-card-in 0.4s ease both;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.07);
}

.atg-tagline-card:nth-child(1)  { animation-delay: 0.04s; }
.atg-tagline-card:nth-child(2)  { animation-delay: 0.09s; }
.atg-tagline-card:nth-child(3)  { animation-delay: 0.14s; }
.atg-tagline-card:nth-child(4)  { animation-delay: 0.19s; }
.atg-tagline-card:nth-child(5)  { animation-delay: 0.24s; }
.atg-tagline-card:nth-child(6)  { animation-delay: 0.29s; }
.atg-tagline-card:nth-child(7)  { animation-delay: 0.34s; }
.atg-tagline-card:nth-child(8)  { animation-delay: 0.39s; }
.atg-tagline-card:nth-child(9)  { animation-delay: 0.44s; }

@keyframes atg-card-in {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.atg-tagline-card:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(102, 126, 234, 0.18);
}

.atg-tagline-card.atg-copied {
    border-color: #38a169;
    background: #f0fff4;
}

.atg-tagline-num {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #bfc5e8;
}

.atg-tagline-text {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.5;
    flex: 1;
}

.atg-tagline-copy {
    font-size: 11px;
    color: #667eea;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 500;
}

.atg-tagline-card:hover .atg-tagline-copy { opacity: 1; }

/* ── Results Actions ───────────────────────────────────────────────────────── */
.atg-results-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    justify-content: center;
    flex-wrap: wrap;
}

.atg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 22px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: inherit;
    border: none;
}

.atg-btn-copy-all {
    background: #2d3748;
    color: #fff;
    box-shadow: 0 3px 12px rgba(45, 55, 72, 0.25);
}

.atg-btn-copy-all:hover { background: #1a202c; transform: translateY(-1px); }

.atg-btn-regenerate {
    background: #fff;
    color: #667eea;
    border: 2px solid #e0e4ff;
}

.atg-btn-regenerate:hover {
    background: #f0f2ff;
    border-color: #667eea;
    transform: translateY(-1px);
}

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.atg-copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #1a202c;
    color: #fff;
    padding: 11px 22px;
    border-radius: 100px;
    font-size: 13.5px;
    font-weight: 600;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s, transform 0.22s;
    white-space: nowrap;
}

.atg-copy-toast.atg-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
    .atg-hero          { padding: 36px 24px 24px; }
    .atg-search-wrap   { padding: 24px 20px 8px; }
    .atg-privacy-note  { padding: 14px 20px 24px; }

    .atg-search-bar {
        border-radius: 18px;
        padding: 10px 10px 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .atg-btn-generate {
        width: 100%;
        justify-content: center;
        border-radius: 12px;
        padding: 13px 18px;
    }

    .atg-popup { padding: 36px 20px 28px; }
    .atg-form-row { grid-template-columns: 1fr; }
    .atg-results-actions { flex-direction: column; }
    .atg-results-actions .atg-btn { width: 100%; justify-content: center; }
}
