/*
 * GBC Linktree — estilos alinhados ao Design System GlobalCamps.
 * DS canônico: plugins/gbc-linktree/DESIGN_SYSTEM.md
 *
 * Regras prefixadas com .gbc-lt* ou .gbc-linktree-body
 * para resistir a sobrescritas do tema ativo (hello-theme-child-master).
 */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');

:root {
    /* Paleta de marca (ver DESIGN_SYSTEM.md §1) */
    --gbc-purple: #6155cb;
    --gbc-purple-dark: #4e42a3;
    --gbc-purple-deeper: #3d3484;
    --gbc-lime: #C6E67A;
    --gbc-lime-dark: #A9CC55;
    --gbc-white: #ffffff;
    --gbc-black: #000000;
    --gbc-text: #333333;
    --gbc-bg-page: #f8f8f8;
    --gbc-border: #dddddd;

    /* Tokens estruturais */
    --gbc-radius-lg: 24px;
    --gbc-radius-md: 20px;
    --gbc-radius-pill: 100px;
    --gbc-radius-sm: 6px;
    --gbc-shadow-card: 0 4px 6px rgba(0, 0, 0, 0.1);
    --gbc-shadow-elev: 2px 6px 23.5px rgba(0, 0, 0, 0.25);

    /* Tipografia */
    --gbc-font: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Faixa lime no topo absoluto — detalhe de marca (DS §10) */
html::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gbc-lime);
    z-index: 999999;
    pointer-events: none;
}

html, body.gbc-linktree-body {
    margin: 0 !important;
    padding: 0 !important;
    background:
        linear-gradient(160deg, var(--gbc-purple) 0%, var(--gbc-purple-dark) 65%, var(--gbc-purple-deeper) 100%) !important;
    min-height: 100vh;
    font-family: var(--gbc-font) !important;
    color: var(--gbc-text);
    -webkit-font-smoothing: antialiased;
}

body.gbc-linktree-body #wpadminbar { display: none !important; }
body.gbc-linktree-body.admin-bar { margin-top: 0 !important; padding-top: 0 !important; }

/* Padrão geométrico sutil (DS §11) — linhas diagonais translúcidas */
body.gbc-linktree-body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        repeating-linear-gradient(45deg,
            rgba(255,255,255,0.02) 0,
            rgba(255,255,255,0.02) 2px,
            transparent 2px,
            transparent 14px);
    pointer-events: none;
    z-index: 0;
}

.gbc-lt {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    padding: 36px 20px 48px;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 26px;
}

/* ---------- HEADER / LOGO ---------- */
.gbc-lt__header {
    text-align: center;
    padding-top: env(safe-area-inset-top, 0);
    margin-bottom: 4px;
}
.gbc-lt__logo {
    display: inline-block;
    width: 220px;
    height: auto;
    max-width: 75%;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}
.gbc-lt__logo svg { width: 100%; height: auto; display: block; }

/* ---------- TÍTULOS DE SEÇÃO ---------- */
.gbc-lt__title {
    color: var(--gbc-white) !important;
    font-family: var(--gbc-font) !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    margin: 0 0 14px !important;
    text-align: center;
    letter-spacing: -0.01em;
}
.gbc-lt__title::after {
    content: "";
    display: block;
    width: 40px;
    height: 3px;
    background: var(--gbc-lime);
    margin: 8px auto 0;
    border-radius: 2px;
}

/* ---------- BUSCA ---------- */
.gbc-lt__search { display: flex; flex-direction: column; }

