/**
 * EncicloPets Breeds - Stylesheet
 * Desenvolvido por B20 Conteúdo Digital
 * https://www.b20.com.br
 */

/* ===== CSS VARIABLES ===== */
:root {
    /* Reddit Thread View Style Colors */
    --primary-color: #85725f;
    --primary-dark: #6f5e4e;
    --primary-light: #b8a48f;
    
    --bg-color: #f3e9dc;
    --card-bg: #ffffff;
    --text-color: #1a1a1a;
    --text-muted: #5f5348;
    --border-color: #d9ccb8;
    --shadow-color: rgba(133, 114, 95, 0.14);
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Border Radius - Reddit style (minimal) */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    
    /* Safe Areas */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --card-bg: #2d2d2d;
        --text-color: #f0f0f0;
        --text-muted: #a0a0a0;
        --border-color: #444444;
        --shadow-color: rgba(0, 0, 0, 0.3);
    }
}

:root[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #f0f0f0;
    --text-muted: #a0a0a0;
    --border-color: #444444;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] {
    --bg-color: #f3e9dc;
    --card-bg: #ffffff;
    --text-color: #1a1a1a;
    --text-muted: #5f5348;
    --border-color: #d9ccb8;
    --shadow-color: rgba(133, 114, 95, 0.14);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background:
        radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.85) 0%, transparent 42%),
        radial-gradient(circle at 82% 0%, rgba(243, 222, 203, 0.6) 0%, transparent 35%),
        var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-top: var(--safe-top);
    padding-bottom: calc(60px + var(--safe-bottom));
    min-height: 100vh;
}

/* ===== APP HEADER ===== */
.app-header {
    position: sticky;
    top: 0;
    background: var(--card-bg);
    padding: var(--spacing-md);
    z-index: 100;
    box-shadow: 0 2px 8px var(--shadow-color);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.app-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.app-logo i {
    font-size: 1.75rem;
}

.logo-img {
    height: 32px;
    width: auto;
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.icon-btn {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    min-width: 44px;
    min-height: 44px;
}

.icon-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

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

/* ===== SEARCH ===== */
.search-bar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "icon input clear";
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.search-bar i {
    grid-area: icon;
    color: var(--text-muted);
}

.search-bar input {
    grid-area: input;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1rem;
}

.search-bar .icon-btn {
    grid-area: clear;
    width: 44px;
    height: 44px;
}

.search-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
}

.search-info {
    color: var(--text-muted);
    font-weight: 600;
    margin: var(--spacing-sm) 0 var(--spacing-md);
}

@media (max-width: 560px) {
    .search-bar {
        grid-template-columns: auto 1fr auto;
        grid-template-areas: "icon input clear";
        gap: var(--spacing-xs);
        padding: var(--spacing-sm);
    }

    .search-bar .icon-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        justify-self: end;
    }
}

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

/* ===== MAIN CONTENT ===== */
.app-main {
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
}

.container {
    padding: var(--spacing-md);
}

.page-header {
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.hero .hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    color: var(--primary-dark);
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
}

.hero .hero-lead {
    margin-top: var(--spacing-sm);
    color: var(--text-color);
    font-size: 1rem;
    max-width: 780px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.page-header h2 {
    font-size: 1.9rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.hero-title {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 18px var(--shadow-color);
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== VIEWS ===== */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
    scroll-margin-top: 96px;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== BACK BUTTON ===== */
.back-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: 0.95rem;
    margin-bottom: var(--spacing-md);
    transition: var(--transition-fast);
    min-height: 44px;
}

.back-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

/* ===== SPECIES GRID ===== */
.species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.species-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: center;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.species-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow-color);
    border-color: var(--primary-color);
}

.species-card:active {
    transform: translateY(-2px);
}

.species-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
}

.species-card h3 {
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: var(--spacing-xs);
}

.species-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== BREEDS GRID ===== */
.breeds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-md);
}

.breed-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.breed-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px var(--shadow-color);
    border-color: var(--primary-color);
}

