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

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

/* Экраны */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Авторизация */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.logo p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
    font-weight: 300;
}

.auth-form {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

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

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    gap: 8px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e1e5e9;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-icon {
    font-size: 1.2em;
}

/* Заголовок */
.header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header h1 {
    color: #333;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-indicator {
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: #666;
}

/* Основной контент */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-section h2 {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 10px;
    font-weight: 600;
}

.welcome-section p {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.9);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.action-buttons .btn {
    padding: 30px;
    flex-direction: column;
    gap: 15px;
    text-align: center;
    min-height: 150px;
}

/* Шаги создания */
.step {
    display: none;
    max-width: 800px;
    margin: 0 auto;
}

.step.active {
    display: block;
}

.step h2 {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    font-size: 2rem;
    font-weight: 600;
}

/* Шаблоны */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.template-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.template-card.selected {
    border-color: #667eea;
    background: #f8f9ff;
}

.template-preview {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-icon {
    font-size: 2rem;
}

.template-card h3 {
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.template-card p {
    color: #666;
    font-size: 14px;
}

/* Ввод текста */
.text-inputs {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
}

.text-inputs .form-group {
    margin-bottom: 25px;
}

.text-inputs input {
    font-size: 18px;
    padding: 15px 20px;
}

/* Цветовая палитра */
.color-palette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 15px;
    max-width: 500px;
    margin: 0 auto 30px;
}

.color-option {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 4px solid transparent;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: white;
    box-shadow: 0 0 0 3px #333;
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0,0,0,0.5);
}

/* Загрузка изображений */
.image-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.image-option {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
}

.image-option h3 {
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-content {
    text-align: center;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-hint {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}

/* Рамки и музыка */
.frame-options,
.music-options {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
}

.frame-options h3,
.music-options h3 {
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

/* Действия шагов */
.step-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Генерация */
.generate-content {
    text-align: center;
}

.preview-area {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.postcard-preview {
    width: 300px;
    height: 300px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 18px;
}

/* Мои открытки */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.card-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.card-item:hover {
    transform: translateY(-5px);
}

.card-preview {
    width: 100%;
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.card-info {
    padding: 20px;
}

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

.card-date {
    font-size: 14px;
    color: #666;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.catalog-item {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    border: 3px solid transparent;
}

.catalog-item:hover {
    transform: scale(1.05);
}

.catalog-item.selected {
    border-color: #667eea;
}

.catalog-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.music-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 10px;
    text-align: center;
}

.music-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.music-name {
    font-size: 12px;
    color: #333;
    font-weight: 500;
}

/* Уведомления */
.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.notification {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
    animation: slideIn 0.3s ease;
}

.notification.error {
    border-left-color: #e74c3c;
}

.notification.success {
    border-left-color: #27ae60;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .image-options {
        grid-template-columns: 1fr;
    }
    
    .step-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        margin: 20px;
        max-width: calc(100vw - 40px);
    }
}

@media (max-width: 480px) {
    .auth-form {
        padding: 30px 20px;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .color-palette {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Превью изображений */
.image-preview {
    margin-top: 20px;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.frame-preview {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.frame-info {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}
