/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Заголовок */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

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

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

/* Основной контент */
main {
    padding: 30px;
}

.card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
}

.card h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #667eea;
    font-weight: 600;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

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

.input-field {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #888;
    font-size: 0.9em;
}

.form-group small a {
    color: #667eea;
    text-decoration: none;
}

.form-group small a:hover {
    text-decoration: underline;
}

/* Область загрузки файла */
.upload-area {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.file-name {
    color: #666;
    font-style: italic;
}

.section-hint {
    color: #666;
    margin-bottom: 16px;
    line-height: 1.5;
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.template-card {
    width: 100%;
    text-align: left;
    padding: 18px 20px;
    border: 2px solid #d8dce6;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-card:hover {
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.12);
}

.template-card.selected {
    border-color: #667eea;
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.template-card-title {
    display: block;
    font-size: 1.05em;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
}

.template-card-description {
    display: block;
    color: #666;
    line-height: 1.45;
    font-size: 0.95em;
}

.theme-color-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.theme-color-title {
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.theme-color-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-color-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid #d8dce6;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-color-option:hover {
    border-color: #667eea;
}

.theme-color-option.selected {
    border-color: #667eea;
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.theme-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.theme-color-label {
    font-size: 0.95em;
    font-weight: 600;
    color: #444;
}

/* Кнопки */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
    width: 100%;
    font-size: 1.1em;
    padding: 15px;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-download {
    background: #17a2b8;
    color: white;
    width: 100%;
    text-align: center;
    font-size: 1.1em;
    padding: 15px;
}

.btn-download:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

/* Статус и прогресс */
.status-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.progress-container {
    text-align: center;
    padding: 30px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

#progressMessage {
    color: #666;
    font-size: 1.1em;
}

.hidden {
    display: none !important;
}

/* Подсказка для Database ID */
.help-box {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.help-box h4 {
    color: #856404;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.help-box ol {
    margin-left: 20px;
    margin-bottom: 15px;
    color: #856404;
}

.help-box ol li {
    margin: 8px 0;
}

.help-box p {
    margin: 10px 0;
    color: #856404;
}

.help-box code {
    background: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    display: inline-block;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #333;
    word-break: break-all;
}

.help-box .highlight {
    background: #ffc107;
    font-weight: bold;
    color: #000;
}

.btn-help-close {
    background: #ffc107;
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s;
}

.btn-help-close:hover {
    background: #e0a800;
}

/* Футер */
footer {
    background: #f8f9fa;
    padding: 25px 30px;
    border-top: 1px solid #e0e0e0;
}

footer p {
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
}

footer ul {
    list-style-position: inside;
    color: #666;
}

footer ul li {
    margin: 5px 0;
}

/* Адаптивность */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .container {
        margin: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    .card {
        padding: 20px;
    }
}
