/* ============================================
   AlwaysViral Tools – Instagram Hashtag Generator
   Design System & Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    --bg-body: #fff0f5;
    --bg-card: #ffffff;
    --bg-input: #fce7f3;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-focus: #db2777;
    --accent-purple: #833ab4;
    --accent-red: #fd1d1d;
    --accent-orange: #fcb045;
    --success-bg: #ecfdf5;
    --success-border: #6ee7b7;
    --success-text: #065f46;
    --success-icon: #10b981;
    --error-bg: #fef2f2;
    --error-border: #fca5a5;
    --error-text: #991b1b;
    --warning-bg: #fffbeb;
    --warning-border: #fcd34d;
    --warning-text: #92400e;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body); color: var(--text-primary);
    line-height: 1.6; -webkit-font-smoothing: antialiased;
}

/* ---------- Tool Section Container ---------- */
.tool-section { max-width: 640px; margin: 60px auto; padding: 0 20px; }
@media (max-width: 768px) { .tool-section { margin: 30px auto; padding: 0 16px; } }

/* ---------- Tool Header ---------- */
.tool-header { text-align: center; margin-bottom: 32px; }
.tool-header__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 64px; height: 64px; border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #f472b6, #be185d, #831843);
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(131, 58, 180, 0.25);
    animation: pulse-glow 3s ease-in-out infinite;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 8px 24px rgba(131, 58, 180, 0.25); }
    50% { box-shadow: 0 8px 32px rgba(131, 58, 180, 0.4); }
}
.tool-header__icon svg { width: 32px; height: 32px; fill: #ffffff; }
.tool-header__title { font-size: 26px; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; letter-spacing: -0.5px; }
.tool-header__subtitle { font-size: 15px; color: var(--text-secondary); max-width: 440px; margin: 0 auto; line-height: 1.5; }

/* ---------- Tool Card ---------- */
.tool-card {
    background: var(--bg-card); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); padding: 40px;
    border: 1px solid var(--border-color); transition: var(--transition);
    position: relative; overflow: hidden;
}
.tool-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, #833ab4, #fd1d1d, #fcb045);
    opacity: 0; transition: var(--transition);
}
.tool-card:hover::before { opacity: 1; }
@media (max-width: 768px) { .tool-card { padding: 24px; border-radius: var(--radius-lg); } }

/* ---------- Form Elements ---------- */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block; font-size: 13px; font-weight: 600; color: var(--text-primary);
    margin-bottom: 8px; letter-spacing: 0.3px; text-transform: uppercase;
}
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper__prefix {
    position: absolute; left: 16px; color: var(--text-muted);
    font-size: 15px; font-weight: 500; pointer-events: none;
}
.input-wrapper__field {
    width: 100%; padding: 14px 16px 14px 38px; font-size: 15px;
    font-family: 'Inter', sans-serif; font-weight: 500; color: var(--text-primary);
    background: var(--bg-input); border: 2px solid var(--border-color);
    border-radius: var(--radius-md); outline: none; transition: var(--transition);
}
.input-wrapper__field:focus {
    border-color: var(--border-focus); background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.08);
}

/* ---------- Buttons ---------- */
.btn-submit {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 15px 24px; font-size: 15px; font-weight: 600;
    color: #ffffff; background: var(--text-primary);
    border: none; border-radius: var(--radius-md); cursor: pointer;
    transition: var(--transition);
}
.btn-submit:hover:not(:disabled) {
    background: #1f2937; transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.3);
}
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Loading Spinner ---------- */
.spinner {
    display: none; width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3); border-top-color: #ffffff;
    border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-submit.loading .spinner { display: block; }
.btn-submit.loading .btn-text, .btn-submit.loading .btn-icon { display: none; }

/* ---------- Results Display ---------- */
.result-container { margin-top: 28px; animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.hashtag-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-md);
}

.hashtag-header {
    padding: 24px; background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-bottom: 1px solid var(--border-color); text-align: center;
}
.hashtag-header__title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.hashtag-header__subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.hashtag-group { padding: 24px; border-bottom: 1px solid var(--border-color); }
.hashtag-group:last-child { border-bottom: none; }
.hashtag-group__title {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px;
    display: flex; justify-content: space-between; align-items: center;
}

