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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #f3f4f6;
    overflow-x: hidden;
}

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

.screen.active {
    display: block;
}

.gradient-bg {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: white;
}

/* Шапка */
.header {
    background-color: #1e3a8a;
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-icon {
    font-size: 1.25rem;
}

.profile-name {
    font-weight: 600;
    font-size: 14px;
}

.profile-role {
    font-size: 12px;
    opacity: 0.8;
}

.header-certificates {
    font-size: 12px;
}

/* Контейнер */
.container {
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

/* Экран приветствия */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 20px;
}

.welcome-content {
    max-width: 350px;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.welcome-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: #fcd34d;
}

.welcome-subtitle {
    font-size: 1rem;
    margin-bottom: 24px;
    line-height: 1.4;
    opacity: 0.9;
}

/* Кнопки */
.btn {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    touch-action: manipulation;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:active {
    background-color: #1d4ed8;
    transform: scale(0.98);
}

.btn-success {
    background-color: #10b981;
}

.btn-success:active {
    background-color: #059669;
}

/* Статистика */
.stats {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1e3a8a;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
}

/* Поиск */
.search-box {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Категории */
.categories {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 16px;
    background: white;
    color: #6b7280;
    font-size: 12px;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s;
}

.category-btn.active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

.category-btn:active {
    transform: scale(0.95);
}

/* Сетка курсов */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* Карточки курсов */
.course-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.course-card:active {
    transform: scale(0.98);
}

.course-header {
    background: linear-gradient(45deg, var(--course-color-1), var(--course-color-2));
    color: white;
    padding: 16px;
    text-align: center;
}

.course-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.course-title {
    font-size: 1.125rem;
    font-weight: bold;
    margin: 0;
}

.course-subtitle {
    opacity: 0.9;
    margin: 4px 0 0 0;
    font-size: 0.875rem;
}

.course-body {
    padding: 16px;
}

.course-description {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 12px;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #9ca3af;
}

.course-duration {
    display: flex;
    align-items: center;
    gap: 4px;
}

.course-difficulty {
    background-color: #f3f4f6;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

/* Цветовые схемы для курсов */
.course-maliar { --course-color-1: #2563eb; --course-color-2: #1e40af; }
.course-electric { --course-color-1: #fbbf24; --course-color-2: #f59e0b; }
.course-plumber { --course-color-1: #06b6d4; --course-color-2: #0891b2; }
.course-tile { --course-color-1: #8b5cf6; --course-color-2: #7c3aed; }
.course-carpenter { --course-color-1: #92400e; --course-color-2: #78350f; }
.course-mechanic { --course-color-1: #374151; --course-color-2: #1f2937; }
.course-barber { --course-color-1: #ec4899; --course-color-2: #db2777; }
.course-cook { --course-color-1: #f97316; --course-color-2: #ea580c; }
.course-photo { --course-color-1: #10b981; --course-color-2: #059669; }
.course-computer { --course-color-1: #6366f1; --course-color-2: #4f46e5; }
.course-garden { --course-color-1: #65a30d; --course-color-2: #4d7c0f; }
.course-sewing { --course-color-1: #dc2626; --course-color-2: #b91c1c; }

/* Стили для курсов */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 16px;
}

.card-header {
    background: linear-gradient(90deg, var(--primary-color, #2563eb), var(--secondary-color, #1e40af));
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-body {
    padding: 16px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color, #2563eb);
    transition: width 0.3s ease;
}

.lesson-list {
    margin-top: 16px;
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.lesson-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

.lesson-check.completed {
    background-color: #10b981;
    color: white;
}

.lesson-check.pending {
    border: 2px solid #d1d5db;
    background-color: white;
}

.lesson-content {
    max-width: 100%;
}

.lesson-header {
    text-align: center;
    margin-bottom: 24px;
}

.lesson-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.lesson-title {
    color: var(--primary-color, #2563eb);
    font-size: 1.25rem;
    font-weight: bold;
}

.lesson-text {
    font-size: 1rem;
    line-height: 1.5;
    color: #374151;
    margin-bottom: 24px;
}

.test-question {
    color: var(--primary-color, #2563eb);
    font-size: 1.125rem;
    font-weight: bold;
    margin-bottom: 16px;
}

.test-option {
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    text-align: left;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
    font-size: 14px;
}

.test-option:active {
    transform: scale(0.98);
}

.test-option.correct {
    border-color: #10b981;
    background-color: #ecfdf5;
    color: #065f46;
}

.test-option.incorrect {
    border-color: #ef4444;
    background-color: #fef2f2;
    color: #991b1b;
}

.test-result {
    padding: 12px;
    border-radius: 6px;
    margin: 16px 0;
    font-weight: 600;
    font-size: 14px;
}

.test-result.success {
    background-color: #ecfdf5;
    border: 1px solid #10b981;
    color: #065f46;
}

.test-result.error {
    background-color: #fef2f2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

/* Сертификаты */
.certificate-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    margin-bottom: 16px;
}

.certificate-header {
    background: linear-gradient(135deg, var(--primary-color, #2563eb), var(--secondary-color, #1e40af));
    color: white;
    padding: 24px 16px;
    text-align: center;
}

.certificate-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.certificate-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1f2937;
    margin: 0;
}

.certificate-subtitle {
    margin: 6px 0 0 0;
    font-size: 0.875rem;
}

.certificate-body {
    padding: 24px 16px;
    text-align: center;
}

.certificate-academy {
    margin-bottom: 20px;
}

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

.certificate-academy-name {
    font-size: 1.125rem;
    font-weight: bold;
    color: var(--primary-color, #2563eb);
    margin: 0 0 8px 0;
}

.certificate-line {
    width: 60px;
    height: 3px;
    background-color: var(--primary-color, #2563eb);
    margin: 0 auto;
}

.certificate-info {
    margin-bottom: 20px;
}

.certificate-label {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0 0 6px 0;
}

.certificate-name {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color, #2563eb);
    margin: 0 0 6px 0;
}

.certificate-course {
    font-size: 1rem;
    font-weight: bold;
    color: var(--secondary-color, #1e40af);
    margin: 0;
}

.certificate-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
    font-size: 0.75rem;
    color: #6b7280;
}

.certificate-qr {
    width: 40px;
    height: 40px;
    background-color: #e5e7eb;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
    text-align: center;
}

.btn-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.back-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    touch-action: manipulation;
}

.back-btn:active {
    opacity: 0.7;
}

/* Дополнительные блоки для курсов */
.warning-box {
    background: #fef3cd;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 12px;
    margin: 16px 0;
}

.warning-title {
    font-weight: bold;
    color: #92400e;
    margin-bottom: 4px;
}

.warning-text {
    color: #92400e;
    font-size: 14px;
}

.tools-list {
    background: #f0fdff;
    border: 1px solid #06b6d4;
    border-radius: 6px;
    padding: 12px;
    margin: 16px 0;
}

.tools-title {
    font-weight: bold;
    color: #0891b2;
    margin-bottom: 8px;
    font-size: 14px;
}

.tools-items {
    color: #0e7490;
    font-size: 13px;
    line-height: 1.4;
}

/* Адаптивность */
@media (max-width: 480px) {
    .courses-grid {
        grid-template-columns: 1fr;
    }
    
    .categories {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .container {
        padding: 12px;
    }
    
    .certificate-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .welcome-icon {
        font-size: 3rem;
    }
    
    .welcome-title {
        font-size: 1.5rem;
    }
}

/* VK специфичные стили */
body.vk-app {
    background-color: #ffffff;
}

.vk-app .gradient-bg {
    background: linear-gradient(135deg, #5181b8, #4c75a3);
}
