:root {
    --primary-color: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    --bg-gradient-1: #e0e7ff;
    --bg-gradient-2: #fae8ff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --radius-lg: 16px;
    --radius-md: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding: 2rem 1rem;
}

/* Background Animated Shapes */
.background-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 20s infinite alternate ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background-color: rgba(99, 102, 241, 0.3);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background-color: rgba(236, 72, 153, 0.3);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background-color: rgba(56, 189, 248, 0.3);
    bottom: 20%;
    left: 20%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Layout container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out forwards;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #312e81;
    margin-bottom: 0.5rem;
}

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

/* Glass Panel (Shared) */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 2rem;
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: #475569;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper > i {
    position: absolute;
    left: 1rem;
    font-size: 1.2rem;
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 2.75rem; /* added right padding for clear btn */
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.input-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 2.5rem; /* Make room for the arrow */
}

.input-wrapper select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.5);
}

.select-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.select-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    display: none; /* hidden by default */
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 10;
}

.clear-btn:hover {
    color: var(--primary-color);
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.primary-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    margin-top: 1rem;
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(99, 102, 241, 0.5);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.secondary-btn:hover {
    background-color: rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1);
}

.secondary-btn:active {
    transform: translateY(0);
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.results-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Result Layout */
.results-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.results-left {
    display: flex;
    flex-direction: column;
}

.results-right {
    position: sticky;
    top: 2rem;
}

.map-container {
    width: 100%;
    height: 600px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--glass-border);
    background: #e2e8f0;
}

#map {
    width: 100%;
    height: 100%;
}

/* Result Cards */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: var(--transition);
    animation: fadeInRight 0.5s ease-out forwards;
    opacity: 0;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    transform-origin: bottom;
}

.result-card:hover {
    transform: translateY(-3px) translateX(2px);
    box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.1);
}

.result-card:hover::before {
    transform: scaleY(1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.distance-badge {
    background-color: #f1f5f9;
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.card-address {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-actions {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.card-link, .card-website {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.card-link {
    color: var(--primary-color);
}

.card-website {
    color: #0ea5e9;
}

.card-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.card-website:hover {
    color: #0284c7;
    text-decoration: underline;
}

.text-muted {
    color: var(--text-muted) !important;
    text-decoration: none !important;
    cursor: default;
}

/* Spinner */
.spinner-container {
    text-align: center;
    padding: 3rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

.error-message {
    background-color: #fef2f2;
    color: #b91c1c;
    padding: 1rem;
    border-radius: var(--radius-md);
    border-left: 4px solid #ef4444;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 900px) {
    .results-layout {
        grid-template-columns: 1fr;
    }
    
    .results-right {
        position: relative;
        top: 0;
        margin-bottom: 2rem;
        order: -1; /* Show map above list on mobile */
    }
    
    .map-container {
        height: 400px;
    }
}

@media (max-width: 600px) {
    .glass-panel {
        padding: 1.5rem;
    }
    .header h1 {
        font-size: 2rem;
    }
    .card-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    .distance-badge {
        align-self: flex-start;
    }
}