.gbc-lt__search-box {
    position: relative;
    background: var(--gbc-white);
    border-radius: var(--gbc-radius-pill);
    box-shadow: var(--gbc-shadow-card);
    display: flex;
    align-items: center;
    transition: box-shadow 0.18s ease;
}
.gbc-lt__search-box:focus-within {
    box-shadow:
        var(--gbc-shadow-card),
        0 0 0 3px rgba(198, 230, 122, 0.55);
}
.gbc-lt__search-box::before {
    content: "";
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236155cb' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    opacity: 0.9;
    pointer-events: none;
}
.gbc-lt__input {
    flex: 1;
    border: 0 !important;
    outline: none !important;
    padding: 16px 44px 16px 50px !important;
    font-family: var(--gbc-font) !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    background: transparent !important;
    color: var(--gbc-text) !important;
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}
.gbc-lt__input::placeholder { color: #8a869c; }
.gbc-lt__input::-webkit-search-cancel-button { display: none; }
.gbc-lt__input:focus {
    box-shadow: none !important;
    outline: none !important;
}

.gbc-lt__clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 0;
    background: var(--gbc-bg-page);
    color: var(--gbc-purple-dark);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.gbc-lt__clear:hover {
    background: var(--gbc-lime);
    color: var(--gbc-purple-deeper);
}

.gbc-lt__results {
    list-style: none !important;
    margin: 12px 0 0 !important;
    padding: 8px !important;
    background: var(--gbc-white);
    border-radius: var(--gbc-radius-lg);
    box-shadow: var(--gbc-shadow-card);
    max-height: 340px;
    overflow-y: auto;
}
.gbc-lt__results li { list-style: none !important; margin: 0 !important; padding: 0 !important; }

.gbc-lt__result {
    display: block !important;
    padding: 14px 16px !important;
    border-radius: 14px !important;
    color: var(--gbc-text) !important;
    text-decoration: none !important;
    font-family: var(--gbc-font) !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
    border: 0;
    background: transparent;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}
.gbc-lt__result:hover,
.gbc-lt__result:focus,
.gbc-lt__result.is-active {
    background: linear-gradient(135deg, rgba(97,85,203,0.08) 0%, rgba(198,230,122,0.15) 100%) !important;
    color: var(--gbc-purple-dark) !important;
    outline: none !important;
}

.gbc-lt__empty {
    color: var(--gbc-white) !important;
    margin: 10px 0 0 !important;
    text-align: center;
    font-size: 14px;
    opacity: 0.88;
}

/* ---------- ÍCONES SOCIAIS ---------- */
.gbc-lt__socials {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}
.gbc-lt__social {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--gbc-white);
    color: var(--gbc-purple) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: var(--gbc-shadow-card);
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
    text-decoration: none !important;
}
.gbc-lt__social:hover,
.gbc-lt__social:focus {
    background: var(--gbc-lime) !important;
    color: var(--gbc-purple-deeper) !important;
    transform: translateY(-2px);
    outline: none !important;
}
.gbc-lt__social svg { width: 24px; height: 24px; display: block; }

/* ---------- TOP LINKS ---------- */
.gbc-lt__top-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.gbc-lt__link {
    display: block !important;
    padding: 18px 24px !important;
    background: var(--gbc-white) !important;
    color: var(--gbc-purple-dark) !important;
    border: 0 !important;
    border-radius: var(--gbc-radius-pill) !important;
    font-family: var(--gbc-font) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    text-align: center;
    text-decoration: none !important;
    box-shadow: var(--gbc-shadow-card);
    transition: transform 0.12s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    line-height: 1.35;
    position: relative;
    outline: none !important;
}
.gbc-lt__link:hover,
.gbc-lt__link:focus,
.gbc-lt__link:focus-visible,
.gbc-lt__link:active {
    background: linear-gradient(135deg, var(--gbc-white) 0%, #f3f1ff 100%) !important;
    color: var(--gbc-purple-deeper) !important;
    transform: translateY(-2px);
    outline: none !important;
    border: 0 !important;
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.18),
        0 0 0 3px rgba(198, 230, 122, 0.55);
}

/* ---------- FOOTER ---------- */
.gbc-lt__footer {
    margin-top: auto;
    text-align: center;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    letter-spacing: 0.02em;
}

/* ---------- RESPONSIVO ---------- */
@media (min-width: 640px) {
    .gbc-lt { padding: 56px 24px 64px; gap: 30px; }
    .gbc-lt__title { font-size: 24px !important; }
    .gbc-lt__logo { width: 260px; }
}

/* ---------- MODO EDIÇÃO (aparece só p/ admin/author via PHP) ---------- */
.gbc-lt-no-perm-note {
    position: fixed;
    bottom: 16px; left: 16px; right: 16px;
    max-width: 520px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.92);
    color: var(--gbc-purple-deeper);
    border-radius: var(--gbc-radius-lg);
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: var(--gbc-shadow-card);
    z-index: 100;
}

.gbc-lt--editable .gbc-lt-edit-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    background: var(--gbc-white);
    color: var(--gbc-purple);
    border: 0;
    border-radius: var(--gbc-radius-pill);
    padding: 12px 20px;
    font-family: var(--gbc-font);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--gbc-shadow-elev);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s, background 0.15s, color 0.15s;
}
.gbc-lt--editable .gbc-lt-edit-btn:hover {
    background: var(--gbc-lime);
    color: var(--gbc-purple-deeper);
    transform: translateY(-2px);
}

body.gbc-lt-editing {
    /* Espaço inferior para a barra de ações */
    padding-bottom: 90px !important;
}
body.gbc-lt-editing .gbc-lt-edit-btn { display: none; }

