/*
 * base.css
 * Tokens de cor, tipografia, reset e componentes genéricos (botões de ícone,
 * tooltips e menus flutuantes) compartilhados pelas páginas do TicketFarma.
 * Carregado em: index.php e login.php.
 */

:root {
    --bg-page: #fcfcfc;
    --bg-surface: #ffffff;
    --bg-sidebar: #f9f9f9;
    --bg-hover: #efefef;
    --bg-active: #e8e8e8;
    --bg-pill: #f4f4f4;
    --bg-bubble: #f4f4f4;
    --bg-code: #f9f9f9;

    --text-primary: #0d0d0d;
    --text-secondary: #5d5d5d;
    --text-tertiary: #8f8f8f;
    --text-placeholder: #8f8f8f;

    --border-light: #e5e5e5;
    --border-medium: #e2e2e2;
    --border-heavy: #d9d9d9;

    --accent: #3a83f7;
    --accent-hover: #2f72e0;
    --accent-text: #0169cc;
    --danger: #e02e2a;
    --avatar: #da702a;

    --shadow-composer: 0 4px 4px 0 rgba(0, 0, 0, 0.04), 0 0 1px 0 rgba(0, 0, 0, 0.62);
    --shadow-menu: 0 8px 24px rgba(0, 0, 0, 0.10), 0 0 1px rgba(0, 0, 0, 0.45);

    --sidebar-rail: 52px;
    --sidebar-width: 260px;
    --header-height: 52px;
    --thread-width: 768px;

    --font-sans: ui-sans-serif, -apple-system, system-ui, "Segoe UI", "Helvetica Neue", Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

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

svg.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

svg.icon-sm {
    width: 16px;
    height: 16px;
}

/* Botão quadrado de ícone (barra lateral, cabeçalho) */
.icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-primary);
    transition: background-color 0.15s var(--ease);
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
    background-color: var(--bg-hover);
}

.icon-btn:focus-visible,
.menu-item:focus-visible,
.history-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Tooltip escuro em formato de pílula, com atalho de teclado opcional.
   Criado e posicionado por js/tooltips.js para nunca sair da tela. */
.tooltip {
    position: fixed;
    z-index: 90;
    top: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100vw - 16px);
    padding: 6px 12px;
    border-radius: 9999px;
    background: #000;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transition: opacity 0.1s var(--ease);
}

.tooltip.visivel {
    opacity: 1;
}

.tooltip-atalho {
    padding: 0 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    color: rgba(255, 255, 255, 0.9);
}

/* Menus flutuantes (perfil, botão +) */
.popover {
    position: absolute;
    z-index: 50;
    min-width: 220px;
    padding: 6px;
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-menu);
    opacity: 0;
    transform: translateY(4px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.12s var(--ease), transform 0.12s var(--ease);
}

.popover.open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 20px;
    text-align: left;
    color: var(--text-primary);
}

.menu-item:hover {
    background-color: var(--bg-hover);
}

.menu-item .menu-check {
    margin-left: auto;
    color: var(--accent);
    visibility: hidden;
}

.menu-item[aria-checked="true"] .menu-check {
    visibility: visible;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
