/* Shared styles for Parlimal Dashboard */

/* Language Switcher */
.lang-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.lang-switcher a {
    text-decoration: none;
    color: var(--theme-foreground-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.lang-switcher a:hover {
    background: var(--theme-background-alt);
    color: var(--theme-foreground);
}

.lang-switcher a.active {
    font-weight: bold;
    color: var(--theme-foreground);
}

@media (min-width: 640px) {
    .lang-switcher {
        position: absolute;
        top: 1rem;
        right: 1rem;
        margin-bottom: 0;
    }
}

/* Animal Grid Layout */
.animal-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 450px) {
    .animal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .animal-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .animal-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Animal Card */
.animal-card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--theme-border);
    border-radius: 4px;
    background-color: var(
        --theme-background-alt
    ); /* Explicit background color */
    text-decoration: none;
    color: var(--theme-foreground);
    transition: border-color 0.2s;
    height: 100%;
    /* Ensure cards don't collapse or behave unexpectedly */
    box-sizing: border-box;
    min-height: 120px;
}

.animal-card:hover {
    border-color: var(--theme-foreground-focus);
    text-decoration: none;
}

.animal-name {
    font-weight: 600;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.animal-scientific {
    font-size: 0.8rem;
    color: var(--theme-foreground-muted);
    font-style: italic;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.animal-stat {
    font-size: 0.8rem;
    color: var(--theme-foreground-muted);
    margin-bottom: 0.5rem;
}

.animal-sparkline {
    margin-top: auto;
    height: 40px;
    width: 100%;
}

/* Taxon Divider */
.taxon-divider {
    display: flex;
    align-items: center;
    margin: 3.5rem 0 2rem 0; /* Increased top margin */
    gap: 1rem;
}

.taxon-divider h2,
.taxon-divider h2,
.taxon-divider h3 {
    margin: 0;
    white-space: nowrap;
}

.taxon-divider::after {
    content: "";
    height: 1px;
    background: var(--theme-border);
    flex-grow: 1;
}

/* Sparkline Container (Dashboard header) */
.sparkline-container {
    min-width: 0;
    overflow: hidden;
    flex-shrink: 1;
    max-width: 150px;
}

/* Make the SVG inside sparkline container responsive */
.sparkline-container svg {
    width: 100%;
    height: auto;
    max-width: 150px;
}

@media (max-width: 640px) {
    .sparkline-container {
        max-width: 100px;
    }
    .sparkline-container svg {
        max-width: 100px;
    }
}

@media (max-width: 400px) {
    .sparkline-container {
        max-width: 70px;
    }
    .sparkline-container svg {
        max-width: 70px;
    }
}

/* Total count card with sparkline - responsive layout */
.total-count-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .total-count-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .total-count-row .sparkline-container {
        max-width: 100%;
        width: 100%;
    }

    .total-count-row .sparkline-container svg {
        max-width: 100%;
        width: 100%;
    }
}
