/* =========================================================
   TCDevHub — Color Converter
   ========================================================= */

:root {
    color-scheme: light;

    --bg: #f7f9fc;
    --surface: #ffffff;

    --text: #111827;
    --muted: #667085;
    --subtle: #98a2b3;

    --border: #e4e7ec;
    --border-strong: #d0d5dd;

    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-soft: #eff6ff;

    --header-bg: rgba(255, 255, 255, 0.96);
    --picker-bg: #fbfcfe;
    --input-bg: #ffffff;
    --button-hover-bg: #f9fafb;

    --cursor-border: #ffffff;
    --cursor-shadow: rgba(17, 24, 39, 0.35);
    --input-focus-ring: rgba(37, 99, 235, 0.08);
    --color-border: rgba(17, 24, 39, 0.08);
    --slider-shadow: rgba(17, 24, 39, 0.2);

    --lightness-start: #111827;
    --lightness-end: #ffffff;

    --radius: 14px;
    --radius-small: 10px;
}

[data-theme="dark"] {
    color-scheme: dark;

    --bg: #202124;
    --surface: #292a2d;

    --text: #e8eaed;
    --muted: #bdc1c6;
    --subtle: #9aa0a6;

    --border: #3c4043;
    --border-strong: #5f6368;

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

    --header-bg: rgba(32, 33, 36, 0.96);
    --picker-bg: #252629;
    --input-bg: #292a2d;
    --button-hover-bg: #303134;

    --cursor-border: #ffffff;
    --cursor-shadow: rgba(0, 0, 0, 0.55);
    --input-focus-ring: rgba(138, 180, 248, 0.15);
    --color-border: rgba(232, 234, 237, 0.12);
    --slider-shadow: rgba(0, 0, 0, 0.45);

    --lightness-start: #000000;
    --lightness-end: #ffffff;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

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


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

.color-page {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}


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

.tool-header {
    margin: 0 -20px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
}

.header-content {
    width: min(1180px, calc(100% - 40px));
    min-height: 76px;
    margin: 0 auto;

    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 28px;
}

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

.tool-logo {
    display: block;
    width: 148px;
    height: auto;
}

.tool-header-info {
    min-width: 0;
}

.tool-eyebrow {
    display: block;
    margin-bottom: 4px;

    color: var(--subtle);
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.tool-header-info h1 {
    margin: 0;

    font-size: 16px;
    line-height: 1.3;
    font-weight: 700;
}

.tool-description {
    display: none;
}

.tool-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: var(--muted);
    font-size: 13px;
    font-weight: 600;

    transition:
        color 0.15s ease,
        transform 0.15s ease;
}

.tool-back:hover {
    color: var(--text);
    transform: translateX(-2px);
}


/* =========================
   INTRO
========================= */

.tool-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;

    padding: 64px 0 38px;
}

.tool-kicker,
.section-label,
.control-label {
    display: block;

    color: var(--blue);
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.tool-intro h2 {
    margin: 10px 0 8px;

    font-size: clamp(32px, 5vw, 46px);
    line-height: 1.08;
    letter-spacing: -0.04em;
    font-weight: 800;
}

.tool-intro p {
    max-width: 600px;
    margin: 0;

    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
}

.tool-intro-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-bottom: 4px;
}

.tool-intro-meta span {
    padding: 7px 10px;

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

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

    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    font-weight: 500;
}


/* =========================
   COLOR TOOL
========================= */

.color-tool {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(380px, 1.1fr);

    overflow: hidden;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}


/* =========================
   PICKER
========================= */

.color-picker {
    min-height: 560px;
    padding: 40px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    background: var(--picker-bg);
    border-right: 1px solid var(--border);
}

.canvas-wrapper {
    position: relative;

    width: min(100%, 390px);
    aspect-ratio: 1;

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

.colorWheel {
    display: block;

    width: 100%;
    height: 100%;

    border-radius: 50%;
    touch-action: none;
    cursor: crosshair;
}

.color-picker-cursor {
    position: absolute;

    width: 18px;
    height: 18px;

    border: 3px solid var(--cursor-border);
    border-radius: 50%;

    box-shadow:
        0 0 0 1px var(--cursor-shadow);

    pointer-events: none;
    transform: translate(-50%, -50%);
}

.lightness-wrapper {
    width: min(100%, 390px);
    margin-top: 28px;
}

.control-label {
    margin-bottom: 10px;
    color: var(--subtle);
}

.lightness {
    width: 100%;
    height: 8px;

    appearance: none;
    -webkit-appearance: none;

    border: 0;
    border-radius: 999px;

    background: linear-gradient(
        to right,
        var(--lightness-start),
        var(--lightness-end)
    );

    outline: none;
    cursor: pointer;
}

.lightness::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;

    width: 20px;
    height: 20px;

    border: 3px solid var(--cursor-border);
    border-radius: 50%;

    background: var(--blue);

    box-shadow:
        0 0 0 1px var(--slider-shadow);

    cursor: pointer;
}

.lightness::-moz-range-thumb {
    width: 20px;
    height: 20px;

    border: 3px solid var(--cursor-border);
    border-radius: 50%;

    background: var(--blue);

    box-shadow:
        0 0 0 1px var(--slider-shadow);

    cursor: pointer;
}


/* =========================
   COLOR INFO
========================= */

