/* ===== VARIÁVEIS ===== */
:root {
    --primary-color: #2e7d32;
    --secondary-color: #81c784;
    --accent-color: #1b5e20;
    --light-color: #f0f4ff;
    --dark-color: #1b5e20;
    --purple: #9c27b0;
    --blue: #1976d2;
    --orange: #ff9800;
    --pink: #e91e63;
    --yellow: #ffc107;
    --cyan: #00bcd4;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--light-color);
    background-image: radial-gradient(circle at 20% 20%, rgba(156,39,176,0.05) 0%, transparent 50%),
                      radial-gradient(circle at 80% 80%, rgba(25,118,210,0.05) 0%, transparent 50%);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrapper {
    flex: 1;
    padding: 0;
}

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, var(--purple), var(--blue));
    color: white;
    text-align: center;
    padding: 2rem 0 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.header-content {
    padding-bottom: 1.5rem;
}

.header-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.3rem;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 0.4rem;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    font-weight: 800;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.header-wave {
    line-height: 0;
    margin-bottom: -2px;
}
.header-wave svg {
    width: 100%;
    display: block;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== BARRA DE PESQUISA ===== */
.search-bar-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 0.6rem 1.2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.12);
    border: 2px solid transparent;
    transition: border-color 0.3s, box-shadow 0.3s;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}
.search-bar-wrapper:focus-within {
    border-color: var(--purple);
    box-shadow: 0 4px 20px rgba(156,39,176,0.25);
}
.search-icon {
    font-size: 1.1rem;
    margin-right: 0.6rem;
    flex-shrink: 0;
}
.search-bar {
    border: none;
    outline: none;
    font-size: 1rem;
    width: 100%;
    background: transparent;
    font-family: inherit;
    color: #333;
}
.search-bar::placeholder {
    color: #aaa;
}

/* ===== BOTÕES DE RAÇA ===== */
.breeds-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 2.5rem;
    justify-content: center;
}

.breed-btn {
    background-color: white;
    color: #333;
    border: 2.5px solid var(--purple);
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    z-index: 1;
    letter-spacing: 0.02em;
}

.breed-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(45deg, var(--pink), var(--purple));
    z-index: -1;
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: transform 0.4s ease-out;
}

.breed-btn:hover {
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
    border-color: transparent;
}
.breed-btn:hover::before { transform: scaleX(1); }

.breed-btn:nth-child(6n+1) { border-color: var(--purple); }
.breed-btn:nth-child(6n+1)::before { background: linear-gradient(45deg, var(--pink), var(--purple)); }
.breed-btn:nth-child(6n+2) { border-color: var(--blue); }
.breed-btn:nth-child(6n+2)::before { background: linear-gradient(45deg, var(--cyan), var(--blue)); }
.breed-btn:nth-child(6n+3) { border-color: var(--orange); }
.breed-btn:nth-child(6n+3)::before { background: linear-gradient(45deg, var(--yellow), var(--orange)); }
.breed-btn:nth-child(6n+4) { border-color: var(--pink); }
.breed-btn:nth-child(6n+4)::before { background: linear-gradient(45deg, var(--purple), var(--pink)); }
.breed-btn:nth-child(6n+5) { border-color: var(--cyan); }
.breed-btn:nth-child(6n+5)::before { background: linear-gradient(45deg, var(--blue), var(--cyan)); }
.breed-btn:nth-child(6n+6) { border-color: var(--yellow); }
.breed-btn:nth-child(6n+6)::before { background: linear-gradient(45deg, var(--orange), var(--yellow)); }

.breed-btn.active {
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
    border-color: transparent;
}
.breed-btn.active::before { transform: scaleX(1); }

/* ===== NOME DA RAÇA ===== */
.selected-breed {
    text-align: center;
    font-size: 2.2rem;
    margin: 1.5rem 0 1rem;
    background: linear-gradient(45deg, var(--purple), var(--blue), var(--pink), var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
    text-transform: capitalize;
    transition: all 0.3s ease;
}

/* ===== CARD DE INFORMAÇÕES DA RAÇA ===== */
.breed-info-card {
    display: none;
    align-items: flex-start;
    gap: 1.2rem;
    background: white;
    border-radius: 16px;
    padding: 1.4rem 1.8rem;
    margin: 0 auto 1.8rem;
    max-width: 700px;
    box-shadow: 0 8px 30px rgba(156,39,176,0.12);
    border-left: 5px solid var(--purple);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.breed-info-card.visible {
    opacity: 1;
    transform: translateY(0);
}
.breed-info-emoji {
    font-size: 2.8rem;
    flex-shrink: 0;
    line-height: 1;
}
.breed-info-card h3 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--purple);
    text-transform: capitalize;
    margin-bottom: 0.3rem;
}
.breed-info-desc {
    color: #555;
    font-size: 0.97rem;
    line-height: 1.6;
}
.breed-info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0.8rem;
}
.info-tag {
    background: linear-gradient(135deg, rgba(156,39,176,0.1), rgba(25,118,210,0.1));
    color: var(--purple);
    border: 1px solid rgba(156,39,176,0.25);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 0.82rem;
    font-weight: 700;
}

