/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #333;
    --text-muted: #6c757d;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}

/* Header */
header {
    background: var(--primary-color);
    color: white;
    padding: 30px 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Main content */
main {
    padding: 40px;
}

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
}

/* Upload zone */
.upload-zone {
    border: 3px dashed var(--border-color);
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--light-bg);
}

.upload-zone:hover {
    border-color: var(--secondary-color);
    background: #e3f2fd;
}

.upload-zone.drag-over {
    border-color: var(--success-color);
    background: #e8f5e9;
}

.upload-content svg {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1.2em;
    color: var(--text-color);
    margin-bottom: 5px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.9em;
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 6px;
    margin-top: 15px;
}

.file-info span {
    font-weight: 500;
    color: var(--success-color);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
}

.label-text {
    display: block;
    color: var(--text-color);
}

.label-hint {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: normal;
}

input[type="number"],
input[type="text"],
textarea {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

input[type="number"]:focus,
input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.form-section {
    margin: 25px 0;
}

.form-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.checkbox-group label:hover {
    background: var(--light-bg);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-primary:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: var(--danger-color);
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-secondary:hover {
    background: #c0392b;
}

/* Progress */
.progress-container {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--light-bg);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--success-color));
    width: 0%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
}

.progress-details {
    margin-top: 15px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 6px;
    font-size: 0.9em;
}

/* Results */
.results-summary {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 25px;
}

.results-summary h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

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

.result-card {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.result-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.result-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
}

.result-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.result-stats {
    padding: 15px 20px;
    background: var(--light-bg);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    font-size: 0.9em;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    color: var(--text-color);
    font-weight: 600;
}

.result-map {
    width: 100%;
    height: 500px;
    border: none;
    background: var(--light-bg);
}

.result-footer {
    padding: 15px 20px;
    text-align: center;
    background: var(--light-bg);
}

.result-footer a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.result-footer a:hover {
    text-decoration: underline;
}

/* Status badge для прогрева контейнера */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* Status states */
.status-warming {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
}

.status-ready {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

.status-starting {
    background: #e7f3ff;
    color: #004085;
    border: 2px solid #007bff;
}

/* Pulsing animation for warming state */
.status-warming .status-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Footer */
footer {
    background: var(--light-bg);
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--secondary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.backend-version {
    color: var(--text-muted);
    font-size: 0.9em;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-family: monospace;
    cursor: help;
}

/* History */
#history-list {
    margin-top: 20px;
}

.history-item {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    background: white;
}

.history-item:hover {
    box-shadow: var(--shadow);
    transform: translateX(4px);
}

.history-info {
    flex: 1;
}

.history-title {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1em;
    margin-bottom: 5px;
}

.history-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: var(--text-muted);
    margin-top: 5px;
}

.history-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-actions {
    display: flex;
    gap: 10px;
}

.history-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.btn-view {
    background: var(--secondary-color);
    color: white;
}

.btn-view:hover {
    background: #2980b9;
}

.btn-delete {
    background: var(--danger-color);
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    main {
        padding: 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.result-card {
    animation: fadeIn 0.5s ease;
}

