/* ─── ReplyKit Design System ────────────────────────────────────────── */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #161f32;
    --bg-card-hover: #1c2740;
    --bg-input: #0d1321;
    --border: #1e293b;
    --border-focus: #d97706;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-glow: rgba(245, 158, 11, 0.15);
    --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    
    --font-display: 'Outfit', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);
}

/* ─── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { 
    scroll-behavior: smooth; 
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* ─── Utilities ─────────────────────────────────────────────────────── */
.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-sm { padding: 7px 16px; font-size: 0.85rem; }
.btn-lg { padding: 14px 32px; font-size: 1.1rem; }

.btn-accent {
    background: var(--accent);
    color: #0a0e17;
    box-shadow: 0 0 20px var(--accent-glow);
}
.btn-accent:hover {
    background: var(--accent-hover);
    color: #0a0e17;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* ─── Nav ───────────────────────────────────────────────────────────── */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 24px;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-primary);
}
.logo:hover { color: var(--text-primary); }
.logo-icon { font-size: 1.4rem; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}
.nav-links a { color: var(--text-secondary); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text-primary); }
.nav-links .btn { color: #0a0e17; }

/* ─── Hero ──────────────────────────────────────────────────────────── */
.hero {
    max-width: 800px;
    margin: 0 auto;
    padding: 140px 24px 60px;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-bottom: 28px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 3.8rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: 20px;
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 60px;
}

.hero-note {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ─── Demo Window ───────────────────────────────────────────────────── */
.demo-window {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    overflow: hidden;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    text-align: left;
    max-width: 680px;
    margin: 0 auto;
}

.demo-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.demo-dots {
    display: flex;
    gap: 6px;
}
.demo-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}
.demo-dots span:first-child { background: #ef4444; }
.demo-dots span:nth-child(2) { background: #f59e0b; }
.demo-dots span:last-child { background: #22c55e; }

.demo-title {
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.demo-body { padding: 24px; }

.demo-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.demo-text {
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.6;
}

.demo-customer {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-style: italic;
}

.demo-controls {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.demo-chip {
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
}
.demo-chip.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.demo-arrow {
    text-align: center;
    font-size: 1.4rem;
    color: var(--accent);
    margin: 8px 0;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.demo-reply {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), rgba(239, 68, 68, 0.04));
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--text-primary);
    min-height: 80px;
}

/* ─── Proof Bar ─────────────────────────────────────────────────────── */
.proof-bar {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 32px 24px;
    margin: 60px 0;
}

.proof-inner {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.proof-stat { text-align: center; }
.proof-number {
    display: block;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
}
.proof-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.proof-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

/* ─── Features ──────────────────────────────────────────────────────── */
.features, .how-it-works, .pricing, .final-cta {
    max-width: 960px;
    margin: 0 auto;
    padding: 80px 24px;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    text-align: center;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.section-sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 48px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.feature-card {
    padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all 0.3s ease;
}
.feature-card:hover {
    border-color: rgba(245, 158, 11, 0.3);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.feature-icon { font-size: 1.6rem; margin-bottom: 14px; }
.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ─── How It Works ──────────────────────────────────────────────────── */
.steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 200px;
    max-width: 260px;
    text-align: center;
}

.step-num {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--accent);
    opacity: 0.4;
    margin-bottom: 12px;
}

.step h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.step p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.step-arrow {
    font-size: 1.6rem;
    color: var(--text-muted);
    padding-top: 30px;
}

/* ─── Pricing ───────────────────────────────────────────────────────── */
.pricing-grid {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.price-card {
    position: relative;
    width: 300px;
    padding: 36px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    text-align: center;
}

.price-card.featured {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.price-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 16px;
    border-radius: 100px;
    background: var(--accent);
    color: #0a0e17;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.price-tier {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.price-amount {
    font-family: var(--font-display);
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.price-period {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 28px;
}

.price-features {
    list-style: none;
    text-align: left;
    margin-bottom: 28px;
}

.price-features li {
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.price-features li.muted {
    color: var(--text-muted);
    opacity: 0.5;
}

.price-card .btn { width: 100%; justify-content: center; }

/* ─── Final CTA ─────────────────────────────────────────────────────── */
.final-cta {
    text-align: center;
    padding: 100px 24px;
}

.final-cta h2 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.final-cta p {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 1.05rem;
}

/* ─── Footer ────────────────────────────────────────────────────────── */
.footer {
    border-top: 1px solid var(--border);
    padding: 28px 24px;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-by {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    gap: 24px;
}
.footer-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.footer-links a:hover { color: var(--text-primary); }

/* ─── App Page Styles ───────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 65px;
}

.app-main {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
}

.app-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 24px;
}

/* Generator */
.generator {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
}

.field-label {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.textarea-wrap {
    position: relative;
    margin-bottom: 20px;
}

.textarea-wrap textarea {
    width: 100%;
    min-height: 140px;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}
.textarea-wrap textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.textarea-wrap textarea::placeholder {
    color: var(--text-muted);
}

.char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.options-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.option-group { flex: 1; min-width: 150px; }

.option-group select {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.option-group select:focus {
    outline: none;
    border-color: var(--border-focus);
}

.context-field {
    margin-bottom: 20px;
}
.context-field input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
}
.context-field input:focus {
    outline: none;
    border-color: var(--border-focus);
}
.context-field input::placeholder { color: var(--text-muted); }

.generate-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.usage-badge {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.usage-badge strong {
    color: var(--accent);
}

.btn-generate {
    padding: 12px 32px;
    font-size: 1rem;
}
.btn-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Result */
.result-card {
    background: var(--bg-card);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: none;
}

.result-card.visible { display: block; }

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.result-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent);
}

.result-actions {
    display: flex;
    gap: 8px;
}

.btn-copy {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 600;
    transition: all 0.2s;
}
.btn-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-copy.copied {
    border-color: var(--success);
    color: var(--success);
}

.result-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
}
.loading.visible { display: block; }

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Custom Rules */
.rules-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 24px;
}

.rules-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.rules-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
}

.rules-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.rules-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}
.rules-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.rules-textarea::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.rules-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.rules-saved {
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 8px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Auth Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    width: 100%;
    max-width: 400px;
    transform: translateY(20px);
    transition: transform 0.3s;
}
.modal-overlay.visible .modal {
    transform: translateY(0);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
}

.modal-sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.form-field {
    margin-bottom: 16px;
}

.form-field input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
}
.form-field input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-error {
    color: var(--error);
    font-size: 0.8rem;
    margin-top: 8px;
    display: none;
}
.form-error.visible { display: block; }

.modal .btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

.modal-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .nav-links a:not(.btn) { display: none; }
    .proof-divider { display: none; }
    .proof-inner { gap: 24px; }
    .steps { flex-direction: column; align-items: center; }
    .step-arrow { transform: rotate(90deg); padding: 0; }
    .pricing-grid { flex-direction: column; align-items: center; }
    .options-row { flex-direction: column; }
    .generate-bar { flex-direction: column; }
    .footer-inner { justify-content: center; text-align: center; }
}