.hashtag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.hashtag-pill {
    font-size: 13px; font-weight: 600; padding: 6px 12px;
    background: #f3f4f6; color: var(--text-primary);
    border-radius: var(--radius-full); border: 1px solid var(--border-color);
    transition: var(--transition); cursor: default;
}
.hashtag-pill:hover { background: #e5e7eb; border-color: var(--text-muted); }

.btn-copy {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; font-size: 13px; font-weight: 600;
    color: var(--accent-purple); background: rgba(131,58,180,0.08);
    border: 1px solid rgba(131,58,180,0.15); border-radius: var(--radius-md);
    cursor: pointer; transition: var(--transition);
}
.btn-copy:hover { background: rgba(131,58,180,0.12); transform: translateY(-1px); }
.btn-copy svg { width: 14px; height: 14px; fill: currentColor; }

/* ---------- Analyzing State ---------- */
.analyzing-state {
    padding: 32px 24px; text-align: center; background: var(--bg-card);
    border: 1px solid var(--border-color); border-radius: var(--radius-lg);
}
.analyzing-state__dots { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; }
.analyzing-state__dots span {
    width: 10px; height: 10px; border-radius: 50%;
    background: linear-gradient(135deg, #833ab4, #fd1d1d);
    animation: dot-bounce 1.4s ease-in-out infinite;
}
.analyzing-state__dots span:nth-child(2) { animation-delay: 0.2s; }
.analyzing-state__dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* ---------- Result CTA Footer ---------- */
.tool-section > .tool-footer { display: none; }
.tool-footer--results {
    display: block; margin-top: 22px; padding: 24px;
    background: #10141f; color: #ffffff;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.tool-footer__eyebrow {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 5px 10px; margin-bottom: 12px;
    font-size: 11px; font-weight: 800; letter-spacing: 0.6px;
    color: #fbbf24; background: rgba(251,191,36,0.1);
    border: 1px solid rgba(251,191,36,0.2);
    border-radius: var(--radius-full); text-transform: uppercase;
}
.tool-footer__header { margin-bottom: 18px; }
.tool-footer__title {
    margin: 0 0 6px; font-size: 19px; line-height: 1.25;
    color: #ffffff; font-weight: 800; letter-spacing: 0;
}
.tool-footer__subtitle {
    max-width: 460px; margin: 0 auto; font-size: 13px;
    color: rgba(255,255,255,0.68); line-height: 1.5;
}
.cta-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px; text-align: left;
}
.cta-card {
    min-height: 118px; padding: 16px;
    display: grid; grid-template-columns: 38px 1fr; gap: 12px;
    align-items: start; text-decoration: none;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.cta-card:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.1);
    border-color: rgba(252,176,69,0.55);
}
.cta-card__icon {
    width: 38px; height: 38px; display: inline-flex;
    align-items: center; justify-content: center;
    color: #ffffff; font-size: 14px; font-weight: 800;
    background: linear-gradient(135deg, #f472b6, #be185d, #831843);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 18px rgba(253,29,29,0.18);
}
.cta-card__content { display: flex; flex-direction: column; min-width: 0; }
.cta-card__title {
    color: #ffffff; font-size: 14px; font-weight: 800;
    line-height: 1.25; margin-bottom: 4px;
}
.cta-card__desc {
    color: rgba(255,255,255,0.64); font-size: 12px;
    line-height: 1.45; margin-bottom: 12px;
}
.cta-card__btn {
    grid-column: 2; justify-self: start; align-self: end;
    padding: 7px 12px; color: #111827; background: #ffffff;
    border-radius: var(--radius-full); font-size: 11px; font-weight: 800;
}
.tool-footer__brand {
    margin-top: 16px; font-size: 12px; color: rgba(255,255,255,0.55);
    text-align: center;
}
.tool-footer__brand a {
    color: #ffffff; text-decoration: none; font-weight: 800;
}

@media (max-width: 640px) {
    .tool-footer--results { padding: 20px; }
    .cta-grid { grid-template-columns: 1fr; }
}
