/* =====================================================
   CharCounter.online — Professional CSS
   Fonts: Space Mono (display) + DM Sans (body)
   ===================================================== */

:root {
    --bg:          #08090d;
    --surface:     #111318;
    --surface-2:   #181c24;
    --text:        #eef0f6;
    --text-muted:  #6b7280;
    --text-sub:    #9ca3af;
    --accent:      #00d4ff;
    --accent-dim:  rgba(0, 212, 255, 0.12);
    --border:      #1e2330;
    --border-lite: #252b3b;
    --success:     #10b981;
    --danger:      #f43f5e;
    --warn:        #f59e0b;
    --radius:      14px;
    --radius-sm:   8px;
    --shadow:      0 4px 24px rgba(0,0,0,0.4);
}

[data-theme="light"] {
    --bg:          #f0f4f8;
    --surface:     #ffffff;
    --surface-2:   #f7f9fc;
    --text:        #0d1117;
    --text-muted:  #6b7280;
    --text-sub:    #9ca3af;
    --accent:      #0077cc;
    --accent-dim:  rgba(0, 119, 204, 0.1);
    --border:      #e2e8f0;
    --border-lite: #d1dae8;
    --shadow:      0 4px 24px rgba(0,0,0,0.07);
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 12px 40px;
    transition: background 0.25s, color 0.25s;
}

/* ── Ad Slots ── */
.ad-slot {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    background: var(--surface-2);
    border: 1px dashed var(--border-lite);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 10px 0;
}

.ad-slot.mid-ad { min-height: 90px; margin: 16px 0; }
.ad-slot.bottom-ad { margin-top: 12px; }

.ad-label {
    position: absolute;
    top: 4px; left: 8px;
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Theme Toggle ── */
.theme-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border-lite);
    color: var(--text);
    padding: 9px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, transform 0.15s;
    white-space: nowrap;
}

.theme-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ── Container ── */
.container {
    width: 100%;
    max-width: 820px;
}

/* ── Header ── */
header {
    text-align: center;
    padding: 28px 0 20px;
}

.logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon { display: flex; }

h1 {
    font-family: 'Space Mono', monospace;
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.5px;
}

h1 .domain { color: var(--accent); }

.tagline {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ── Textarea ── */
.input-section { margin-bottom: 16px; }

.textarea-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s;
    box-shadow: var(--shadow);
}

.textarea-wrap:focus-within {
    border-color: var(--accent);
}

textarea {
    display: block;
    width: 100%;
    min-height: 180px;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    resize: vertical;
    outline: none;
    line-height: 1.7;
}

textarea::placeholder { color: var(--text-muted); }

.textarea-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.quick-stats {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--text-muted);
    flex: 1;
    flex-wrap: wrap;
}

.quick-stats strong { color: var(--text); }

.action-btn {
    background: transparent;
    border: 1px solid var(--border-lite);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.action-btn.danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* ── Metrics Grid ── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (min-width: 540px) {
    .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: border-color 0.2s;
    box-shadow: var(--shadow);
}

.metric-card.primary {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.metric-number {
    font-family: 'Space Mono', monospace;
    font-size: clamp(1.4rem, 3.5vw, 1.9rem);
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -1px;
}

.metric-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.metric-sub {
    font-size: 10px;
    color: var(--text-muted);
}

/* ── Social Section ── */
.social-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
}

.section-badge {
    font-size: 10px;
    font-weight: 600;
    background: var(--accent-dim);
    color: var(--accent);
    padding: 3px 8px;
    border-radius: 50px;
    border: 1px solid var(--accent);
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.social-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 520px) {
    .social-grid { grid-template-columns: 1fr 1fr; }
}

.social-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    transition: border-color 0.2s;
}

.social-card:hover { border-color: var(--border-lite); }

.social-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
}

.social-name {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
}

.social-icon { font-size: 14px; }
.x-icon { font-style: normal; }

.count-status {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.social-note {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Progress bar */
.progress-bar {
    background: var(--border);
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
}

.progress {
    height: 100%;
    width: 0%;
    background: var(--success);
    border-radius: 2px;
    transition: width 0.15s ease, background-color 0.2s;
}

/* Over limit state */
.social-card.over-limit {
    border-color: var(--danger);
    background: rgba(244, 63, 94, 0.05);
}

.social-card.over-limit .progress { background: var(--danger); }
.social-card.over-limit .count-status {
    color: var(--danger);
    font-weight: 700;
}

/* Warning zone (>80%) — handled via JS class */
.social-card.near-limit .progress { background: var(--warn); }

/* ── About / SEO ── */
.about-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.75;
}

.about-section h3 {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 10px;
}

.about-section p { margin-bottom: 10px; }

/* FAQ */
.faq { margin-top: 20px; }

.faq h3 { margin-bottom: 12px; }

details {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

summary {
    padding: 11px 14px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-2);
}

summary::after {
    content: '+';
    font-size: 16px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

details[open] summary::after { content: '−'; }

details p {
    padding: 12px 14px;
    font-size: 13px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin: 0;
}

/* ── Footer ── */
footer {
    text-align: center;
    padding: 20px 0 0;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

footer nav {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover { text-decoration: underline; }

/* ── Mobile ── */
@media (max-width: 480px) {
    .theme-btn { bottom: 14px; right: 14px; padding: 8px 13px; }
    .quick-stats { gap: 10px; }
    textarea { min-height: 150px; }
}
/* ── Extra metrics (linha 2 da grid) ── */
@media (min-width: 540px) {
    .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}

.metric-card.extra {
    background: var(--surface-2);
}

.metric-card.extra .metric-number {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--text-sub);
}
