/* =========================================================
   TCDevHub — Text Toolkit
   Claro + profissional + identidade visual
   Claro + Escuro
   ========================================================= */


/* =========================================================
   RESET
   ========================================================= */

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

html {
    scroll-behavior: smooth;
}

:root {
    --tool-bg: #f7f9fc;
    --tool-surface: #ffffff;
    --tool-surface-soft: #fbfcfe;
    --tool-surface-muted: #f8fafc;

    --tool-border: #e1e7ef;
    --tool-border-soft: #e6eaf0;
    --tool-border-input: #dfe5ed;
    --tool-border-hover: #cbd5e1;
    --tool-border-secondary: #d7dee8;
    --tool-border-secondary-hover: #bfc9d8;

    --tool-text: #111827;
    --tool-text-strong: #0f172a;
    --tool-text-body: #334155;
    --tool-text-secondary: #475569;
    --tool-text-muted: #64748b;
    --tool-text-light: #94a3b8;
    --tool-placeholder: #9ca3af;

    --tool-blue: #2563eb;
    --tool-blue-dark: #1d4ed8;
    --tool-blue-border: #93c5fd;
    --tool-blue-soft: rgba(37, 99, 235, 0.08);

    --tool-button-text: #ffffff;

    --tool-header-bg: rgba(255, 255, 255, 0.92);
    --tool-footer-bg: #ffffff;

    --tool-workspace-shadow: rgba(15, 23, 42, 0.035);
    --tool-button-shadow: rgba(37, 99, 235, 0.15);
    --tool-active-shadow: rgba(15, 23, 42, 0.08);
}


/* =========================================================
   TEMA ESCURO
   ========================================================= */

[data-theme="dark"] {
    --tool-bg: #202124;
    --tool-surface: #292a2d;
    --tool-surface-soft: #252629;
    --tool-surface-muted: #303134;

    --tool-border: #3c4043;
    --tool-border-soft: #3c4043;
    --tool-border-input: #5f6368;
    --tool-border-hover: #80868b;
    --tool-border-secondary: #5f6368;
    --tool-border-secondary-hover: #80868b;

    --tool-text: #e8eaed;
    --tool-text-strong: #f8f9fa;
    --tool-text-body: #e8eaed;
    --tool-text-secondary: #bdc1c6;
    --tool-text-muted: #9aa0a6;
    --tool-text-light: #80868b;
    --tool-placeholder: #80868b;

    --tool-blue: #8ab4f8;
    --tool-blue-dark: #aecbfa;
    --tool-blue-border: #8ab4f8;
    --tool-blue-soft: rgba(138, 180, 248, 0.12);

    --tool-button-text: #202124;

    --tool-header-bg: rgba(32, 33, 36, 0.92);
    --tool-footer-bg: #202124;

    --tool-workspace-shadow: rgba(0, 0, 0, 0.30);
    --tool-button-shadow: rgba(138, 180, 248, 0.12);
    --tool-active-shadow: rgba(0, 0, 0, 0.30);
}


body {
    min-height: 100vh;

    background: var(--tool-bg);
    color: var(--tool-text);

    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.5;

    -webkit-font-smoothing: antialiased;
}

.brand-logo {
    display: flex;
    align-items: center;

    flex-shrink: 0;
}

.brand-logo img {
    width: 178px;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}


/* =========================================================
   HEADER
   ========================================================= */

