:root {
    --primary: #d1c4e9;
    --primary-dark: #b39ddb;
    --secondary: #ede7f6;
    --bg-color: #f8f0fc;
    --surface: #ffffff;
    --text-main: #4a148c;
    --text-muted: #7b1fa2;
    --accent: #ff80ab;
    --success: #b9f6ca;
    --warning: #ffe0b2;
    --danger: #ff8a80;
    --shadow: 0 10px 30px -5px rgba(179, 157, 219, 0.4),
        0 6px 15px -7px rgba(179, 157, 219, 0.2);
    --radius: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

.app-header {
    background-color: var(--surface);
    padding: 1.5rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand h1 {
    font-size: 1.75rem;
    color: var(--text-main);
    font-weight: 800;
}

.brand h1 .letter {
    display: inline-block;
    transform-origin: bottom center;
}

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

.emergency-btn {
    background-color: var(--danger);
    color: white;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(239, 83, 80, 0.3);
}

.emergency-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(239, 83, 80, 0.4);
}

.emergency-btn:active {
    transform: scale(0.95);
}

.toggle-btn {
    text-decoration: none;
    font-weight: 700;
    color: var(--text-main);
    background: #f3e5f5;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: #e1bee7;
    transform: translateY(-2px);
}

.filters {
    margin: 2rem 0;
}

.search-bar input {
    width: 100%;
    padding: 1.2rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    background: white;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    color: var(--text-main);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.category-filters {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}

.filter-btn {
    background: var(--surface);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(179, 157, 219, 0.3);
}

.filter-btn.active {
    background-color: var(--primary-dark);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(126, 87, 194, 0.4);
}

.shelter-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 3rem;
}

.shelter-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border-left: 6px solid var(--primary-dark);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
}

.shelter-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px -10px rgba(179, 157, 219, 0.5);
}

.shelter-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    flex: 1;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.distance-badge {
    background: var(--secondary);
    color: var(--text-main);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    white-space: nowrap;
}

.tags {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.8rem;
    padding: 0.35rem 1rem;
    background: #edf2f7;
    border-radius: 20px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag.men {
    background: #e3f2fd;
    color: #1565c0;
}

.tag.women {
    background: #fce4ec;
    color: #c2185b;
}

.tag.family {
    background: #e8f5e9;
    color: #2e7d32;
}

.tag.youth {
    background: #fff3e0;
    color: #ef6c00;
}

.tag.veterans {
    background: #efebe9;
    color: #5d4037;
}

.tag.senior {
    background: #f3e5f5;
    color: #7b1fa2;
}

.info-row {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 0.6rem;
    color: var(--text-main);
}

.info-row a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.info-row a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

.btn {
    flex: 1;
    text-align: center;
    padding: 1rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-dark);
    color: white;
    box-shadow: 0 4px 10px rgba(126, 87, 194, 0.2);
}

.btn-primary:hover {
    background: var(--text-main);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(74, 20, 140, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #d1c4e9;
    transform: translateY(-2px);
}

.app-footer {
    background: var(--text-main);
    color: white;
    padding: 3rem 0;
    text-align: center;
    margin-top: auto;
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* CHANGEMAKER FEATURES STUFF */
.urgent-alert {
    background-color: #d32f2f;
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
}

.capacity-container {
    background: #f5f5f5;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Cat Theme Overrides */
/* 
   CAT THEME
*/
body.theme-cat {
    --primary: #6786ad;
    --primary-dark: #e76577;
    --secondary: #fff8ad;
    --accent: #fbfafa;
}

body.theme-cat .toggle-btn {
    color: var(--primary);
    background: var(--secondary);
    color: #5d2800;
}

body.theme-cat .tag.kittens {
    background: #d01616;
    color: #e08a75;
}

body.theme-cat .spay_and_neuter {
    background: #63a718;
    color: #97e9b2;
}

body.theme-cat .tag.cats {
    background: #e8f8f5;
    color: #16a085;
}

body.theme-cat .tag.dogs {
    background: #7518a7;
    color: #c4ade1;
}

body.theme-cat .tag.small_dogs {
    background: #1849a7;
    color: #8ddfe9;
}

body.theme-cat .tag.strays {
    background: #084f0f;
    color: #4aa658;
}

body.theme-cat .small_and_furry {
    background: #e3eb7b;
    color: #d95582;
}

body.theme-cat .tag.volunteering {
    background: #eb7b96;
    color: #ed5c11;
}

body.theme-cat .tag.advocacy {
    background: #927beb;
    color: #0dbe8a;
}

body.theme-cat .tag.environmental_conservation {
    background: #99eb7b;
    color: #8dab27;
}

body.theme-cat .tag.foster {
    background: #bc7beb;
    color: #1d23c4;
}

body.theme-cat .tag.guinea_pigs {
    background: #ebb57b;
    color: #c41d50;
}

body.theme-cat .tag.wildlife {
    background: #7bebe2;
    color: #69c17d;
}

body.theme-cat .tag.animals {
    background: #eb947b;
    color: #fe5e5c;
}

body.theme-cat .tag.exotic {
    background: #f7f8f7;
    color: #91eb43;
}

body.theme-cat .tag.clinic {
    background: #000806;
    color: #f9fbfb;
}

body.theme-cat .tag.rescue {
    background: #c48ace;
    color: #dbd22d;
}

#map {
    height: 400px;
    width: 100%;
    margin: 2rem 0;
    border-radius: 12px;
    border: 2px solid var(--primary);
    z-index: 1;
    /* Ensure map is below potential overlays but visible */
}

.map-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.map-btn:hover {
    background-color: var(--primary-dark);
}

.shelter-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
}

.shelter-info h3 {
    margin-top: 0;
    color: var(--primary-dark);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.tag {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}