/* ============================================================
   style.css — Oliveira Imóveis | Design System Customizado
   Complementa o Tailwind CSS com classes nomeadas,
   animações e micro-interações premium.
   ============================================================ */

/* ─── Tokens de Tema: Modo Claro (padrão) ───────────────── */
:root,
[data-theme="claro"] {
    --bg-body:        #F8FAFC;
    --bg-card:        #ffffff;
    --bg-panel:       #ffffff;
    --bg-specs:       #f8fafc;
    --bg-input:       #f8fafc;
    --bg-input-focus: #ffffff;
    --bg-filtro:      #ffffff;
    --bg-page-btn:    #ffffff;
    --bg-info:        #eef2f7;
    --bg-diferenciais: linear-gradient(180deg, #F8FAFC 0%, #eef2f7 100%);

    --text-body:      #333333;
    --text-muted:     #64748b;
    --text-label:     #1C3048;
    --text-spec:      #555555;
    --text-checkbox:  #4a5568;
    --text-gray-500:  #6b7280;
    --text-gray-600:  #4b5563;
    --text-gray-400:  #9ca3af;

    --border-input:   #e2e8f0;
    --border-page:    #e2e8f0;
    --border-card:    #f0f4f8;

    --scrollbar-track:#F8FAFC;
    --scrollbar-thumb:#1C3048;

    --section-title:  #1C3048;
    --section-sub:    #64748b;

    --gallery-bg:     #e2e8f0;
    --hero-wave:      #F8FAFC;

    color-scheme: light;
}

/* ─── Tokens de Tema: Modo Escuro ────────────────────────── */
[data-theme="escuro"] {
    --bg-body:        #0f1923;
    --bg-card:        #1a2636;
    --bg-panel:       #1a2636;
    --bg-specs:       #162030;
    --bg-input:       #1e2d40;
    --bg-input-focus: #243347;
    --bg-filtro:      #1a2636;
    --bg-page-btn:    #1a2636;
    --bg-info:        #162030;
    --bg-diferenciais: linear-gradient(180deg, #0f1923 0%, #111e2c 100%);

    --text-body:      #e2e8f0;
    --text-muted:     #94a3b8;
    --text-label:     #90b8d8;
    --text-spec:      #94a3b8;
    --text-checkbox:  #94a3b8;
    --text-gray-500:  #94a3b8;
    --text-gray-600:  #94a3b8;
    --text-gray-400:  #64748b;

    --border-input:   #2d4057;
    --border-page:    #2d4057;
    --border-card:    #243347;

    --scrollbar-track:#0f1923;
    --scrollbar-thumb:#2a4a6b;

    --section-title:  #e2e8f0;
    --section-sub:    #94a3b8;

    --gallery-bg:     #1a2636;
    --hero-wave:      #0f1923;

    color-scheme: dark;
}

/* ─── Reset e Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 400; /* Inter Regular */
    background-color: var(--bg-body);
    color: var(--text-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Títulos */
h1, h2, h3, .section-title, .title, .titulo {
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700 !important; /* Montserrat Bold */
}

/* Subtítulos */
h4, h5, h6, .section-subtitle, .subtitle, .subtitulo {
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 600 !important; /* Montserrat SemiBold */
}

/* x-cloak: esconde elementos Alpine até hidratação */
[x-cloak] { display: none !important; }

/* ─── Scrollbar Customizada ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #2a4a6b; }

/* ─── Seleção de texto ───────────────────────────────────── */
::selection { background: #FFCC00; color: #1C3048; }

/* ─── Navbar ─────────────────────────────────────────────── */
.nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s ease;
    text-decoration: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #FFCC00;
    border-radius: 99px;
    transition: width 0.25s ease;
}

.nav-link:hover {
    color: #FFCC00;
}

.nav-link:hover::after {
    width: 100%;
}

/* ─── Card de Imóvel ─────────────────────────────────────── */
.card-imovel {
    background: var(--bg-card);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(28, 48, 72, 0.08);
    transition: box-shadow 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card-imovel:hover {
    box-shadow: 0 16px 48px rgba(28, 48, 72, 0.16);
    transform: translateY(-4px);
}

.card-imovel-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.card-imovel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card-imovel:hover .card-imovel-thumb img {
    transform: scale(1.06);
}

/* Badge de preço no card */
.badge-preco {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: #FFCC00;
    color: #1C3048;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.375rem 0.875rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    line-height: 1.2;
    white-space: nowrap;
}

/* Badge overlay de vendido */
.badge-vendido-overlay {
    position: absolute;
    inset: 0;
    background: rgba(28, 48, 72, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-vendido-overlay span {
    color: white;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 0.08em;
    border: 3px solid white;
    padding: 0.25rem 1.5rem;
    transform: rotate(-12deg);
    border-radius: 0.25rem;
}

/* Tags de característica (Financia, Vazio...) */
.tag-badge {
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

/* Ícones de specs do imóvel (quartos, banheiros...) */
.spec-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-spec);
    font-size: 0.8125rem;
    font-weight: 500;
}

.spec-item svg {
    color: #1C3048;
    flex-shrink: 0;
}

/* ─── Botão WhatsApp Flutuante ───────────────────────────── */
.btn-whatsapp-float {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    z-index: 9999;
    width: 3.5rem;
    height: 3.5rem;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.5);
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-whatsapp-float:hover {
    transform: scale(1.12);
    box-shadow: 0 8px 28px rgba(37, 211, 102, 0.65);
}

/* Pulse animado ao redor do botão */
.btn-whatsapp-float::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.35);
    animation: wa-pulse 2s ease-out infinite;
    pointer-events: none;
}

@keyframes wa-pulse {
    0%   { transform: scale(1); opacity: 1; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Tooltip do botão WhatsApp */
.btn-whatsapp-float .wa-tooltip {
    position: absolute;
    right: calc(100% + 0.75rem);
    background: #1C3048;
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.4rem 0.875rem;
    border-radius: 0.5rem;
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.btn-whatsapp-float .wa-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #1C3048;
}

.btn-whatsapp-float:hover .wa-tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* ─── Filtro de Busca ────────────────────────────────────── */
.filtro-card {
    background: var(--bg-filtro);
    border-radius: 1.25rem;
    box-shadow: 0 4px 32px rgba(28, 48, 72, 0.10);
    padding: 1.75rem;
    transition: background-color 0.3s ease;
}

.filtro-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-label);
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

.filtro-input {
    width: 100%;
    border: 1.5px solid var(--border-input);
    border-radius: 0.625rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--text-body);
    background: var(--bg-input);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.filtro-input:focus {
    border-color: #1C3048;
    box-shadow: 0 0 0 3px rgba(28, 48, 72, 0.10);
    background: var(--bg-input-focus);
}

.filtro-input::placeholder {
    color: #a0aec0;
}

.filtro-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-checkbox);
    user-select: none;
    transition: color 0.15s ease;
}

.filtro-checkbox-label:hover {
    color: #1C3048;
}

.filtro-checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #1C3048;
    cursor: pointer;
}

/* ─── Botões Primários e Secundários ────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #1C3048;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.75rem 1.75rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    line-height: 1;
}

.btn-primary:hover {
    background: #2a4a6b;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(28, 48, 72, 0.25);
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #FFCC00;
    color: #1C3048;
    font-weight: 700;
    font-size: 0.9375rem;
    padding: 0.75rem 1.75rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    line-height: 1;
}

.btn-secondary:hover {
    background: #e6b800;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 204, 0, 0.4);
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #25D366;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.75rem 1.75rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    line-height: 1;
}

.btn-whatsapp:hover {
    background: #20b85a;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

/* ─── Redes Sociais no Footer ────────────────────────────── */
.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255,255,255,0.1);
    border-radius: 0.6rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.social-icon:hover {
    background: #FFCC00;
    color: #1C3048;
    transform: translateY(-2px);
}

