/* Основные стили */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --warning-color: #f6ad55;
    --danger-color: #fc8181;
    --info-color: #63b3ed;
    --text-dark: #2d3748;
    --text-light: #718096;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Шапка сайта */
.site-header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.header-logo h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-logo a {
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.nav-link-admin {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--danger-color) 100%);
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
}

.nav-link-admin:hover {
    color: white !important;
    opacity: 0.9;
    transform: translateY(-1px);
}

.nav-link-admin.active::after {
    display: none;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info-link {
    text-decoration: none;
    transition: opacity 0.2s;
}

.user-info-link:hover {
    opacity: 0.8;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
}

.user-group {
    font-size: 0.875rem;
    color: var(--text-light);
}

.btn-logout, .btn-login, .btn-register {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

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

.btn-logout:hover {
    background: #f56565;
}

.btn-login {
    background: var(--primary-color);
    color: white;
}

.btn-login:hover {
    background: var(--primary-dark);
}

.btn-register {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-register:hover {
    background: var(--primary-color);
    color: white;
}

/* Мобильное меню */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    transition: var(--transition);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-8px);
}

.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    box-shadow: var(--shadow-md);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu.active {
    max-height: 500px;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.mobile-nav-link {
    padding: 0.75rem;
    color: var(--text-dark);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.mobile-nav-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.mobile-nav-link.logout {
    color: var(--danger-color);
    border-bottom: none;
}

.mobile-user-info {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Основной контент */
.site-main {
    flex: 1;
    padding: 2rem 0;
}

/* Уведомления */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    transition: opacity 0.3s ease;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.alert-info {
    background: #bee3f8;
    color: #2c5282;
    border: 1px solid #90cdf4;
}

.alert-warning {
    background: #feebc8;
    color: #7c2d12;
    border: 1px solid #fbd38d;
}

.alert-danger {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

/* Карточки */
.card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

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

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.card-description {
    color: var(--text-light);
    margin-top: 0.5rem;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

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

.btn-primary:active {
    transform: translateY(0);
}

/* Outline вариант (светлый) */
.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Solid серый вариант */
.btn-secondary-solid {
    background: #6c757d;
    color: white;
    border: none;
}

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

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

.btn-success:hover {
    background: #38a169;
}

.btn-disabled {
    background: #ccc !important;
    color: #666 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
}


/* Markdown таблицы */
.markdown-table, table.markdown-table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    background: white;
}

.markdown-table th,
.markdown-table td,
table.markdown-table th,
table.markdown-table td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    text-align: left;
}

.markdown-table th,
table.markdown-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #2d3748;
}

.markdown-table tr:nth-child(even),
table.markdown-table tr:nth-child(even) {
    background: #f9fafb;
}

.markdown-table tr:hover,
table.markdown-table tr:hover {
    background: #edf2f7;
}


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

.btn-danger:hover {
    background: #f56565;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control.error {
    border-color: var(--danger-color);
}

.form-help {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.form-error {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--danger-color);
}

/* Прогресс-бар */
.progress {
    background: var(--border-color);
    height: 1.5rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 1rem 0;
}

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

/* Модули */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.module-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

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

.module-card.locked {
    opacity: 0.7;
    cursor: not-allowed;
}

.module-card.locked:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.module-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.module-number {
    font-size: 0.875rem;
    opacity: 0.9;
}

.module-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.module-body {
    padding: 1.5rem;
}

.module-description {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.module-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.progress-details {
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.status-icon.completed {
    background: var(--success-color);
}

.status-icon.in-progress {
    background: var(--warning-color);
}

.status-icon.locked {
    background: var(--border-color);
}

/* Подвал */
.site-footer {
    background: var(--text-dark);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
}

.footer-section p {
    color: #cbd5e0;
    line-height: 1.8;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #cbd5e0;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid #4a5568;
    text-align: center;
    color: #cbd5e0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .header-nav {
        display: none;
    }
    
    .header-user {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-menu {
        display: block;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* Утилиты */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.w-100 { width: 100%; }
.w-auto { width: auto; }

.hidden {
    display: none;
}

.flex {
    display: flex;
}

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

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* ========================================
   Страницы авторизации
   ======================================== */
body.auth-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    background: var(--bg-white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-container.wide {
    max-width: 500px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header h1 {
    color: var(--text-dark);
    font-size: 1.75rem;
    margin-bottom: 0.625rem;
}

.auth-header p {
    color: var(--text-light);
}

.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.875rem;
}

.auth-form .form-group input,
.auth-form .form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
}

.auth-form .form-group input:focus,
.auth-form .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-form .btn-primary {
    width: 100%;
    padding: 0.875rem;
}

.auth-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.auth-form .form-group.full-width {
    grid-column: 1 / -1;
}

.auth-form .required {
    color: var(--danger-color);
}

.auth-form small {
    display: block;
    margin-top: 0.3rem;
    color: var(--text-light);
    font-size: 0.75rem;
}

.auth-message {
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    text-align: center;
}

.auth-message.error {
    background: #fee;
    color: #c33;
}

.auth-message.success {
    background: #d4edda;
    color: #155724;
}

.auth-success-block {
    background: #e8f5e9;
    padding: 1.25rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.auth-success-block h2 {
    color: var(--success-color);
    font-size: 1.5rem;
    margin-bottom: 0.625rem;
}

.auth-success-block p {
    margin-bottom: 1.25rem;
    color: var(--text-light);
}

.auth-footer {
    margin-top: 1.875rem;
    text-align: center;
}

.auth-footer p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

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

@media (max-width: 600px) {
    .auth-form .form-row {
        grid-template-columns: 1fr;
    }
}