@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-light: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --success: #10b981;
    --error: #ef4444;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

/* Animated background particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    z-index: -1;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-30px) rotate(1deg); }
    66% { transform: translateY(15px) rotate(-1deg); }
}

/* Glassmorphism status bar */
.status-bar {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-light);
}

#status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
}

.online {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.offline {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Main container with enhanced spacing */
main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    gap: 2rem;
}

/* Search section with floating design */
.search-section {
    position: relative;
    margin-bottom: 3rem;
}

input[type="text"] {
    padding: 1rem 1.5rem;
    width: 280px;
    border: none;
    border-radius: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 400;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    outline: none;
    margin-right: 1rem;
}

input[type="text"]::placeholder {
    color: var(--text-secondary);
}

input[type="text"]:focus {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Enhanced buttons with gradients and animations */
button {
    padding: 1rem 2rem;
    border: none;
    border-radius: 20px;
    background: var(--secondary-gradient);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-heavy);
}

button:active {
    transform: translateY(-1px);
}

/* Copy buttons with different styling */
#copy-coords,
#copy-searched-coords {
    background: var(--accent-gradient);
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* Enhanced weather cards with glassmorphism */
.weather-card {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    padding: 2rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-heavy);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.weather-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.weather-card:hover::before {
    transform: scaleX(1);
}

.weather-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
}

/* Enhanced suggestions dropdown */
.suggestions {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-heavy);
    animation: slideIn 0.3s ease;
}

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

.suggestions li {
    padding: 1rem 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.suggestions li:last-child {
    border-bottom: none;
}

.suggestions li:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

/* Local weather section */
.local-weather {
    animation: fadeInUp 0.6s ease-out;
    display: none;
}

.local-weather h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Coordinates display */
#local-coords,
#searched-coords {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    margin: 0.5rem 0;
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border-left: 3px solid var(--accent-gradient);
}

/* Enhanced scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-gradient);
}

/* Responsive design */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }

    .status-bar {
        padding: 0.75rem 1rem;
    }

    input[type="text"] {
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    button {
        width: 100%;
    }

    .suggestions {
        width: 100%;
    }

    .local-weather h2 {
        font-size: 1.5rem;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Pulse effect for status indicator */
.online::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Enhanced focus states for accessibility */
button:focus,
input:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Micro-interactions */
* {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.weather-card > * {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

.weather-card > *:nth-child(1) { animation-delay: 0.1s; }
.weather-card > *:nth-child(2) { animation-delay: 0.2s; }
.weather-card > *:nth-child(3) { animation-delay: 0.3s; }
.weather-card > *:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}