.header {
    position: sticky;
    top: 0;
    z-index: 100;

    background: var(--tool-header-bg);

    border-bottom: 1px solid var(--tool-border-soft);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.header-inner {
    width: min(1180px, calc(100% - 40px));
    min-height: 72px;

    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


/* Logo */

.logo {
    display: flex;
    align-items: center;

    flex-shrink: 0;
}

.logo img {
    width: 178px;
    height: auto;
}


/* Voltar */

.back-link {
    display: inline-flex;
    align-items: center;

    color: var(--tool-text-muted);

    font-size: 14px;
    font-weight: 500;

    transition: color 0.18s ease;
}

.back-link:hover {
    color: var(--tool-text);
}


/* =========================================================
   TOOL PAGE
   ========================================================= */

.tool-page {
    width: min(900px, calc(100% - 40px));

    margin: 0 auto;

    padding: 88px 0 100px;
}


/* =========================================================
   TOOL HEADER
   ========================================================= */

.tool-header {
    margin-bottom: 34px;
}

.tool-label {
    display: inline-flex;
    align-items: center;

    color: var(--tool-blue);

    font-family:
        "IBM Plex Mono",
        monospace;

    font-size: 10px;
    font-weight: 600;

    letter-spacing: 0.13em;
}

.tool-label::before {
    content: "";

    width: 22px;
    height: 2px;

    margin-right: 9px;

    background: var(--tool-blue);

    border-radius: 2px;
}

.tool-header h1 {
    margin-top: 15px;

    color: var(--tool-text-strong);

    font-size: clamp(40px, 6vw, 54px);
    font-weight: 700;

    line-height: 1.04;
    letter-spacing: -0.045em;
}

.tool-header p {
    max-width: 600px;

    margin-top: 15px;

    color: var(--tool-text-muted);

    font-size: 16px;
    line-height: 1.7;
}


/* =========================================================
   WORKSPACE
   ========================================================= */

.tool-workspace {
    padding: 26px;

    background: var(--tool-surface);

    border: 1px solid var(--tool-border);
    border-radius: 10px;

    box-shadow:
        0 8px 24px var(--tool-workspace-shadow);
}


/* =========================================================
   EDITOR
   ========================================================= */

.editor-section {
    width: 100%;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 9px;
}

.editor-header label {
    color: var(--tool-text-body);

    font-size: 13px;
    font-weight: 600;
}

.editor-header span {
    color: var(--tool-text-light);

    font-family:
        "IBM Plex Mono",
        monospace;

    font-size: 10px;
}


/* Textarea */

.text-editor {
    display: block;

    width: 100%;
    min-height: 250px;

    padding: 17px;

    resize: vertical;

    background: var(--tool-surface-soft);
    color: var(--tool-text-strong);

    border: 1px solid var(--tool-border-input);
    border-radius: 8px;

    outline: none;

    font-family:
        "IBM Plex Mono",
        monospace;

    font-size: 13px;
    line-height: 1.7;

    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
}

.text-editor:hover {
    border-color: var(--tool-border-hover);
}

.text-editor:focus {
    background: var(--tool-surface);

    border-color: var(--tool-blue-border);

    box-shadow:
        0 0 0 3px var(--tool-blue-soft);
}

.text-editor::placeholder {
    color: var(--tool-placeholder);
}

.result-editor {
    background: var(--tool-surface-muted);
}

.result-editor:focus {
    background: var(--tool-surface);
}


/* =========================================================
   MODE SELECTOR
   ========================================================= */

.mode-section {
    display: inline-flex;
    align-items: center;

    gap: 4px;

    margin: 22px 0;

    padding: 4px;

    background: var(--tool-surface-muted);

    border: 1px solid var(--tool-border);
    border-radius: 8px;
}

.mode-button {
    min-height: 35px;

    padding: 0 16px;

    background: transparent;
    color: var(--tool-text-muted);

    border: none;
    border-radius: 6px;

    font-size: 13px;
    font-weight: 500;

    transition:
        color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
}

.mode-button:hover {
    color: var(--tool-text-body);
}

.mode-button.active {
    background: var(--tool-surface);
    color: var(--tool-blue-dark);

    box-shadow:
        0 1px 3px var(--tool-active-shadow);
}


/* =========================================================
   OPERATION PANEL
   ========================================================= */

.operation-panel {
    display: flex;
    align-items: flex-end;

    gap: 12px;

    margin-bottom: 28px;
}

.operation-panel[hidden] {
    display: none;
}


/* Select */

.select-group {
    flex: 1;

    display: flex;
    flex-direction: column;

    gap: 7px;
}

.select-group label {
    color: var(--tool-text-secondary);

    font-size: 12px;
    font-weight: 600;
}

.select-group select {
    width: 100%;
    height: 43px;

    padding: 0 12px;

    background: var(--tool-surface);
    color: var(--tool-text-body);

    border: 1px solid var(--tool-border-input);
    border-radius: 7px;

    outline: none;

    font-size: 13px;

    cursor: pointer;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.select-group select:hover {
    border-color: var(--tool-border-hover);
}

.select-group select:focus {
    border-color: var(--tool-blue-border);

    box-shadow:
        0 0 0 3px var(--tool-blue-soft);
}


/* Seta */

.conversion-arrow {
    display: flex;
    align-items: center;
    justify-content: center;

    height: 43px;

    padding-bottom: 1px;

    color: var(--tool-text-light);

    font-size: 16px;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.primary-button,
.secondary-button {
    min-height: 43px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 17px;

    border-radius: 7px;

    font-size: 13px;
    font-weight: 600;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}


/* Principal */

.primary-button {
    background: var(--tool-blue);
    color: var(--tool-button-text);

    border: 1px solid var(--tool-blue);

    box-shadow:
        0 2px 5px var(--tool-button-shadow);
}

.primary-button:hover {
    background: var(--tool-blue-dark);
    border-color: var(--tool-blue-dark);

    transform: translateY(-1px);
}

.primary-button:active {
    transform: translateY(0);
}


/* Secundário */

.secondary-button {
    background: var(--tool-surface);
    color: var(--tool-text-body);

    border: 1px solid var(--tool-border-secondary);
}

.secondary-button:hover {
    background: var(--tool-surface-muted);
    border-color: var(--tool-border-secondary-hover);

    transform: translateY(-1px);
}


/* =========================================================
   STATUS
   ========================================================= */

.status {
    min-height: 20px;

    margin: -4px 0 12px;

    color: var(--tool-text-muted);

    font-family:
        "IBM Plex Mono",
        monospace;

    font-size: 10px;
}

.status:empty {
    display: none;
}


/* =========================================================
   ACTIONS
   ========================================================= */

.tool-actions {
    display: flex;
    align-items: center;

    gap: 8px;

    padding-top: 2px;
}


/* =========================================================
   FOOTER
   ========================================================= */

.footer {
    background: var(--tool-footer-bg);

    border-top: 1px solid var(--tool-border);
}

.footer-inner {
    width: min(900px, calc(100% - 40px));
    min-height: 70px;

    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 30px;

    color: var(--tool-text-light);

    font-size: 11px;
}

.footer-inner div {
    display: flex;
    align-items: center;

    gap: 22px;
}

.footer-inner a {
    color: var(--tool-text-muted);

    transition: color 0.18s ease;
}

.footer-inner a:hover {
    color: var(--tool-text);
}


/* =========================================================
   FOCUS
   ========================================================= */

button:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--tool-blue);
    outline-offset: 3px;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 700px) {

    .tool-page {
        padding-top: 65px;
        padding-bottom: 80px;
    }

    .operation-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .conversion-arrow {
        height: 18px;

        transform: rotate(90deg);
    }

    .primary-button {
        width: 100%;
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 520px) {

    .header-inner {
        width: calc(100% - 28px);

        min-height: 64px;
    }

    .logo img {
        width: 150px;
    }

    .back-link {
        font-size: 13px;
    }


    .tool-page {
        width: calc(100% - 28px);

        padding-top: 52px;
        padding-bottom: 60px;
    }


    .tool-header {
        margin-bottom: 25px;
    }

    .tool-header h1 {
        font-size: 38px;
    }

    .tool-header p {
        font-size: 14px;
    }


    .tool-workspace {
        padding: 17px;

        border-radius: 9px;
    }


    .text-editor {
        min-height: 205px;

        padding: 14px;

        font-size: 12px;
    }


    .mode-section {
        width: 100%;
    }

    .mode-button {
        flex: 1;

        padding: 0 8px;

        font-size: 12px;
    }


    .editor-header label {
        font-size: 12px;
    }

    .editor-header span {
        font-size: 9px;
    }


    .tool-actions {
        display: grid;

        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 7px;
    }

    .secondary-button {
        width: 100%;

        padding: 0 8px;

        font-size: 12px;
    }


    .footer-inner {
        width: calc(100% - 28px);

        min-height: 80px;

        align-items: flex-start;

        flex-direction: column;

        justify-content: center;

        gap: 9px;
    }

}


/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 380px) {

    .header-inner {
        width: calc(100% - 22px);
    }

    .logo img {
        width: 135px;
    }

    .back-link {
        font-size: 12px;
    }


    .tool-page {
        width: calc(100% - 22px);

        padding-top: 42px;
    }


    .tool-header h1 {
        font-size: 34px;
    }


    .tool-workspace {
        padding: 13px;
    }


    .tool-actions {
        grid-template-columns: 1fr;
    }

}

