/* ==========================================
   BUSCA — Dark Celestial Gold Theme
   ========================================== */

.busca-container {
    padding-top: 100px;
    max-width: 700px;
    padding-bottom: 40px;
}

/* ── TÍTULO ── */
.busca-titulo {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: 1.5px;
    text-shadow: 0 0 30px var(--glow-gold);
    line-height: 1.2;
}
.busca-titulo i {
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--glow-gold));
    margin-right: 0.5rem;
}

.busca-subtitulo {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 300;
    margin-bottom: 1.5rem;
    letter-spacing: 0.3px;
}

/* Divider */
.busca-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 2rem;
}
.busca-divider::before,
.busca-divider::after {
    content: '';
    height: 1px;
    width: 60px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.4;
}
.busca-divider .divider-ornament {
    color: var(--primary);
    font-size: 0.7rem;
    opacity: 0.7;
    animation: twinkle 3s ease-in-out infinite;
}

/* ── ABAS ── */
.busca-abas {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(145deg, rgba(22, 24, 48, 0.8), rgba(30, 33, 60, 0.6));
    border-radius: 16px;
    padding: 6px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.aba {
    flex: 1;
    padding: 1rem 1.2rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: auto;
    position: relative;
}
.aba:hover {
    color: var(--primary-light);
    background: rgba(197, 165, 90, 0.08);
}
.aba.ativa {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--bg-deep);
    box-shadow: 0 4px 20px rgba(197, 165, 90, 0.35);
    font-weight: 600;
}
.aba.ativa i {
    color: var(--bg-deep);
}
.aba i {
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

/* ── CONTEÚDO DAS ABAS ── */
.aba-conteudo {
    display: none;
    animation: fadeInTab 0.5s ease-out forwards;
}
@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.aba-conteudo.ativa {
    display: block;
    background: linear-gradient(145deg, rgba(22, 24, 48, 0.8), rgba(30, 33, 60, 0.6));
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(197, 165, 90, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}
.aba-conteudo.ativa::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(123, 104, 174, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

/* ── SELECTS DE BUSCA ── */
.busca-selects {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 601px) {
    .busca-selects {
        display: grid;
        grid-template-columns: 1fr 150px 150px;
        gap: 1rem;
        align-items: end;
    }
}

/* ── CAMPOS ── */
.busca-campo {
    margin-bottom: 0;
}

.busca-campo label {
    display: block;
    color: var(--primary);
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.busca-campo select,
.busca-campo input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    background: rgba(13, 15, 26, 0.7);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    box-sizing: border-box;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
    backdrop-filter: blur(5px);
}

/* Seta customizada para selects */
.busca-campo select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23c5a55a' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 14px;
    padding-right: 2.8rem;
    cursor: pointer;
}

.busca-campo select option {
    background: var(--bg-surface);
    color: var(--text-main);
    padding: 0.8rem;
    font-size: 1rem;
}

.busca-campo input::placeholder {
    color: rgba(240, 236, 226, 0.35);
    font-weight: 300;
}

.busca-campo input:focus,
.busca-campo select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(197, 165, 90, 0.15), inset 0 2px 5px rgba(0,0,0,0.3);
    background: rgba(22, 24, 48, 0.9);
}

.busca-campo select:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background-color: rgba(13, 15, 26, 0.4);
    border-color: rgba(197, 165, 90, 0.08);
}

/* ── PESQUISA POR PALAVRA ── */
.busca-input-wrapper {
    display: flex;
    gap: 0.8rem;
}
.busca-input-wrapper input {
    flex: 1;
}
.btn-pesquisar {
    padding: 0 1.6rem;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--bg-deep);
    border-radius: 14px;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    width: auto;
    box-shadow: 0 4px 20px rgba(197, 165, 90, 0.35);
    position: relative;
    overflow: hidden;
}
.btn-pesquisar::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}
.btn-pesquisar:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(197, 165, 90, 0.5);
}
.btn-pesquisar:hover::before {
    left: 100%;
}

/* ── BOTÃO BUSCAR ── */
#btn-buscar-ref {
    margin-top: 0.8rem;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border-radius: 14px;
    background: rgba(197, 165, 90, 0.1);
    border: 1px solid rgba(197, 165, 90, 0.25);
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
}
#btn-buscar-ref:not(:disabled) {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--bg-deep);
    border: none;
    box-shadow: 0 4px 20px rgba(197, 165, 90, 0.35);
}
#btn-buscar-ref:not(:disabled):hover {
    box-shadow: 0 8px 30px rgba(197, 165, 90, 0.5);
    transform: translateY(-2px);
}

/* ── RESULTADOS ── */
.resultados {
    margin-top: 2.5rem;
    animation: fadeInTab 0.6s ease-out;
}

