/* ═══════════════════════════════════════════════════════════════
   Generic Tool Template — tool-generic.css
   Shared styles for all data-driven tool pages (/tools/{slug})
   ═══════════════════════════════════════════════════════════════ */

/* ── Hero ─────────────────────────────────────────────────────── */
.gt-hero {
    position: relative;
    padding: 112px 0 56px;
    overflow: hidden;
}
@media (max-width: 1024px) {
    .gt-hero { padding: 80px 0 48px; }
}
@media (max-width: 768px) {
    .gt-hero { padding: 60px 0 40px; }
}
.gt-hero__glow {
    position: absolute;
    top: -80px; left: 50%;
    transform: translateX(-50%);
    width: 600px; height: 400px;
    background: radial-gradient(ellipse at center, rgba(85,191,198,.18) 0%, transparent 70%);
    pointer-events: none;
}
.gt-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .8125rem;
    color: var(--text-tertiary);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.gt-breadcrumb a {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: var(--transition);
}
.gt-breadcrumb a:hover { color: var(--cyan); }
.gt-breadcrumb svg { opacity: .45; flex-shrink: 0; }

.gt-hero__title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 12px;
    color: var(--text-primary);
    max-width: 640px;
}
.gt-hero__desc {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    margin: 0 0 20px;
    max-width: 560px;
    line-height: 1.65;
}
.gt-hero__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.gt-hero__badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Tool Section ─────────────────────────────────────────────── */
.gt-tool-section {
    padding: 0 0 56px;
}
.gt-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    position: relative;
}
.gt-loading {
    color: var(--text-tertiary);
    font-size: .9375rem;
    text-align: center;
    padding: 40px 0;
}

/* ── Tool UI Components (used by all tool JS files) ───────────── */
.gt-label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.gt-textarea {
    width: 100%;
    min-height: 180px;
    padding: 14px 16px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: .9rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color .2s;
    box-sizing: border-box;
}
.gt-textarea:focus {
    outline: none;
    border-color: var(--cyan);
}
.gt-textarea::placeholder { color: var(--text-tertiary); }

.gt-output {
    width: 100%;
    min-height: 140px;
    padding: 14px 16px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: .9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-y: auto;
    box-sizing: border-box;
}
.gt-output--code {
    max-height: 400px;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.gt-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}
.gt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    transition: var(--transition);
}
.gt-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}
.gt-btn--primary {
    background: var(--cyan);
    border-color: var(--cyan);
    color: #000;
}
.gt-btn--primary:hover {
    background: var(--cyan-light, #7dd3d8);
    border-color: var(--cyan-light, #7dd3d8);
    color: #000;
}
.gt-btn--active {
    background: rgba(85,191,198,.15);
    border-color: var(--cyan);
    color: var(--cyan);
}
.gt-btn--danger {
    background: rgba(239,68,68,.1);
    border-color: rgba(239,68,68,.4);
    color: #ef4444;
}
.gt-copy-btn {
    margin-left: auto;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}
.gt-copy-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.gt-copy-btn--copied { border-color: #22c55e; color: #22c55e; }

/* ── Two-panel layout (encode/decode tools) ───────────────────── */
.gt-io {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
.gt-io-panel { display: flex; flex-direction: column; gap: 8px; }
.gt-io-panel .gt-textarea { min-height: 220px; }

/* ── Stats bar (word counter) ─────────────────────────────────── */
.gt-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 16px 0 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.gt-stat {
    flex: 1;
    min-width: 100px;
    padding: 14px 12px;
    text-align: center;
    border-right: 1px solid var(--border);
}
.gt-stat:last-child { border-right: none; }
.gt-stat__val {
    display: block;
    font-size: 1.375rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}
.gt-stat__label {
    display: block;
    font-size: .75rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ── Status badge ─────────────────────────────────────────────── */
.gt-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: .8125rem;
    font-weight: 500;
}
.gt-status--ok {
    background: rgba(34,197,94,.12);
    color: #22c55e;
}
.gt-status--error {
    background: rgba(239,68,68,.12);
    color: #ef4444;
}
.gt-status--dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
}

/* ── Case buttons (change-text-case) ─────────────────────────── */
.gt-case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin: 12px 0;
}

/* ── SEO Section ──────────────────────────────────────────────── */
.gt-seo-section {
    padding: 60px 0;
    background: var(--surface-1);
    border-top: 1px solid var(--border);
}
.gt-seo-content {
    max-width: 720px;
}
.gt-seo-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text-primary);
}
.gt-seo-content p {
    color: var(--text-secondary);
    line-height: 1.75;
    margin: 0 0 16px;
}

/* ── FAQ Section ──────────────────────────────────────────────── */
.gt-faq-section {
    padding: 60px 0;
}
.gt-faq-inner {
    max-width: 720px;
}
.gt-faq-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0 0 24px;
    color: var(--text-primary);
}
.gt-faq-list { display: flex; flex-direction: column; gap: 4px; }
.gt-faq-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .2s;
}
.gt-faq-item[open] { border-color: var(--cyan); }
.gt-faq-q {
    padding: 16px 20px;
    font-weight: 600;
    font-size: .9375rem;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    user-select: none;
}
.gt-faq-q::-webkit-details-marker { display: none; }
.gt-faq-q::after {
    content: '+';
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-tertiary);
    flex-shrink: 0;
    transition: transform .2s;
}
.gt-faq-item[open] .gt-faq-q::after {
    content: '−';
}
.gt-faq-a {
    padding: 0 20px 16px;
    color: var(--text-secondary);
    font-size: .9375rem;
    line-height: 1.7;
}

/* ── Related Tools ────────────────────────────────────────────── */
.gt-related-section {
    padding: 56px 0 80px;
    background: var(--surface-1);
    border-top: 1px solid var(--border);
}
.gt-related-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text-primary);
}
.gt-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.gt-related-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    transition: var(--transition);
}
.gt-related-card:hover {
    border-color: var(--cyan);
    transform: translateY(-2px);
}
.gt-related-card__icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gt-related-card__icon .lucide { width: 18px; height: 18px; }
.gt-related-card__name {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.gt-related-card__desc {
    font-size: .8125rem;
    color: var(--text-tertiary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .gt-io { grid-template-columns: 1fr; }
    .gt-stats { flex-direction: row; flex-wrap: wrap; }
    .gt-stat { min-width: 80px; flex: 1 1 calc(33% - 1px); }
    .gt-card { padding: 20px 16px; }
}
@media (max-width: 480px) {
    .gt-stat { flex: 1 1 calc(50% - 1px); }
    .gt-hero__title { font-size: 1.5rem; }
}
