/* === Variables === */
:root {
    --primary-bg: #f0f4f8;
    --secondary-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);

    /* Climate Zone Colors */
    --zone-polar: #e8f4f8;
    --zone-subpolar: #a8d8ea;
    --zone-temperate: #79d70f;
    --zone-tropical: #ffa500;
    --zone-equatorial: #ff4444;

    /* Mode Colors */
    --temp-cold: #4a90e2;
    --temp-warm: #ff6b6b;
    --precip-low: #f4d1ae;
    --precip-high: #2d5aa0;
    --veg-sparse: #deb887;
    --veg-dense: #228b22;
}

.dark-mode {
    --primary-bg: #1a1a2e;
    --secondary-bg: #16213e;
    --text-primary: #e8eef5;
    --text-secondary: #cbd5e0;
    --border-color: #2d3748;
}

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

/* === Header === */
.header {
    background: #ffffff;
    color: var(--text-primary);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #4f883d;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: rgba(79, 136, 61, 0.1);
    border: none;
    color: #4f883d;
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.icon-btn:hover {
    background: rgba(79, 136, 61, 0.2);
    transform: scale(1.1);
}

/* === Main Container === */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
    align-items: start;
    gap: 2rem;
}

/* === Map Section === */
.map-section {
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* === View Toggle === */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.view-btn {
    padding: 0.75rem 2rem;
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.view-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    border-color: #764ba2;
}

.view-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #764ba2;
}

/* === Globe Container === */
.globe-container {
    width: 100%;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s;
}

.globe-container.hidden {
    display: none;
}

.globe-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

#globeSvg {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s;
}

#globeSvg:hover {
    transform: scale(1.02);
}

/* Clickable zones on globe */
.globe-zone {
    cursor: pointer;
    transition: all 0.3s;
}

.globe-zone:hover {
    fill: rgba(255, 255, 255, 0.2);
    stroke: rgba(255, 255, 255, 0.6);
    stroke-width: 2;
}

.globe-zone.selected {
    fill: rgba(255, 255, 255, 0.3);
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 3;
}

.earth-globe {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s;
}

.earth-globe:hover {
    transform: scale(1.02);
}

.globe-info {
    text-align: center;
    padding: 1rem;
    background: var(--primary-bg);
    border-radius: 8px;
    width: 100%;
}

.globe-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.visualization-modes {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.mode-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #764ba2;
}

.map-container {
    width: 100%;
    height: 500px;
    background: linear-gradient(to bottom, #87CEEB 0%, #B0E0E6 50%, #F0F8FF 100%);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.map-container.hidden {
    display: none;
}

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

/* SVG Zone Styles */
.climate-zone {
    stroke: rgba(0, 0, 0, 0.2);
    stroke-width: 1;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0.65;
    fill-opacity: 0.65;
}

.climate-zone:hover {
    filter: brightness(1.2);
    stroke: rgba(0, 0, 0, 0.6);
    stroke-width: 2;
}

.climate-zone.selected {
    stroke: #333;
    stroke-width: 3;
    filter: brightness(1.1);
}

.zone-label {
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.geo-line {
    stroke: rgba(0, 0, 0, 0.3);
    stroke-width: 1;
    stroke-dasharray: 5, 5;
    fill: none;
}

.city-marker {
    fill: #ff4444;
    stroke: white;
    stroke-width: 2;
    cursor: pointer;
}

.city-marker:hover {
    fill: #ff6666;
    r: 6;
}

/* === Legend === */
.legend {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--primary-bg);
    border-radius: 8px;
}

.legend h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.legend-items {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* === Map Controls === */
.map-controls {
    margin-top: 1rem;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* === Info Section === */
.info-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-panel {
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.info-panel h2 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.zone-hint {
    color: var(--text-secondary);
    font-style: italic;
}

.zone-details {
    animation: fadeIn 0.3s;
}

.zone-details.hidden {
    display: none;
}

.info-group {
    margin-top: 1.5rem;
}

.info-group h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #764ba2;
}

.info-group p {
    color: var(--text-secondary);
    line-height: 1.8;
}

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

.city-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* === Tools Panel === */
.tools-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.tool-btn {
    background: var(--secondary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.tool-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #764ba2;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.tool-btn .icon {
    font-size: 2rem;
}

/* === Modals === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideUp 0.3s;
}

.modal-content.large {
    max-width: 800px;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--primary-bg);
    color: var(--text-primary);
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: #667eea;
}

/* === Compare Modal === */
.compare-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.compare-column label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.compare-column select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--primary-bg);
    color: var(--text-primary);
    font-size: 1rem;
}

.city-data {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--primary-bg);
    border-radius: 8px;
    font-size: 0.9rem;
}

.chart-container {
    min-height: 200px;
    background: var(--primary-bg);
    border-radius: 8px;
    padding: 1rem;
}

/* === Calculator Modal === */
.calculator-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calculator-content label {
    font-weight: 600;
}

.calculator-content input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--primary-bg);
    color: var(--text-primary);
    font-size: 1rem;
    margin-top: 0.5rem;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.result-box {
    padding: 1.5rem;
    background: var(--primary-bg);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* === Quiz Modal === */
.quiz-question {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.quiz-option {
    padding: 1rem;
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.quiz-option:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.quiz-option.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.quiz-option.correct {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.quiz-option.incorrect {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.quiz-feedback {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}

.quiz-feedback.show {
    display: block;
}

.quiz-feedback.correct {
    background: #d1fae5;
    color: #065f46;
}

.quiz-feedback.incorrect {
    background: #fee2e2;
    color: #991b1b;
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-progress {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.quiz-results {
    text-align: center;
}

.quiz-results.hidden {
    display: none;
}

.score-display {
    margin: 2rem 0;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

/* === Info Modal Tabs === */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

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

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s;
}

.tab-pane h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #764ba2;
}

.tab-pane ul {
    list-style-position: inside;
    line-height: 2;
}

/* === Animations === */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

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

/* === Responsive === */
@media (max-width: 1024px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .visualization-modes {
        justify-content: center;
    }

    .mode-btn {
        font-size: 0.8rem;
        padding: 0.6rem 1rem;
    }
}

@media (max-width: 849px) {
    .container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .tools-panel {
        grid-template-columns: 1fr;
    }

    .compare-container {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}