/* ─── Seção de Título ────────────────────────────────────── */
.section-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--section-title);
    line-height: 1.2;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--section-sub);
    line-height: 1.6;
}

.section-divider {
    width: 3.5rem;
    height: 4px;
    background: linear-gradient(90deg, #FFCC00, #FFE066);
    border-radius: 99px;
    margin: 0.75rem 0 1.5rem 0;
}

/* ─── Galeria do Imóvel ──────────────────────────────────── */
.gallery-main {
    border-radius: 1rem;
    overflow: hidden;
    aspect-ratio: 16/9;
    background: var(--gallery-bg);
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.gallery-thumb {
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb:hover,
.gallery-thumb.active {
    border-color: #FFCC00;
}

/* ─── Formulários ────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-label);
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    border: 1.5px solid var(--border-input);
    border-radius: 0.625rem;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: var(--text-body);
    background: var(--bg-card);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.form-input:focus {
    border-color: #1C3048;
    box-shadow: 0 0 0 3px rgba(28, 48, 72, 0.10);
}

.form-input::placeholder { color: #a0aec0; }

textarea.form-input { resize: vertical; min-height: 130px; }

/* ─── Paginação ─────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-top: 3rem;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: 1.5px solid var(--border-page);
    color: var(--text-label);
    background: var(--bg-page-btn);
    transition: all 0.2s ease, background-color 0.3s ease;
}

.page-btn:hover {
    background: #1C3048;
    color: #fff;
    border-color: #1C3048;
}

.page-btn.active {
    background: #1C3048;
    color: #fff;
    border-color: #1C3048;
}

.page-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ─── Alert / Mensagem de Feedback ──────────────────────── */
.alert {
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }

/* ─── Utilitários ────────────────────────────────────────── */
.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.line-clamp-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ─── Responsividade Extra ───────────────────────────────── */
@media (max-width: 640px) {
    .badge-preco { font-size: 0.875rem; padding: 0.3rem 0.7rem; }
    .filtro-card { padding: 1.25rem; }
    .btn-whatsapp-float { bottom: 1.25rem; right: 1.25rem; width: 3.25rem; height: 3.25rem; }
}

/* ─── Animações de Entrada ───────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }

/* ─── Botão Toggle de Tema ───────────────────────────────── */
.btn-toggle-tema {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.375rem;
    height: 2.375rem;
    border-radius: 0.625rem;
    border: 1.5px solid rgba(255, 204, 0, 0.55);
    cursor: pointer;
    background: rgba(255, 204, 0, 0.15);
    color: #FFCC00;
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.btn-toggle-tema:hover {
    background: rgba(255, 204, 0, 0.30);
    border-color: #FFCC00;
    color: #FFCC00;
    transform: rotate(20deg) scale(1.1);
}

.btn-toggle-tema:active {
    transform: scale(0.92);
}

.btn-toggle-tema .hidden {
    display: none;
}

/* Transição suave em elementos que mudam de cor com o tema */
.card-imovel,
.filtro-card,
.filtro-input,
.form-input,
.page-btn {
    transition-property: background-color, color, border-color, box-shadow, transform;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

/* ─── Dark mode: paineis brancos hard-coded ─────────────────── */
/* Aplica bg-panel a qualquer div/section com bg-white que não usa classes dinamicas */
[data-theme="escuro"] .bg-white {
    background-color: var(--bg-panel) !important;
}

[data-theme="escuro"] .bg-gray-50 {
    background-color: var(--bg-specs) !important;
}

[data-theme="escuro"] .bg-gray-100 {
    background-color: var(--bg-specs) !important;
}

/* Textos hard-coded com Tailwind que precisam mudar no escuro */
[data-theme="escuro"] .text-gray-500,
[data-theme="escuro"] .text-gray-400,
[data-theme="escuro"] .text-gray-600 {
    color: var(--text-gray-500) !important;
}

[data-theme="escuro"] .text-gray-700,
[data-theme="escuro"] .text-gray-800 {
    color: var(--text-body) !important;
}

/* Bordas --  */
[data-theme="escuro"] .border-b,
[data-theme="escuro"] .border-t {
    border-color: var(--border-card) !important;
}

/* Título do card de imóvel hard-coded com style="color:#1C3048" */
[data-theme="escuro"] .card-imovel h3 a,
[data-theme="escuro"] .card-imovel h3 {
    color: var(--text-body) !important;
}

/* Seção diferenciais (bg inline) */
[data-theme="escuro"] #diferenciais {
    background: var(--bg-diferenciais) !important;
}

/* Ondas SVG do hero (fill hardcoded) */
[data-theme="escuro"] #hero path[fill="#F8FAFC"] {
    fill: var(--hero-wave) !important;
}

/* Textos com style inline color:#1C3048 dentro de paineis */
[data-theme="escuro"] .shadow-card p[style*="color: #1C3048"],
[data-theme="escuro"] .shadow-card h1[style*="color: #1C3048"],
[data-theme="escuro"] .shadow-card h2[style*="color: #1C3048"],
[data-theme="escuro"] .shadow-card h3[style*="color: #1C3048"],
[data-theme="escuro"] .shadow-card span[style*="color: #1C3048"] {
    color: var(--text-label) !important;
}

/* Seção info cadastro (bg:#eef2f7 hardcoded) */
[data-theme="escuro"] [style*="background: #eef2f7"],
[data-theme="escuro"] [style*="background-color: #eef2f7"] {
    background: var(--bg-info) !important;
}

/* Sidebar CTA borda amarela — mantém no escuro, apenas adapta o fundo */
[data-theme="escuro"] .border-t-4[style*="border-color: #FFCC00"] {
    background-color: var(--bg-panel) !important;
}
