:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --lost: #ef4444;
    --lost-bg: #fef2f2;
    --found: #22c55e;
    --found-bg: #f0fdf4;
    --border: #e5e7eb;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.navbar {
    background: var(--text);
    color: #fff;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.nav-brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.nav-last-check {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}
.nav-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
}
.nav-link:hover { color: #fff; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}
.tab {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover {
    color: var(--text);
}
.tab-active {
    color: var(--text);
}
.tab-active.tab-lost {
    border-bottom-color: var(--lost);
    color: var(--lost);
}
.tab-active.tab-found {
    border-bottom-color: var(--found);
    color: var(--found);
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
.login-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}
.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}
.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.alert {
    background: var(--lost-bg);
    color: var(--lost);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}
input[type="text"], input[type="password"], input[type="date"], select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--surface);
    transition: border-color 0.15s;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-full { width: 100%; }

.search-bar {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.filter-form { width: 100%; }
.filter-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-group {
    flex: 1;
    min-width: 140px;
}
.filter-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.filter-group-wide { flex: 2; }
.filter-group-label {
    flex: 0 0 auto;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    align-self: flex-end;
    padding-bottom: 0.65rem;
    white-space: nowrap;
}
.filter-row-dates {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.filter-actions { flex: 0 0 auto; min-width: auto; }

.results-header {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0 0.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sort-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sort-control label {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.sort-control select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    background: var(--surface);
    cursor: pointer;
    width: auto;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.animal-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.15s, transform 0.15s;
}
.animal-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.card-photo {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg);
}
.card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-body { padding: 1rem; }
.card-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.15rem;
}
.card-id {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.card-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.card-meta {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.card-location {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-lost {
    background: var(--lost-bg);
    color: var(--lost);
}
.badge-found {
    background: var(--found-bg);
    color: var(--found);
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.back-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.back-link:hover { text-decoration: underline; }

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.detail-photo-section {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}
.detail-photo {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}
.detail-info-section {
    padding: 2rem;
}
.detail-name {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}
.detail-field {
    display: flex;
    flex-direction: column;
}
.field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.field-value {
    font-size: 0.95rem;
    margin-top: 0.15rem;
}
@media (max-width: 768px) {
    .filter-row { flex-direction: column; }
    .filter-group { min-width: 100%; }
    .card-grid { grid-template-columns: 1fr; }
    .detail-layout { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}