/* ===== BOTÃO ATUALIZAR & CONTAGEM ===== */
.action-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.refresh-btn {
    display: none;
    background: linear-gradient(45deg, var(--orange), var(--yellow));
    color: white;
    border: none;
    border-radius: 50px;
    padding: 13px 28px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.35);
    position: relative;
    overflow: hidden;
    z-index: 1;
    font-family: inherit;
}
.refresh-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(45deg, var(--pink), var(--purple));
    z-index: -1;
    transition: opacity 0.4s ease;
    opacity: 0;
}
.refresh-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(233, 30, 99, 0.45);
}
.refresh-btn:hover::before { opacity: 1; }
.refresh-btn.show { display: block; }

.photo-count {
    color: #888;
    font-size: 0.9rem;
    font-weight: 600;
    background: white;
    border-radius: 20px;
    padding: 6px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* ===== GALERIA ===== */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}
.gallery.show { opacity: 1; transform: translateY(0); }

.gallery-item {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    position: relative;
    height: 280px;
    background-color: #eee;
    transition: all 0.35s ease;
    border: 4px solid white;
    cursor: pointer;
}

.gallery-item:nth-child(6n+1) { border-color: var(--pink); }
.gallery-item:nth-child(6n+2) { border-color: var(--blue); }
.gallery-item:nth-child(6n+3) { border-color: var(--orange); }
.gallery-item:nth-child(6n+4) { border-color: var(--cyan); }
.gallery-item:nth-child(6n+5) { border-color: var(--purple); }
.gallery-item:nth-child(6n+6) { border-color: var(--yellow); }

.gallery-item:hover {
    transform: scale(1.05) rotate(1.5deg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    z-index: 10;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
    opacity: 0;
}
.gallery-item.loaded img { opacity: 1; }

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}
.gallery-item:hover .gallery-overlay {
    background: rgba(0,0,0,0.3);
}
.zoom-icon {
    font-size: 2rem;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.3s, transform 0.3s;
}
.gallery-item:hover .zoom-icon {
    opacity: 1;
    transform: scale(1);
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1rem;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.modal-img {
    max-width: min(90vw, 700px);
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    object-fit: contain;
    border: 4px solid white;
}
.modal-close {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    background: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s, background 0.2s;
    font-family: inherit;
}
.modal-close:hover { transform: scale(1.1); background: var(--pink); color: white; }
.modal-caption {
    margin-top: 1rem;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: capitalize;
    opacity: 0.85;
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    font-size: 1.2rem;
    color: var(--purple);
    margin: 2rem 0;
    font-weight: 600;
}
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 0.7rem;
}
.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--purple);
    animation: dotBounce 1.2s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; background: var(--blue); }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; background: var(--pink); }

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* ===== TELA DE BOAS-VINDAS ===== */
.welcome-display {
    text-align: center;
    margin: 1.5rem auto 4rem;
    max-width: 700px;
    opacity: 1;
    transition: all 0.8s ease;
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 15px 50px rgba(156,39,176,0.1);
    position: relative;
    overflow: hidden;
}
.welcome-display::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 6px;
    background: linear-gradient(to right, var(--pink), var(--purple), var(--blue), var(--cyan));
}
.welcome-display.hidden {
    opacity: 0;
    transform: translateY(30px);
    display: none;
}
.welcome-image {
    width: 220px;
    height: 220px;
    margin: 0 auto 1.8rem;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(45deg, var(--purple), var(--blue), var(--pink), var(--cyan));
    animation: gradientAnimation 8s ease infinite;
    background-size: 300% 300%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(156,39,176,0.25);
}
.welcome-image-inner {
    width: 202px;
    height: 202px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.dog-gif {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.welcome-title {
    font-size: 2.2rem;
    background: linear-gradient(45deg, var(--purple), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1.2rem;
    font-weight: 800;
}
.welcome-text {
    color: #555;
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 1.8rem;
    padding: 0 0.5rem;
}
.welcome-instruction {
    color: var(--purple);
    font-size: 1.1rem;
    font-weight: 700;
    display: inline-block;
    padding: 0.7rem 1.4rem;
    border-radius: 30px;
    background-color: rgba(156, 39, 176, 0.1);
    margin-bottom: 2rem;
}
.arrow {
    display: inline-block;
    animation: bounce 1.5s infinite;
    margin-right: 8px;
    font-size: 1.3rem;
}
.welcome-features {
    display: flex;
    justify-content: space-around;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 30%;
    min-width: 90px;
    padding: 0.8rem;
    transition: transform 0.3s ease;
}
.feature:hover { transform: translateY(-5px); }
.feature-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    background: white;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.feature-text {
    color: #555;
    font-weight: 600;
    font-size: 0.88rem;
}

/* ===== FOOTER ===== */
footer {
    background: linear-gradient(135deg, var(--purple), var(--blue));
    color: white;
    text-align: center;
    padding: 1.2rem 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    margin-top: auto;
}
.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}
.footer-logo {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
}
.footer-text {
    margin-bottom: 0.2rem;
    font-weight: 300;
    font-size: 0.88rem;
    opacity: 0.85;
}

/* ===== ERRO ===== */
.error-message {
    color: #d32f2f;
    text-align: center;
    font-size: 1.1rem;
    margin: 2rem 0;
    padding: 1rem;
    background-color: #ffebee;
    border-radius: 10px;
    display: none;
    font-weight: 600;
}
.error-message.show { display: block; }

/* ===== ANIMAÇÕES ===== */
@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.pulse { animation: pulse 2s infinite; }

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    h1 { font-size: 2rem; }
    .gallery { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .breed-info-card { flex-direction: column; gap: 0.8rem; }
    .selected-breed { font-size: 1.7rem; }
    .welcome-features { flex-direction: column; align-items: center; }
    .feature { width: 80%; }
}