.color-info {
    padding: 40px;
}


/* Preview */

.color-preview {
    display: flex;
    align-items: center;
    gap: 16px;

    padding-bottom: 28px;

    border-bottom: 1px solid var(--border);
}

.amostra {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;

    border-radius: 12px;

    background: #3b82f6;

    border: 1px solid var(--color-border);
}

.preview-content {
    min-width: 0;
}

.preview-label {
    display: block;
    margin-bottom: 5px;

    color: var(--muted);
    font-size: 12px;
}

.preview-hex {
    display: block;

    font-family: "IBM Plex Mono", monospace;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}


/* Values */

.color-values {
    display: grid;
    gap: 18px;

    padding: 28px 0;
}

.color-value > span {
    display: block;
    margin-bottom: 8px;

    color: var(--subtle);
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.value-row {
    display: flex;
    gap: 8px;
}

.value-row input {
    min-width: 0;
    width: 100%;
    height: 42px;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

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

    font-family: "IBM Plex Mono", monospace;
    font-size: 13px;

    outline: none;

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

.value-row input:focus {
    border-color: var(--blue);

    box-shadow:
        0 0 0 3px var(--input-focus-ring);
}

.copiar {
    flex: 0 0 auto;

    height: 42px;
    padding: 0 14px;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

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

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

    transition:
        border-color 0.15s ease,
        background 0.15s ease;
}

.copiar:hover {
    border-color: var(--border-strong);
    background: var(--button-hover-bg);
}


/* Actions */

.color-actions {
    display: flex;
    gap: 10px;

    padding-top: 4px;
}

.btn-color {
    min-height: 42px;
    padding: 0 16px;

    border-radius: var(--radius-small);

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

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

.btn-aleatoria {
    border: 1px solid var(--blue);
    background: var(--blue);
    color: var(--button-primary-text);
}

.btn-aleatoria:hover {
    background: var(--blue-dark);
}

.btn-limpar {
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
}

.btn-limpar:hover {
    border-color: var(--border-strong);
    background: var(--button-hover-bg);
}


/* =========================
   PALETTE
========================= */

.palette {
    margin-top: 24px;
    padding: 30px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.palette-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.palette-header .section-label {
    margin-bottom: 8px;
    color: var(--subtle);
}

.palette-header h2 {
    margin: 0 0 5px;

    font-size: 20px;
    line-height: 1.3;
}

.palette-header p {
    margin: 0;

    color: var(--muted);
    font-size: 13px;
}

.btn-adicionar {
    min-height: 40px;
    padding: 0 14px;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

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

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

    transition:
        border-color 0.15s ease,
        background 0.15s ease;
}

.btn-adicionar:hover {
    border-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue);
}

.palette-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;

    margin-top: 24px;
}

.palette-list:empty {
    display: block;
    min-height: 70px;
    margin-top: 20px;

    border: 1px dashed var(--border);
    border-radius: var(--radius-small);
}

.palette-list:empty::after {
    content: "Nenhuma cor adicionada ainda.";

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

    min-height: 70px;

    color: var(--subtle);
    font-size: 12px;
}


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

.tool-footer {
    min-height: 90px;
    margin-top: 42px;
    padding: 22px 0;

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

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

    color: var(--subtle);
    font-size: 11px;
}

.tool-footer-brand img {
    display: block;
    width: 128px;
    height: auto;
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {

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

    .color-picker {
        min-height: auto;
        padding: 34px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .canvas-wrapper,
    .lightness-wrapper {
        width: min(100%, 420px);
    }

    .color-info {
        padding: 34px;
    }
}


@media (max-width: 700px) {

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

    .tool-header {
        margin: 0 -14px;
    }

    .header-content {
        width: calc(100% - 28px);
        min-height: 68px;

        grid-template-columns: auto 1fr auto;
        gap: 16px;
    }

    .tool-logo {
        width: 124px;
    }

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

    .tool-eyebrow {
        font-size: 9px;
    }

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

    .tool-back span {
        display: none;
    }

    .tool-intro {
        align-items: flex-start;
        flex-direction: column;
        padding: 46px 0 28px;
    }

    .tool-intro h2 {
        font-size: 34px;
    }

    .tool-intro-meta {
        padding-bottom: 0;
    }

    .color-picker {
        padding: 28px 22px;
    }

    .color-info {
        padding: 28px 22px;
    }

    .palette {
        padding: 24px 20px;
    }
}


@media (max-width: 430px) {

    .tool-header-info {
        display: none;
    }

    .header-content {
        grid-template-columns: 1fr auto;
    }

    .tool-logo {
        width: 132px;
    }

    .tool-intro {
        padding-top: 38px;
    }

    .tool-intro h2 {
        font-size: 30px;
    }

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

    .color-picker {
        padding: 22px 16px;
    }

    .color-info {
        padding: 24px 16px;
    }

    .color-preview {
        padding-bottom: 22px;
    }

    .preview-hex {
        font-size: 19px;
    }

    .value-row {
        flex-direction: column;
    }

    .copiar {
        width: 100%;
    }

    .color-actions {
        flex-direction: column;
    }

    .btn-color {
        width: 100%;
    }

    .palette {
        padding: 22px 16px;
    }

    .palette-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .btn-adicionar {
        width: 100%;
    }

    .tool-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 20px 0;
    }
}