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

body {
    font-family: Arial, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Login Styles */
.login-form {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 400px;
    margin: 100px auto;
    text-align: center;
}

.login-form h1 {
    color: #764ba2;
    margin-bottom: 10px;
    font-size: 2em;
}

.login-form p {
    color: #666;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

button:active {
    transform: translateY(0);
}

/* Gallery Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

header h1 {
    color: #764ba2;
    font-size: 1.8em;
}

.header-controls {
    display: flex;
    gap: 10px;
}

.filters {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

.filters input[type="checkbox"],
.filters input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

.filter-divider {
    width: 1px;
    background: #ddd;
    align-self: stretch;
    margin: 0 4px;
}

.animals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
}

.animal-card {
    background: white;
    border: 1px solid #ddd;
    text-align: center;
    padding: 10px;
    cursor: pointer;
}

.animal-card:hover {
    background: #f5f5f5;
}

.animal-card.contagious {
    border-left: 4px solid #ff6b6b;
    background: #fff5f5;
}

.animal-card.non-contagious {
    border-left: 4px solid #51cf66;
}

.animal-image {
    width: 100%;
    aspect-ratio: 100 / 73.5;
    object-fit: cover;
    object-position: center;
    background: #f8f9fa;
    margin-bottom: 8px;
}

.animal-info {
    padding: 0;
}

.animal-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.animal-detail {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 2px;
    text-align: left;
}

.added-info {
    color: #0066cc;
    font-weight: bold;
    border-top: 1px solid #eee;
    padding-top: 5px;
    margin-top: 5px;
}

.contagious-status {
    color: #cc0000;
}

.error-info {
    color: #cc0000;
    font-size: 0.8em;
    font-style: italic;
}

.animal-basic-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.info-item {
    display: flex;
    justify-content: space-between;
}

.info-label {
    font-weight: 600;
    color: #666;
}

.info-value {
    color: #333;
}

.medical-status {
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 10px;
}

.medical-status.safe {
    background: #d3f9d8;
    color: #2b8a3e;
}

.medical-status.caution {
    background: #ffe8cc;
    color: #e8590c;
}

.medical-status.contagious {
    background: #ffc9c9;
    color: #c92a2a;
}

.medical-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85em;
    color: #666;
    margin-top: 10px;
    max-height: 100px;
    overflow-y: auto;
}

.description {
    font-size: 0.9em;
    color: #555;
    line-height: 1.4;
    margin-top: 10px;
    max-height: 80px;
    overflow-y: auto;
}

.error-message {
    color: #c92a2a;
    background: #ffc9c9;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
    text-align: center;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
    color: #555;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top-color: #764ba2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-note {
    font-size: 0.85em;
    color: #999;
    margin-top: 6px;
}

.jump-links {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
}

.jump-links a {
    background: #4a7fbf;
    border: none;
    border-radius: 20px;
    padding: 10px 28px;
    font-size: 1.1em;
    font-weight: 700;
    color: white;
    text-decoration: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.18);
    transition: background 0.15s;
}

.jump-links a:hover {
    background: #3a6aaa;
    color: white;
}

.last-updated {
    text-align: right;
    font-size: 0.8em;
    color: #999;
    margin-bottom: 10px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.2em;
}

/* ── Litter groups ── */

.litter-section {
    grid-column: 1 / -1;
    border-radius: 10px;
    border: 2px solid var(--lc);
    background: color-mix(in srgb, var(--lc) 6%, white);
    padding: 10px 12px 12px;
    margin-bottom: 4px;
}

.litter-header {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--lc);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.litter-label {
    background: var(--lc);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.9em;
    letter-spacing: 0.05em;
}

/* Six rotating litter colors */
.litter-color-0 { --lc: #4a7fc1; }
.litter-color-1 { --lc: #d4820a; }
.litter-color-2 { --lc: #7a3fa0; }
.litter-color-3 { --lc: #1f9e7e; }
.litter-color-4 { --lc: #607d8b; }
.litter-color-5 { --lc: #5a7a2e; }

.litter-tip {
    margin-left: auto;
    font-weight: 400;
    font-style: italic;
    color: #888;
    font-size: 0.9em;
}

.litter-contagious-note {
    color: #cc0000;
    font-weight: 700;
}

.litter-hidden-note {
    color: #888;
    font-style: italic;
    font-weight: 400;
}

.litter-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.singletons-header {
    grid-column: 1 / -1;
    font-size: 1.3em;
    font-weight: 700;
    color: #444;
    padding: 16px 20px 14px;
    margin-top: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-controls {
        width: 100%;
        justify-content: center;
    }
    
    .filters {
        flex-direction: column;
        gap: 10px;
    }
    
    .animals-grid {
        grid-template-columns: 1fr;
    }

    .litter-cards {
        grid-template-columns: 1fr;
    }
}