* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Big Header Section */
.hero {
    text-align: center;
    padding: 60px 20px 40px;
    color: white;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 800;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.sentiment-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.sentiment {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 700;
    padding: 20px 40px;
    border-radius: 50px;
    text-align: center;
    line-height: 1.3;
}

.sentiment .sentiment-reason {
    display: block;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 500;
    opacity: 0.95;
    margin-top: 8px;
}

.sentiment.great {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.sentiment.good {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
}

.sentiment.moderate {
    background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    color: #333;
}

.sentiment.poor, .sentiment.terrible {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

/* Location Input */
.location-bar {
    background: rgba(255,255,255,0.95);
    padding: 20px;
    border-radius: 20px;
    margin: 20px 0;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
}

.location-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.location-bar input {
    width: 100%;
    padding: 15px 45px 15px 25px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s;
}

.location-bar input:focus {
    border-color: #667eea;
}

.detect-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #888;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
}

.detect-btn:hover {
    background: #666;
    transform: translateY(-50%) scale(1.05);
}

.detect-btn svg {
    display: block;
}

/* Dropdown */
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    margin-top: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.dropdown.active {
    display: block;
}

.dropdown-item {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item .flag {
    font-size: 1.4rem;
}

.dropdown-item .info {
    flex: 1;
}

.dropdown-item .name {
    font-weight: 600;
    color: #333;
}

.dropdown-item .detail {
    font-size: 0.85rem;
    color: #888;
}

.check-btn {
    padding: 15px 35px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(17, 153, 142, 0.4);
}

/* Local time - now in location bar */
.local-time {
    width: 100%;
    text-align: center;
    font-size: 0.95rem;
    color: #666;
    margin-top: 5px;
    font-weight: 500;
}

/* Cards */
.card {
    background: rgba(255,255,255,0.95);
    border-radius: 24px;
    padding: 40px;
    margin: 20px 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.card h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: #444;
    text-align: center;
}

/* Radar Chart Container */
.chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#radarCanvas {
    max-width: 100%;
}

.average-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: 700;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.average-badge .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.average-badge .value {
    font-size: 2rem;
}

/* Explanation Section */
.factors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.factor-card {
    padding: 25px;
    border-radius: 16px;
    transition: transform 0.2s;
}

.factor-card:hover {
    transform: translateY(-5px);
}

.factor-card.excellent {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
}

.factor-card.good {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.factor-card.fair {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.factor-card.poor {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.factor-card.terrible {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border: 3px solid #ff4757;
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
}

.factor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.factor-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #444;
}

.factor-score {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 1.2rem;
    background: white;
    color: #444;
}

.factor-desc {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.api-link {
    color: rgba(255,255,255,0.9);
    text-decoration: underline;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.api-link:hover {
    opacity: 1;
}

/* Loading State */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading.active {
    display: block;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
    .card {
        padding: 25px;
    }

    .factors-grid {
        grid-template-columns: 1fr;
    }

    .location-bar button {
        flex: 1;
    }

    .detect-btn {
        width: 28px;
        height: 28px;
    }

    .detect-btn svg {
        width: 16px;
        height: 16px;
    }

    .sentiment {
        padding: 15px 30px;
    }
}
