:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-color: #333;
    --light-text: #f8f9fa;
    --background-light: rgba(255, 255, 255, 0.95);
    --border-color: #e1e5e9;
    --focus-color: rgba(102, 126, 234, 0.3);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
}

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

.header {
    text-align: center;
    background: var(--background-light);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 2.5rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    color: #666;
}

.status-bar {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-loading {
    background: #fff3cd;
    color: #856404;
}

.status-ready {
    background: #d1edff;
    color: #0c5460;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #4CAF50;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@media (min-width: 1200px) {
    .controls {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .controls {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .status-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tab-buttons {
        flex-direction: column;
    }
    
    .tab-button {
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .tab-button.active {
        border-bottom: none;
        border-left: 3px solid var(--primary-color);
    }
    
    .map-section {
        margin-bottom: 30px;
    }
    
    .map-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .control-panel {
        padding: 15px;
        min-width: auto;
    }
    
    .control-panel h3 {
        font-size: 1.1rem;
    }
    
    button, select, input {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .export-options {
        flex-direction: column;
    }
    
    .export-btn {
        width: 100%;
    }
}

.control-panel {
    background: var(--background-light);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.control-panel h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

select, button, input[type="range"], input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

select:focus, button:focus, input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--focus-color);
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover:not(:disabled) {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

button svg, button img {
    width: 18px;
    height: 18px;
}

/* Button types */
.primary-btn {
    background: var(--primary-color);
}

.success-btn {
    background: #4CAF50;
}

.warning-btn {
    background: #ff9800;
}

.danger-btn {
    background: #f44336;
}

.randomize-btn {
    background: linear-gradient(45deg, #f093fb, #f5576c);
}

.export-btn {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
}

.export-options {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.maps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(700px, 100%), 1fr));
    gap: 30px;
}

.map-section {
    background: var(--background-light);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.map-section h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #333;
}

.map-container {
    width: 100%;
    height: 70vh;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #e6f7ff;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
    margin: 20px 0;
}

.map-container:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.map-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
    margin-top: 15px;
}

.map-control-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.map-svg {
    width: 100%;
    height: 100%;
    cursor: grab;
    display: block;
    max-width: 100%;
    object-fit: contain;
}

.map-svg:active {
    cursor: grabbing;
}

.country, .region {
    stroke: #fff;
    stroke-width: 0.5;
    cursor: pointer;
    transition: all 0.3s ease;
}

.country:hover, .region:hover {
    stroke-width: 2;
    filter: brightness(1.1);
}

.ocean {
    transition: fill 0.5s ease;
}

.palette-preview {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 25px;
    height: 25px;
    border-radius: 4px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.2);
}

.info-panel {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #666;
}

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

.feature-card {
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.feature-card h4 {
    color: #333;
    margin-bottom: 8px;
}

.feature-card p {
    color: #666;
    font-size: 0.9rem;
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

.tooltip.visible {
    opacity: 1;
}

.version-banner {
    background: linear-gradient(45deg, #00c9ff, #92fe9d);
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 20px;
    border-radius: 10px;
}

.control-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.select-control {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 16px;
    width: 250px;
    background-color: #fff;
}

.color-preview {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.color-box {
    width: 50px;
    height: 50px;
    border: 1px solid #ddd;
    display: inline-block;
    position: relative;
    border-radius: 4px;
    transition: transform 0.2s;
}

.color-box:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.color-box::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15px;
    background-color: rgba(0,0,0,0.1);
    display: none;
}

.color-box:hover::after {
    display: block;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #333;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 5px;
    display: none;
}

.info {
    margin-top: 20px;
    font-style: italic;
    color: #666;
}

.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.toggle-container label {
    margin-bottom: 0;
    flex: 1;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin: 0 10px;
}

.toggle-switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.panel {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.border-options {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.border-options label {
    width: auto;
    margin-right: 20px;
}

.border-options input {
    width: 60px;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.color-input {
    margin: 0 5px;
}

.legend-container {
    margin-top: 20px;
    padding: 10px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Стилі для системи вкладок */
.tab-container {
    width: 100%;
    margin-bottom: 30px;
    background: var(--background-light);
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid var(--border-color);
}

.tab-button {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 600;
    font-size: 1rem;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.95);
}

.tab-content {
    padding: 20px;
}

.tab-pane {
    display: none;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Покращені стилі для кнопок */
.action-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.randomize-btn {
    background: linear-gradient(45deg, #f093fb, #f5576c);
    width: 100%;
    margin-top: 10px;
}

.export-btn {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    flex: 1;
    min-width: 80px;
}