/* Base styles */
:root {
    --background: #f8faf8;
    --foreground: #0f172a;
    --card: #ffffff;
    --card-foreground: #0f172a;
    --primary: #4CAF50;
    --primary-foreground: #ffffff;
    --secondary: #1e293b;
    --secondary-foreground: #f8fafc;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --accent: #f1f5f9;
    --accent-foreground: #1e293b;
    --destructive: #ef4444;
    --destructive-foreground: #f8fafc;
    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: #4CAF50;
    --radius: 0.5rem;

    /* Category colors */
    --all-color: #03A9F4;
    --animal-color: #795548;
    --plant-color: #4CAF50;
    --insect-color: #E91E63;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    min-height: 100vh;
}

.main-container {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    background-color: var(--background);
}

/* Header styles */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icons {
    display: flex;
}

.icon {
    width: 24px;
    height: 24px;
}

.animal-icon {
    color: var(--animal-color);
}

.plant-icon {
    color: var(--plant-color);
}

.insect-icon {
    color: var(--insect-color);
}

.title-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Name container */
.name-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Language toggle */
.language-toggle-container {
    display: flex;
    align-items: center;
}

.language-toggle-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(3, 169, 244, 0.1);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    color: var(--all-color);
    transition: all 0.2s;
    font-size: 0.75rem;
    min-width: 5.5rem;
    justify-content: center;
}

.language-toggle-header:hover {
    background-color: rgba(3, 169, 244, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.language-hint {
    font-size: 0.75rem;
    font-weight: 500;
}

.sound-icon {
    margin-left: 0.25rem;
}

/* Content styles */
.content-container {
    padding-top: 4rem;
    padding-left: 1rem;
    padding-right: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.subtitle {
    color: var(--muted-foreground);
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.main-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 1rem;
}

.description {
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

/* Organism container */
.organism-container {
    flex: 1;
    padding: 0 1rem 1rem;
}

/* Card styles */
.card {
    overflow: hidden;
    max-width: 28rem;
    margin: 0 auto;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: var(--radius);
}

.card-image-container {
    position: relative;
    aspect-ratio: 4/3;
    width: 100%;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
    background-color: var(--card);
}

.card-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1.875rem;
    font-weight: 700;
}

.card-subtitle-container {
    margin-bottom: 1.5rem;
}

.card-subtitle {
    font-size: 1.5rem;
}

.pronunciation-container {
    display: flex;
    justify-content: flex-start;
    margin-top: 0.5rem;
}

.pronunciation-box {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.5);
    width: 100%;
}

.pronunciation-item {
    display: flex;
    align-items: center;
}

.pronunciation-label {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-right: 0.5rem;
}

.sound-button {
    background: none;
    border: none;
    cursor: pointer;
    height: 2rem;
    width: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sound-button.mandarin {
    color: var(--plant-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background-color: rgba(76, 175, 80, 0.1);
    transition: all 0.2s;
    min-width: 6.5rem; /* 增加宽度以容纳文字 */
    justify-content: center;
    border: none;
}

.sound-button.mandarin:hover {
    background-color: rgba(76, 175, 80, 0.2);
}

.sound-button.cantonese {
    color: var(--insect-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background-color: rgba(233, 30, 99, 0.1);
    transition: all 0.2s;
    min-width: 5.5rem;
    justify-content: center;
    border: none;
}

.sound-button.cantonese:hover {
    background-color: rgba(233, 30, 99, 0.2);
}

.sound-button.english {
    color: var(--all-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background-color: rgba(3, 169, 244, 0.1);
    transition: all 0.2s;
    min-width: 5.5rem;
    justify-content: center;
    border: none;
}

.sound-button.english svg,
.sound-icon {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sound-button.english:hover {
    background-color: rgba(3, 169, 244, 0.2);
}

.description-container {
    margin-bottom: 1.5rem;
}

.description-text {
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.fun-facts-container {
    margin-top: 1rem;
}

.fun-facts-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.fun-facts-list {
    list-style-position: inside;
    padding-left: 1.25rem;
}

.fun-fact-item {
    color: var(--foreground);
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.nav-button-prev,
.nav-button-next {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    background: none;
    cursor: pointer;
}

.nav-button-prev:disabled,
.nav-button-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Bottom navigation */
.bottom-nav {
    position: relative;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 4rem;
}

.nav-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
}

.nav-button:hover {
    background-color: var(--muted);
}

.nav-button.active[data-tab="all"] {
    color: var(--all-color);
    background-color: rgba(3, 169, 244, 0.1);
}

.nav-button.active[data-tab="animal"] {
    color: var(--animal-color);
    background-color: rgba(121, 85, 72, 0.1);
}

.nav-button.active[data-tab="plant"] {
    color: var(--plant-color);
    background-color: rgba(76, 175, 80, 0.1);
}

.nav-button.active[data-tab="insect"] {
    color: var(--insect-color);
    background-color: rgba(233, 30, 99, 0.1);
}

.nav-label {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Pagination */
.pagination {
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    padding: 0.5rem 0;
}

/* Loading spinner */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 50vh;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 2px solid var(--muted);
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Navigation arrows */
.image-navigation {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    padding: 0 0.5rem;
}

.arrow-button {
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    height: 2.5rem;
    width: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.arrow-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .main-title {
        font-size: 1.5rem;
    }

    .card-title {
        font-size: 1.5rem;
    }

    .card-subtitle {
        font-size: 1.25rem;
    }
}

/* Animation for speaking */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Hidden footer */
.hidden-footer {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    text-align: center;
    padding: 0;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0;
}