.resultados-titulo {
    font-family: 'Cinzel', serif;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.resultados-titulo::before {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
}

.lista-resultados {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.resultado-item {
    background: linear-gradient(145deg, rgba(22, 24, 48, 0.8), rgba(30, 33, 60, 0.6));
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.8rem;
    cursor: pointer;
    transition: all 0.4s ease;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}
.resultado-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: transparent;
    transition: background 0.3s ease;
    border-radius: 3px 0 0 3px;
}
.resultado-item:hover {
    border-color: rgba(197, 165, 90, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(197, 165, 90, 0.08);
}
.resultado-item:hover::before {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
}

.resultado-texto {
    font-family: 'Playfair Display', serif;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.8;
    margin-bottom: 1rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    position: relative;
    padding-left: 1rem;
    border-left: 2px solid rgba(197, 165, 90, 0.2);
}

.resultado-ref {
    font-family: 'Cinzel', serif;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 0 12px var(--glow-gold);
    display: inline-block;
    padding: 0.25rem 0.8rem;
    background: rgba(197, 165, 90, 0.08);
    border-radius: 20px;
    border: 1px solid rgba(197, 165, 90, 0.15);
}

.resultado-acoes {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.2rem;
    flex-wrap: wrap;
}

.resultado-btn {
    padding: 0.55rem 1rem;
    border: 1px solid rgba(197, 165, 90, 0.2);
    background: rgba(197, 165, 90, 0.05);
    color: var(--text-main);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: auto;
    letter-spacing: 0.02em;
}
.resultado-btn:hover {
    background: rgba(197, 165, 90, 0.12);
    border-color: rgba(197, 165, 90, 0.4);
    color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.resultado-btn.btn-usar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: var(--bg-deep);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(197, 165, 90, 0.3);
}
.resultado-btn.btn-usar:hover {
    box-shadow: 0 6px 20px rgba(197, 165, 90, 0.5);
    color: var(--bg-deep);
}
.resultado-btn.btn-wpp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.25);
}
.resultado-btn.btn-wpp:hover {
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    color: #fff;
}

/* ── LOADING ── */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(197, 165, 90, 0.12);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.6, 0.1, 0.4, 0.9) infinite;
    margin: 0 auto 1.2rem;
    box-shadow: 0 0 20px rgba(197, 165, 90, 0.15);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── MENSAGEM VAZIO ── */
.msg-vazio {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 1rem;
    line-height: 2;
}
.msg-vazio i {
    font-size: 2.5rem;
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--glow-gold));
    margin-bottom: 0.5rem;
}
.msg-vazio a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(123, 104, 174, 0.3);
    transition: all 0.3s ease;
}
.msg-vazio a:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* ── MOBILE ── */
@media (max-width: 600px) {
    .busca-container {
        padding-top: 80px;
    }
    .busca-titulo {
        font-size: 1.6rem;
    }
    .aba-conteudo.ativa {
        padding: 1.5rem 1.2rem;
    }
    .busca-campo select,
    .busca-campo input[type="text"] {
        padding: 12px 14px;
        font-size: 0.95rem;
    }
    .resultado-acoes {
        flex-direction: column;
    }
    .resultado-btn {
        justify-content: center;
    }
}

/* ==========================================
   MODAL — GERAR CARTÃO 
   ========================================== */
.modal-cartao {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}
.modal-cartao-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
}
.modal-cartao-content {
    position: relative;
    background: linear-gradient(160deg, #161830 0%, #0d0f1a 100%);
    border: 1px solid rgba(197, 165, 90, 0.25);
    border-radius: 20px;
    padding: 28px 24px 24px;
    max-width: 520px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(197,165,90,0.08);
}
.modal-fechar {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.modal-fechar:hover { color: #fff; }

.modal-titulo {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 4px;
    text-shadow: 0 0 20px var(--glow-gold);
}
.modal-titulo i { margin-right: 6px; }

.modal-subtitulo {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-style: italic;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Abas */
.modal-abas {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    padding: 4px;
}
.modal-aba {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.modal-aba.ativa {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #0d0f1a;
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(197,165,90,0.3);
}
.modal-aba:not(.ativa):hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* Grid de paletas e paisagens */
.modal-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.modal-paleta-item {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.modal-paleta-item:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(197,165,90,0.3);
}
.modal-paleta-item.selecionado {
    border-color: var(--primary);
    box-shadow: 0 0 16px var(--glow-gold), 0 4px 16px rgba(197,165,90,0.4);
    transform: scale(1.05);
}
.modal-paleta-item.selecionado::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.modal-paisagem-item {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}
.modal-paisagem-item:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(197,165,90,0.3);
}
.modal-paisagem-item.selecionado {
    border-color: var(--primary);
    box-shadow: 0 0 16px var(--glow-gold), 0 4px 16px rgba(197,165,90,0.4);
    transform: scale(1.05);
}
.modal-paisagem-item.selecionado::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,0.25);
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Preview canvas */
.modal-preview-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(197,165,90,0.15);
    background: rgba(0,0,0,0.3);
}
.modal-preview-wrapper canvas {
    width: 100%;
    max-width: 280px;
    height: auto;
    display: block;
    border-radius: 12px;
}

/* Ações do modal */
.modal-acoes {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.modal-acoes .resultado-btn {
    padding: 10px 18px;
    font-size: 0.88rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 480px) {
    .modal-cartao-content {
        padding: 20px 16px 16px;
        border-radius: 16px;
    }
    .modal-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .modal-preview-wrapper canvas {
        max-width: 220px;
    }
}