.gbc-lt-action-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--gbc-white);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0));
    display: flex;
    gap: 10px;
    justify-content: center;
    z-index: 101;
}
.gbc-lt-btn {
    font-family: var(--gbc-font);
    font-weight: 600;
    font-size: 14px;
    padding: 12px 22px;
    border-radius: var(--gbc-radius-pill);
    border: 0;
    cursor: pointer;
    transition: transform 0.12s, background 0.15s;
}
.gbc-lt-btn--primary { background: var(--gbc-purple); color: #fff; }
.gbc-lt-btn--primary:hover { background: var(--gbc-purple-dark); transform: translateY(-1px); }
.gbc-lt-btn--primary:disabled { background: #a4a0c9; cursor: wait; }
.gbc-lt-btn--ghost { background: transparent; color: var(--gbc-purple); border: 1px solid var(--gbc-border); }
.gbc-lt-btn--ghost:hover { background: var(--gbc-bg-page); }
.gbc-lt-btn--danger { background: #dc3545; color: #fff; }

/* Overlays de edição nos elementos */
body.gbc-lt-editing .gbc-lt__social,
body.gbc-lt-editing .gbc-lt__link {
    position: relative;
}
body.gbc-lt-editing .gbc-lt-edit-overlay {
    position: absolute;
    inset: -6px;
    border: 2px dashed rgba(255, 255, 255, 0.55);
    border-radius: inherit;
    pointer-events: none;
}

.gbc-lt-mini-btn {
    position: absolute;
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 0;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gbc-white);
    box-shadow: var(--gbc-shadow-card);
    z-index: 2;
}
.gbc-lt-mini-btn:hover { transform: scale(1.08); }
.gbc-lt-mini-btn--remove { top: -10px; right: -10px; color: #dc3545; }
.gbc-lt-mini-btn--edit   { top: -10px; left: -10px; color: var(--gbc-purple); }
.gbc-lt-mini-btn--up     { bottom: -10px; left: 30%; color: var(--gbc-purple); }
.gbc-lt-mini-btn--down   { bottom: -10px; right: 30%; color: var(--gbc-purple); }

.gbc-lt-add-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.15);
    color: var(--gbc-white);
    border: 2px dashed rgba(255, 255, 255, 0.45);
    border-radius: var(--gbc-radius-lg);
    font-family: var(--gbc-font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.gbc-lt-add-btn:hover {
    background: var(--gbc-white);
    color: var(--gbc-purple-dark);
    border-color: var(--gbc-lime);
}

/* Modal genérico (form de edição) */
.gbc-lt-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(61, 52, 132, 0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.gbc-lt-modal {
    background: var(--gbc-white);
    border-radius: var(--gbc-radius-lg);
    box-shadow: var(--gbc-shadow-elev);
    max-width: 420px;
    width: 100%;
    padding: 24px;
    font-family: var(--gbc-font);
}
.gbc-lt-modal h3 {
    margin: 0 0 16px;
    color: var(--gbc-purple-dark);
    font-size: 18px;
    font-weight: 700;
}
.gbc-lt-modal label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gbc-text);
    margin: 12px 0 6px;
}
.gbc-lt-modal input,
.gbc-lt-modal select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid var(--gbc-border);
    border-radius: 10px;
    font-family: var(--gbc-font);
    font-size: 14px;
    background: #fff;
    color: var(--gbc-text);
}
.gbc-lt-modal input:focus,
.gbc-lt-modal select:focus {
    outline: none;
    border-color: var(--gbc-purple);
    box-shadow: 0 0 0 3px rgba(97, 85, 203, 0.18);
}
.gbc-lt-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ---- QR Code modal ---- */
.gbc-lt-qr-modal { max-width: 440px; }
.gbc-lt-qr-desc {
    font-size: 13px;
    color: #555;
    margin: 0 0 16px;
    line-height: 1.5;
}
.gbc-lt-qr-preview {
    width: 280px;
    height: 280px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--gbc-shadow-card);
    overflow: hidden;
}
.gbc-lt-qr-preview canvas,
.gbc-lt-qr-preview svg {
    width: 100%;
    height: auto;
    display: block;
}
.gbc-lt-qr-url {
    margin: 0 0 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--gbc-purple-deeper);
    word-break: break-all;
    text-align: center;
    background: var(--gbc-bg-page);
    padding: 8px 12px;
    border-radius: 10px;
}
.gbc-lt-qr-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
}
.gbc-lt-qr-controls label {
    margin: 0 !important;
}

.gbc-lt-action-bar__spacer { flex: 1; }

@media (max-width: 480px) {
    .gbc-lt-btn--qr span,
    .gbc-lt-btn--qr { font-size: 13px; padding: 10px 14px; }
}