.species-card:focus-visible,
.breed-card:focus-visible,
.icon-btn:focus-visible,
.btn:focus-visible,
.back-btn:focus-visible,
.faq-question:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.breed-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--border-color);
}

.breed-info {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.breed-info h3 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--text-color);
}

.breed-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-xs);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breed-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.breed-extra {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.85rem;
    width: fit-content;
}

/* ===== DETAIL CONTENT ===== */
.detail-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.detail-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background: var(--border-color);
}

.detail-body {
    padding: var(--spacing-lg);
}

.detail-body h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.detail-section {
    margin-bottom: var(--spacing-lg);
}

.detail-section h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.detail-section p {
    color: var(--text-color);
    line-height: 1.7;
}

/* ===== FAQ ===== */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    background: transparent;
    border: none;
    padding: var(--spacing-md);
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
    min-height: 48px;
}

.faq-question:hover {
    background: var(--primary-light);
}

.faq-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    transition: transform var(--transition-fast);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 var(--spacing-md) var(--spacing-md);
    color: var(--text-color);
    line-height: 1.7;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* ===== PRIVACY ===== */
.privacy-content {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
}

.privacy-section {
    margin-bottom: var(--spacing-lg);
}

.privacy-section h3 {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.privacy-section p {
    color: var(--text-color);
    line-height: 1.7;
}

.privacy-section a {
    color: var(--primary-color);
    text-decoration: none;
}

.privacy-section a:hover {
    text-decoration: underline;
}

.privacy-footer {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* ===== LOADING SKELETON ===== */
.loading-skeleton {
    display: grid;
    gap: var(--spacing-md);
}

.skeleton-card,
.skeleton-image,
.skeleton-text {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-card {
    height: 120px;
}

.skeleton-image {
    height: 300px;
    width: 100%;
}

.skeleton-text {
    height: 20px;
    margin-bottom: var(--spacing-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
}

.empty-state i {
    display: block;
    margin-bottom: var(--spacing-md);
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-height: 48px;
    min-width: 48px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(205, 133, 63, 0.3);
}

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

.btn:disabled,
.icon-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn.syncing i {
    animation: spin 1s linear infinite;
}

/* ===== ACCESSIBILITY & MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== CONFIG ===== */
.config-grid {
    display: grid;
    gap: var(--spacing-md);
}

.config-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.config-card h3 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
    color: var(--text-color);
}

.config-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.config-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.share-buttons {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.share-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    background: var(--card-bg);
    transition: var(--transition-fast);
    text-decoration: none;
}

.share-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 52px;
    height: 28px;
    background: var(--border-color);
    border-radius: 999px;
    position: relative;
    transition: var(--transition-fast);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: var(--card-bg);
    border-radius: 50%;
    box-shadow: 0 2px 6px var(--shadow-color);
    transition: var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(24px);
}

.toggle-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px var(--shadow-color);
    padding-bottom: var(--safe-bottom);
    z-index: 1000;
    border-top: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    min-width: 64px;
    min-height: 48px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-fast);
    gap: 4px;
}

.nav-item:hover {
    color: var(--primary-color);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item i {
    font-size: 20px;
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-color);
    color: var(--bg-color);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: 2000;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== FOOTER ===== */
.app-footer {
    text-align: center;
    padding: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.app-footer p {
    margin: var(--spacing-xs) 0;
}

.b20-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.b20-link:hover {
    text-decoration: underline;
    transform: scale(1.05);
    display: inline-block;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
}

.footer-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
    .container {
        padding: var(--spacing-lg);
    }
    
    .species-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
    
    .breeds-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
    
    .detail-image {
        height: 400px;
    }
}

@media (min-width: 1024px) {
    .bottom-nav {
        display: none;
    }
    
    body {
        padding-bottom: 0;
    }
    
    .app-header {
        position: sticky;
    }
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */
@media print {
    .app-header,
    .bottom-nav,
    .back-btn,
    .sync-btn {
        display: none;
    }
}
