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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #e8e8ff;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #8b5cf6, transparent),
        radial-gradient(2px 2px at 40px 70px, #06b6d4, transparent),
        radial-gradient(1px 1px at 90px 40px, #fbbf24, transparent),
        radial-gradient(1px 1px at 130px 80px, #f472b6, transparent),
        radial-gradient(2px 2px at 160px 30px, #84cc16, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    opacity: 0.3;
    z-index: -1;
    animation: twinkle 20s infinite linear;
}

@keyframes twinkle {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-100px); }
}

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

header {
    text-align: center;
    background: rgba(20, 20, 46, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
}

header p {
    font-size: 1.2rem;
    color: #a5b4fc;
    text-shadow: 0 0 10px rgba(165, 180, 252, 0.3);
}

section {
    background: rgba(20, 20, 46, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

section h2 {
    color: #c7d2fe;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-shadow: 0 0 15px rgba(199, 210, 254, 0.3);
}

.location-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.manual-location {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.city-search {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.city-search input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    background: rgba(30, 30, 60, 0.8);
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    font-size: 1rem;
    color: #e8e8ff;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.city-search input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.city-search input::placeholder {
    color: #a5b4fc;
    opacity: 0.7;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn.primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn.secondary {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    border: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
    filter: brightness(1.1);
}

.btn.secondary:hover {
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
}

.location-display {
    margin-top: 15px;
    padding: 15px;
    background: rgba(30, 30, 60, 0.6);
    border-radius: 12px;
    border-left: 4px solid #06b6d4;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.celestial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.placeholder {
    text-align: center;
    padding: 40px;
    color: #a5b4fc;
    font-style: italic;
    border: 2px dashed rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    background: rgba(20, 20, 46, 0.3);
}

.planet-card, .element-card {
    background: rgba(30, 30, 60, 0.7);
    backdrop-filter: blur(15px);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-left: 4px solid #8b5cf6;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.planet-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.1), transparent);
    transition: left 0.5s ease;
}

.planet-card:hover::before {
    left: 100%;
}

.planet-card:hover, .element-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.3);
    border-color: #8b5cf6;
    background: rgba(40, 40, 80, 0.9);
}

.planet-name, .element-name {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.planet-state, .element-state {
    color: #c7d2fe;
    margin-bottom: 5px;
    font-weight: 500;
}

footer {
    text-align: center;
    padding: 20px;
    color: rgba(165, 180, 252, 0.6);
    margin-top: 30px;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .manual-location {
        flex-direction: column;
    }
    
    .manual-location input {
        min-width: unset;
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px 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); }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    background: rgba(20, 20, 46, 0.95);
    backdrop-filter: blur(20px);
    margin: 5% auto;
    padding: 30px;
    border: 2px solid rgba(139, 92, 246, 0.4);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
}

.modal-title {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.close {
    color: #a5b4fc;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.1);
}

.close:hover {
    color: #fff;
    background: rgba(139, 92, 246, 0.3);
    transform: rotate(90deg);
}

.forecast-timeline {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.forecast-hour {
    background: rgba(30, 30, 60, 0.7);
    padding: 15px;
    border-radius: 12px;
    border-left: 3px solid #06b6d4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.forecast-hour:hover {
    background: rgba(40, 40, 80, 0.8);
    transform: translateX(5px);
}

.forecast-time {
    font-weight: bold;
    color: #06b6d4;
    min-width: 80px;
}

.forecast-state {
    color: #c7d2fe;
    flex: 1;
    margin: 0 15px;
}

.forecast-intensity {
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
    min-width: 60px;
    text-align: center;
}

.element-card {
    border-left-color: #06b6d4;
}

.element-card:nth-child(2) {
    border-left-color: #84cc16;
}

.element-card:nth-child(3) {
    border-left-color: #fbbf24;
}

.element-card:nth-child(4) {
    border-left-color: #f472b6;
}

/* Celestial bodies styles */
.celestial-card {
    background: rgba(30, 30, 60, 0.95);
    backdrop-filter: blur(15px);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-left: 4px solid #fbbf24;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.celestial-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.1), transparent);
    transition: left 0.5s ease;
}

.celestial-card:hover::before {
    left: 100%;
}

.celestial-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(251, 191, 36, 0.3);
    border-color: #fbbf24;
    background: rgba(40, 40, 80, 0.9);
}

.celestial-name {
    font-weight: bold;
    font-size: 1.4rem;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.celestial-phase {
    font-size: 1.1rem;
    color: #c7d2fe;
    margin-bottom: 10px;
    font-weight: 500;
}

.celestial-details {
    color: #a5b4fc;
    font-size: 0.95rem;
    line-height: 1.5;
}

.celestial-details br + br {
    display: block;
    content: "";
    margin: 8px 0;
}

.celestial-section-divider {
    border-top: 1px solid rgba(139, 92, 246, 0.2);
    margin: 15px 0 10px 0;
    padding-top: 10px;
}

.sun-card {
    border-left-color: #f59e0b;
}

.moon-card {
    border-left-color: #e5e7eb;
}

.moon-card:hover {
    box-shadow: 0 15px 40px rgba(229, 231, 235, 0.3);
    border-color: #e5e7eb;
}

.moon-phase-icon {
    font-size: 2rem;
    display: block;
    text-align: center;
    margin: 10px 0;
}