:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #F8FAFC;
    --panel-bg: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --success: #10B981; --success-bg: #D1FAE5;
    --warning: #F59E0B; --warning-bg: #FEF3C7;
    --danger: #EF4444; --danger-bg: #FEE2E2;
    --h1-color: #7C3AED; --h2-color: #3B82F6; --h3-color: #10B981;
    --h4-color: #F59E0B; --h5-color: #EC4899; --h6-color: #64748B;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { font-family: 'Inter', sans-serif; background-color: var(--bg-color); color: var(--text-main); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }

/* Header & Central Hero */
.app-header { background-color: var(--panel-bg); border-bottom: 1px solid var(--border); padding: 1.5rem 0 3rem 0; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.header-container-centered { max-width: 1000px; margin: 0 auto; padding: 0 2rem; display: flex; flex-direction: column; align-items: center; }
.top-bar { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 3rem; }
.logo-title-wrap { display: flex; gap: 0.5rem; align-items: center; font-weight: 700; font-size: 1.1rem; }
.logo-icon { background: linear-gradient(135deg, var(--primary), #8B5CF6); color: white; width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 800; flex-shrink: 0; }
.logo-icon span { font-size: 0.8rem; margin-top: 3px; }

.lang-switcher { display: inline-flex; background: var(--bg-color); border-radius: 6px; padding: 2px; border: 1px solid var(--border); }
.lang-btn { background: transparent; border: none; padding: 0.25rem 0.6rem; font-size: 0.75rem; font-weight: 600; cursor: pointer; border-radius: 4px; color: var(--text-muted); }
.lang-btn.active { background: white; color: var(--text-main); box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

.hero-section { text-align: center; margin-bottom: 2.5rem; }
.badge-accent { display: inline-block; background: #EEF2FF; color: var(--primary); padding: 0.35rem 1rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; margin-bottom: 1rem; letter-spacing: 0.05em; }
.hero-section h1 { font-size: 2.8rem; font-weight: 800; color: #111827; letter-spacing: -0.03em; margin-bottom: 0.75rem; }
.hero-section p { color: var(--text-muted); font-size: 1.25rem; max-width: 600px; margin: 0 auto; }

/* Multi-URL Form (Central Pill) */
.multi-url-form { width: 100%; max-width: 700px; background: transparent; padding: 0; border: none; }
.url-row { display: flex; align-items: center; background: white; border-radius: 99px; padding: 0.35rem 0.5rem; box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.05), 0 0 0 3px rgba(79,70,229,0.05); transition: 0.2s; margin-bottom: 1rem; border: 1px solid var(--border); }
.url-row:focus-within { box-shadow: 0 4px 20px rgba(79,70,229,0.15), 0 0 0 4px rgba(79,70,229,0.2); border-color: var(--primary); transform: translateY(-1px); }
.url-type { width: 120px; border: none; background: transparent; padding: 0.6rem 1rem; font-weight: 600; font-size: 0.95rem; color: var(--text-main); cursor: pointer; border-right: 1px solid var(--border); outline: none; border-radius: 99px 0 0 99px; }
.url-type:focus { background: transparent; }
.url-input { border: none; padding: 0.6rem 1.5rem; flex-grow: 1; font-size: 1.05rem; outline: none; background: transparent; border-radius: 0 99px 99px 0; }
.url-input::placeholder { color: #A1A1AA; }

.form-actions { display: flex; justify-content: center; gap: 1rem; align-items: center; margin-top: 1.5rem; }
.btn-primary { background-color: var(--primary); color: white; border: none; padding: 0.85rem 2.5rem; border-radius: 99px; font-weight: 700; font-size: 1.05rem; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(79,70,229,0.4); }

.btn-secondary { background: white; color: var(--text-muted); border: 1px solid var(--border); border-radius: 50%; width: 45px; height: 45px; font-weight: 600; font-size: 1.2rem; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.btn-secondary:hover { background: #EEF2FF; border-color: #EEF2FF; color: var(--primary); transform: scale(1.05); }

.btn-remove { background: #FEE2E2; color: #EF4444; border: none; border-radius: 50%; width: 34px; height: 34px; font-size: 0.8rem; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; margin-right: 0.3rem;}
.btn-remove:hover { background: #FCA5A5; color: white; transform: scale(1.1); }

/* Tabs System */
.tabs-container { display: flex; gap: 1rem; margin-bottom: 1.5rem; overflow-x: auto; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }
.tab-btn { background: transparent; border: none; padding: 0.75rem 1.5rem; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); cursor: pointer; border-radius: 8px 8px 0 0; position: relative; transition: 0.2s; }
.tab-btn:hover { color: var(--text-main); background: rgba(0,0,0,0.02); }
.tab-btn.active { color: var(--primary); background: white; }
.tab-btn.active::after { content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 3px; background: var(--primary); border-radius: 3px 3px 0 0; }
.tab-badge { margin-left: 0.5rem; padding: 2px 6px; border-radius: 99px; font-size: 0.7rem; background: var(--danger-bg); color: var(--danger); font-weight: 800; }
.tab-badge.ok { background: var(--success-bg); color: var(--success); }

/* Main Dashboard */
.app-main { max-width: 1400px; margin: 2rem auto; padding: 0 2rem; width: 100%; transition: opacity 0.3s; }
.dashboard-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 2rem; }

.panel { background: var(--panel-bg); border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); overflow: hidden; display: flex; flex-direction: column; height: 600px; }
.panel-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background-color: #F8FAFC; }
.panel-header h2 { font-size: 1.05rem; font-weight: 600; }
.badge { padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.status-badge { background: var(--border); color: var(--text-main); }
.danger-badge { background: var(--danger-bg); color: var(--danger); }
.panel-body { padding: 1.5rem; overflow-y: auto; flex: 1; }

/* Visual Tree Styles */
.hn-tree { list-style: none; padding: 0; margin: 0; }
.hn-node { display: flex; flex-direction: column; margin-bottom: 0.5rem; position: relative; padding-left: calc(var(--level) * 2rem); }
.hn-node::before { content: ''; position: absolute; left: calc(var(--level) * 2rem - 1rem); top: 0; bottom: -0.5rem; width: 2px; background-color: var(--border); }
.hn-node:last-child::before { bottom: auto; height: 1.5rem; }
.hn-node::after { content: ''; position: absolute; left: calc(var(--level) * 2rem - 1rem); top: 1.5rem; width: 1rem; height: 2px; background-color: var(--border); }
.hn-node[data-level="1"]::before, .hn-node[data-level="1"]::after { display: none; }

.hn-content { background: white; border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem 0.8rem; display: flex; align-items: center; gap: 0.75rem; box-shadow: 0 1px 2px rgba(0,0,0,0.02); z-index: 1; }
.hn-node.has-error .hn-content { border-color: #FCA5A5; background-color: #FEF2F2; }
.hn-node.is-ghost .hn-content { background-color: transparent; border: 1px dashed var(--danger); opacity: 0.8; color: var(--danger); }
.hn-node.is-ghost .tag-label { background-color: transparent; border: 1px solid var(--danger); color: var(--danger); }
.hn-node.is-ghost .hn-text { font-style: italic; font-weight: 600; }

.tag-label { font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.4rem; border-radius: 4px; color: white; min-width: 32px; text-align: center;}
.tag-h1 { background-color: var(--h1-color); } .tag-h2 { background-color: var(--h2-color); }
.tag-h3 { background-color: var(--h3-color); } .tag-h4 { background-color: var(--h4-color); }
.tag-h5 { background-color: var(--h5-color); } .tag-h6 { background-color: var(--h6-color); }

.hn-text { font-size: 0.85rem; color: var(--text-main); font-weight: 500; flex: 1; word-break: break-word;}
.hn-empty { color: var(--text-muted); font-style: italic; }
.hn-image { color: #0284C7; font-size: 0.8rem; background: #E0F2FE; padding: 0.1rem 0.4rem; border-radius: 4px; margin-left: 0.5rem; font-weight: 600;}
.error-icon { color: var(--danger); font-weight: bold; cursor: help; font-size: 1.1rem;}

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-box { background: #F8FAFC; border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem; text-align: center; }
.error-stat { background: var(--danger-bg); border-color: #FCA5A5; }
.error-stat .stat-value { color: var(--danger); }
.stat-value { display: block; font-size: 1.3rem; font-weight: 700; color: var(--text-main); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }

/* Actions */
.export-actions { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; }
.btn-action { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.6rem; border: 1px solid var(--border); background: white; border-radius: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-main); cursor: pointer; transition: 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.btn-action:hover { background: #F1F5F9; border-color: #CBD5E1; transform: translateY(-1px); }

/* Reco List */
.reco-list { display: flex; flex-direction: column; gap: 1rem; }
.reco-card { background: white; border: 1px solid var(--border); border-left: 4px solid var(--warning); border-radius: 6px; padding: 1rem; }
.reco-card.critical { border-left-color: var(--danger); }
.reco-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; align-items: center;}
.reco-title { font-weight: 600; font-size: 0.85rem; }
.reco-type { font-size: 0.70rem; padding: 0.2rem 0.4rem; border-radius: 4px; background: var(--warning-bg); color: var(--warning); font-weight: 700; }
.reco-card.critical .reco-type { background: var(--danger-bg); color: var(--danger); }
.reco-body { font-size: 0.85rem; color: var(--text-muted); }
.reco-solution { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed var(--border); font-size: 0.85rem; color: var(--text-main); font-weight: 500; }
.btn-dismiss { background: transparent; border: none; color: #CBD5E1; cursor: pointer; transition: 0.2s; font-size: 1rem; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center;}
.btn-dismiss:hover { color: var(--danger); transform: scale(1.1); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); text-align: center; padding: 2rem; }
.empty-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.5; }

/* ======= V4: SEO Lead Gen Section ======= */
.seo-lead-section { background: white; border-top: 1px solid var(--border); padding: 4rem 2rem; margin-top: 1rem; }
.lead-container { max-width: 1400px; margin: 0 auto; }
.lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; margin-bottom: 3rem; }

.best-practices h2, .faq-container h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--text-main); display: flex; align-items: center; gap: 0.5rem;}
.bp-badge { background: linear-gradient(135deg, var(--primary), #8B5CF6); color: white; border-radius: 4px; font-size: 0.7rem; padding: 0.2rem 0.4rem; vertical-align: middle; }
.bp-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.bp-list li { display: flex; align-items: flex-start; gap: 0.75rem; font-size: 0.95rem; color: var(--text-muted); background: #F8FAFC; padding: 1rem; border-radius: 8px; border: 1px solid var(--border); }
.bp-list .icon { font-size: 1rem; margin-top: -2px; }

/* Accordion */
.faq-accordion { display: flex; flex-direction: column; gap: 1rem; }
.faq-item { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.faq-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 1.25rem; font-size: 0.95rem; font-weight: 600; color: var(--text-main); background: white; border: none; cursor: pointer; text-align: left; transition: 0.2s; }
.faq-btn:hover { background: #F8FAFC; }
.faq-btn .icon { font-size: 1.5rem; font-weight: 400; color: var(--primary); transition: transform 0.3s; }
.faq-btn.active .icon { transform: rotate(45deg); }
.faq-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; background: white; }
.faq-content p { padding: 0 1.25rem 1.25rem 1.25rem; font-size: 0.9rem; color: var(--text-muted); }

/* CTA Box */
.cta-box { background: var(--bg-color); border: 1px solid var(--border); border-radius: 12px; padding: 2.5rem; display: flex; justify-content: space-between; align-items: center; gap: 2rem; color: var(--text-main); }
.cta-txt h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.cta-txt p { font-size: 1rem; color: var(--text-muted); max-width: 600px; }
.btn-cta { background: var(--primary); color: white; padding: 1rem 2rem; border-radius: 8px; font-weight: 700; font-size: 1rem; text-decoration: none; transition: 0.2s; text-align: center; display: inline-block; white-space: nowrap; }
.btn-cta:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

/* Footer & Rating */
.app-footer { background: var(--bg-color); border-top: 1px solid var(--border); padding: 1.5rem 0; margin-top: auto; }
.footer-container { max-width: 1400px; margin: 0 auto; padding: 0 2rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-credit { font-size: 0.85rem; color: var(--text-muted); }
.footer-credit a { color: var(--primary); text-decoration: none; font-weight: 600; }
.footer-credit a:hover { text-decoration: underline; }
.footer-rating { display: flex; align-items: center; gap: 1rem; }
.rating-text { font-size: 0.85rem; font-weight: 600; color: var(--text-main); }
.hearts-container { display: flex; gap: 0.25rem; cursor: pointer; }
.heart { font-size: 1.25rem; opacity: 0.4; transition: transform 0.2s, opacity 0.2s, filter 0.2s; filter: grayscale(100%); }
.hearts-container:hover .heart { opacity: 0.4; filter: grayscale(100%); }
.heart.hovered, .hearts-container .heart.active { opacity: 1; filter: grayscale(0%); transform: scale(1.1); }

/* Loader */
.loader-overlay { position: fixed; inset: 0; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(4px); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-wrapper { width: 300px; margin-top: 1.5rem; }
.progress-bar { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); width: 0%; transition: width 0.4s ease; }
.progress-text { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-top: 0.5rem; text-align: center; }

.toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--text-main); color: white; padding: 0.75rem 1.5rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem; opacity: 0; transition: transform 0.3s, opacity 0.3s; z-index: 100; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

#print-area { display: none; }
@media print {
    body { background: white; margin: 0; padding: 0; }
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area { position: absolute; left: 0; top: 0; width: 100%; display: block; padding: 20px; }
    
    /* Hide specific persistent UI blocks that might interfere */
    .app-header, .app-main, .seo-lead-section, .app-footer, .loader-overlay, .toast { display: none !important; }
}

@media (max-width: 1024px) {
    .dashboard-grid, .lead-grid, .cta-box { grid-template-columns: 1fr; }
    .cta-box { flex-direction: column; text-align: center; }
    .panel { height: 600px; }
    .hero-section h1 { font-size: 2rem; }
}
