/* ==========================================
   Foundation: base + form controls + feedback
   ========================================== */

/* Reset mínimo */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base da página (pode ser sobrescrito localmente) */
body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

h1 {
    color: #1a1a1a;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    width: 100%;
}

.panel-container {
    width: 100%;
    max-width: 500px;
}

/* Bloco padrão de formulário/cartão */
form {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: none;
    width: 100%;
}

/* Grupos e textos de apoio */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    font-size: 14px;
}

small {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 4px;
}

/* Campos padrão */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    background-color: #fafafa;
    font-family: inherit; /* força herança da fonte do body */
    resize: vertical; /* permite redimensionar só verticalmente */
}

textarea {
    min-height: 100px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #4a90d9;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

/* Botão base */
button {
    width: 100%;
    padding: 14px;
    background-color: #4a90d9;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        transform 0.1s ease;
    margin-top: 5px;
}

button:hover {
    background-color: #357abd;
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.6;
    pointer-events: none;
}

.button-wrapper {
    cursor: default;
}

.button-wrapper:has(button:disabled) {
    cursor: wait;
}

/* Mensagens de feedback (nova API por classes) */
.feedback-message {
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    margin-top: 20px;
    padding: 12px;
}

.feedback-message.error {
    background-color: #fee;
    color: #c0392b;
    border: 1px solid #f5c6cb;
    white-space: pre-line;
}

.feedback-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.feedback-message.processing {
    background-color: #f0f2f5;
    color: #555;
    border: 1px solid #ddd;
}

/* Compat temporária com IDs já existentes */
#signin-msg,
#signup-message,
#create-user-msg,
#create-animal-msg,
#edit-user-msg,
.success-message,
.error-message {
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

#signin-msg.error,
#signup-message.error,
#create-user-msg.error,
#create-animal-msg.error,
#edit-user-msg.error,
.error-message {
    background-color: #fee;
    color: #c0392b;
    border: 1px solid #f5c6cb;
    white-space: pre-line;
    margin-top: 20px;
    padding: 12px;
}

#signin-msg.success,
#signup-message.success,
#create-user-msg.success,
#create-animal-msg.success,
#edit-user-msg.success,
.success-message {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    margin-top: 20px;
    padding: 12px;
}

#signin-msg.processing,
#signup-message.processing,
#create-user-msg.processing,
#create-animal-msg.processing,
#edit-user-msg.processing {
    background-color: #f0f2f5;
    color: #555;
    border: 1px solid #ddd;
    margin-top: 20px;
    padding: 12px;
}

/* ==========================================
   Admin: Componentes e Utilitários Globais
   ========================================== */

.admin-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.admin-description {
    margin-bottom: 25px;
    color: #555;
    text-align: center;
}

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group-relative {
    position: relative;
}

/* Links de Navegação / Voltar */
.back-link-wrapper {
    margin-top: 20px;
    text-align: center;
}

.back-link {
    color: #4a90d9;
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    text-decoration: underline;
}

/* Botões Administrativos */
.btn-admin-primary {
    background-color: #4a90d9;
    color: white;
}

.btn-admin-primary:hover {
    background-color: #357abd;
}

/* Campos somente leitura */
input[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Lista de dados em formato rótulo/valor (fichas read-only) */
.info-list {
    text-align: left;
    margin-bottom: 20px;
}

.info-list-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e1e5e9;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    font-size: 14px;
}

.info-label {
    font-weight: 600;
    color: #666;
}

.info-value {
    color: #333;
    text-align: right;
    word-break: break-word;
}

/* Dado ainda não preenchido (cadastro incompleto) */
.field-pending {
    color: #999;
    font-style: italic;
}

/* 🐾 Cabeçalho de ficha de animal: nome + badge de espécie.
   Reutilizado por animal-view, animal-vaccines e futuras fichas. */
.animal-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e5e9;
}

.animal-view-title {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    text-align: left;
}

.animal-view-badge {
    background-color: #e7f3ec;
    color: #276749;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* ==========================================
   Componente: User Autocomplete (<user-autocomplete>)
   ========================================== */

.autocomplete-container {
    position: relative;
    width: 100%;
}

.search-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.search-input {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.autocomplete-dropdown,
.search-results-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: -1px;
    right: -1px;
    width: auto;
    z-index: 100;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-dropdown.is-active,
.search-results-dropdown.is-active {
    display: block;
}

.search-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    background-color: #ffffff;
    text-align: left;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.search-item:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

.search-item:hover span {
    color: #475569 !important;
}

.search-item.is-error {
    color: #ef4444;
}

.search-item.is-empty {
    color: #64748b;
    cursor: default;
}

.search-item-meta {
    font-size: 0.85rem;
    color: #64748b;
    margin-left: 8px;
    font-style: italic;
}

/* ==========================================
   Loading Spinner para Autocomplete
   ========================================== */

.search-loading {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner .path {
    stroke: #3b82f6;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* ==========================================
   Site público: tokens + blocos reutilizáveis
   (componentes comuns a páginas de conteúdo)
   ========================================== */

:root {
    --brand: #2f855a;
    --brand-dark: #276749;
    --brand-soft: #e7f3ec;
    --ink: #1f2937;
    --muted: #5b6574;
    --surface: #ffffff;
    --soft: #f6f9f7;
    --line: #e6ebe8;
    --radius: 14px;
    --shadow-sm: 0 1px 3px rgba(31, 41, 55, 0.06);
    --shadow-md: 0 10px 30px rgba(31, 41, 55, 0.08);
    --font-sans:
        "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Cabeçalho / navegação padrão ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding-top: 14px;
    padding-bottom: 14px;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
    color: var(--ink);
    text-decoration: none;
}

.site-brand__paw {
    font-size: 20px;
}

.site-nav__link {
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--ink);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.site-nav__link:hover {
    background-color: var(--brand-soft);
    color: var(--brand-dark);
}

.site-nav__cta {
    margin-left: 6px;
}

/* ---------- Rótulo pequeno em caixa alta (acima de títulos) ---------- */

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand);
    margin-bottom: 10px;
}

/* ---------- Botão / chamada para ação (genérico) ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.1s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background-color: var(--brand);
    color: #ffffff;
}

.btn--primary:hover {
    background-color: var(--brand-dark);
}

.btn--ghost {
    background-color: transparent;
    color: var(--brand-dark);
    border-color: var(--brand);
}

.btn--ghost:hover {
    background-color: var(--brand-soft);
}

/* ---------- Rodapé do site ---------- */

.site-footer {
    border-top: 1px solid var(--line);
    background-color: var(--surface);
    padding: 24px 0;
}

.site-footer__inner {
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

/* ---------- Ritmo de seção (escala vertical) ---------- */

.section {
    padding: 72px 0;
}

.section--soft {
    background-color: var(--soft);
}

.section__title {
    margin-bottom: 14px;
}
