/* ==========================================
   1. БАЗОВЫЕ СТИЛИ И СБРОС
   ========================================== */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

body { 
  font-family: system-ui, -apple-system, sans-serif; 
  background: #0f1115; 
  color: #e6e6e6; 
  line-height: 1.5; 
  overflow-x: hidden;
  transition: background-color 0.5s ease, color 0.5s ease; /* Плавная смена темы */
}

a { color: #4fd1c5; }

/* ==========================================
   2. ШАПКА И ПОДВАЛ
   ========================================== */
.header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding: 16px 24px; 
  border-bottom: 1px solid #2a2d35; 
  position: relative;
  transition: background-color 0.5s ease, border-color 0.5s ease;
}

.logo { 
  font-weight: bold; 
  color: #4fd1c5; 
  text-decoration: none; 
  font-size: 20px; 
}

nav { display: flex; gap: 10px; align-items: center; }

.nav-btn { 
  color: #aaa; 
  text-decoration: none; 
  font-size: 15px; 
  padding: 6px 14px; 
  border-radius: 8px; 
  transition: all 0.3s ease; 
  border: 1px solid transparent; 
}

.nav-btn:hover { color: #4fd1c5; background-color: rgba(79, 209, 197, 0.1); }
.nav-btn.active { color: #4fd1c5; background-color: rgba(79, 209, 197, 0.15); border-color: rgba(79, 209, 197, 0.3); }

.footer { text-align: center; padding: 40px 24px; color: #666; font-size: 14px; }

/* ==========================================
   3. ОСНОВНОЙ КОНТЕНТ И КАРТОЧКИ
   ========================================== */
.container { max-width: 1100px; margin: 32px auto; padding: 0 16px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h1, .page-header h2 { margin-bottom: 0; font-weight: 600; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.card { 
  background: #1a1d24; 
  border: 1px solid #2a2d35; 
  border-radius: 10px; 
  padding: 20px; 
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.3s, box-shadow 0.3s, background-color 0.5s ease; 
  display: flex; 
  flex-direction: column; 
}

.card:hover { 
  transform: translateY(-4px); 
  border-color: #4fd1c5; 
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); 
}

.card h3 { color: #4fd1c5; margin-bottom: 8px; font-size: 18px; }
.card p { color: #888; font-size: 14px; margin-bottom: 12px; }

.stars-display { font-size: 16px; margin-bottom: 10px; letter-spacing: 2px; }
.card-detail { font-size: 13px; color: #ccc; background: #0f1115; padding: 8px 12px; border-radius: 6px; margin-top: 8px; border-left: 2px solid #4fd1c5; word-break: break-word; transition: background-color 0.5s ease; }
.card-detail strong { color: #888; }

/* ==========================================
   4. КНОПКА ДОБАВЛЕНИЯ (ПЛЮСИК)
   ========================================== */
.btn-add { 
  position: relative; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  width: 52px; 
  height: 52px; 
  background-color: #1a1d24; 
  border: 1px solid #2a2d35; 
  border-radius: 12px; 
  color: #4fd1c5; 
  font-size: 36px; 
  font-weight: 300; 
  text-decoration: none; 
  line-height: 1; 
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
  padding-bottom: 6px; 
  overflow: hidden; 
}

.btn-add:hover { 
  background-color: #4fd1c5; 
  color: #0f1115; 
  border-color: #4fd1c5; 
  transform: scale(1.1) rotate(90deg); 
  box-shadow: 0 0 25px rgba(79, 209, 197, 0.5); 
}

.btn-add::before { 
  content: ''; 
  position: absolute; 
  top: 50%; 
  left: 50%; 
  width: 100%; 
  height: 100%; 
  background-color: rgba(79, 209, 197, 0.3); 
  border-radius: 50%; 
  transform: translate(-50%, -50%) scale(0); 
  z-index: -1; 
  transition: transform 0.5s ease-out; 
}

.btn-add:hover::before { 
  transform: translate(-50%, -50%) scale(3); 
  opacity: 0; 
}

/* ==========================================
   5. АНИМАЦИЯ ЗАСТАВКИ (ПРЕЛОАДЕР)
   ========================================== */
#preloader { 
  position: fixed; 
  top: 0; left: 0; width: 100%; height: 100%; 
  background-color: #0f1115; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  z-index: 9999; 
  transition: opacity 1s ease, visibility 1s ease; 
}

#preloader.hidden { opacity: 0; visibility: hidden; }
.preloader-content { text-align: center; }

.welcome-text { 
  color: #888; 
  font-size: 18px; 
  letter-spacing: 2px; 
  text-transform: uppercase; 
  opacity: 0; 
  animation: slideUpFade 1.2s ease forwards; 
  animation-delay: 0.3s; 
}

.brand-text { 
  color: #4fd1c5; 
  font-size: 72px; 
  font-weight: 800; 
  letter-spacing: 4px; 
  margin: 10px 0 20px 0; 
  opacity: 0; 
  transform: scale(0.9); 
  animation: scaleInFade 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; 
  animation-delay: 1s; 
  text-shadow: 0 0 20px rgba(79, 209, 197, 0.4); 
}

.loader-line { 
  width: 0%; 
  height: 2px; 
  background: #4fd1c5; 
  margin: 0 auto; 
  box-shadow: 0 0 10px #4fd1c5; 
  animation: loadLine 1.5s ease-in-out forwards; 
  animation-delay: 1.5s; 
}

@keyframes slideUpFade { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes scaleInFade { 0% { opacity: 0; transform: scale(0.9); } 100% { opacity: 1; transform: scale(1); } }
@keyframes loadLine { 0% { width: 0%; opacity: 1; } 80% { width: 100%; opacity: 1; } 100% { width: 100%; opacity: 0; } }

/* ==========================================
   6. ФОРМА ЗАГРУЗКИ И ВХОДА
   ========================================== */
.form { 
  display: flex; 
  flex-direction: column; 
  max-width: 600px; 
  width: 100%; 
  margin: 24px auto; 
  background: #1a1d24; 
  padding: 24px; 
  border-radius: 10px; 
  border: 1px solid #2a2d35; 
  transition: background-color 0.5s ease, border-color 0.5s ease;
}

.form label { margin-top: 16px; margin-bottom: 6px; color: #aaa; font-size: 14px; }

/* Контейнеры для полей входа и регистрации */
#login-fields, #reg-fields {
  display: flex;
  flex-direction: column;
}

.form input, .form textarea { 
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px; 
  background: #0f1115; 
  border: 1px solid #2a2d35; 
  color: #fff; 
  border-radius: 6px; 
  font-family: inherit; 
  font-size: 15px; 
  transition: border-color 0.3s, background-color 0.5s ease, color 0.5s ease; 
}

.form input:focus, .form textarea:focus { outline: none; border-color: #4fd1c5; }

.form button { margin-top: 24px; padding: 12px; background: #4fd1c5; color: #000; border: none; border-radius: 6px; font-weight: bold; font-size: 16px; cursor: pointer; transition: background 0.3s, transform 0.2s; }
.form button:hover { background: #3bb8ab; transform: translateY(-2px); }

.stars-input { display: flex; gap: 8px; font-size: 32px; color: #2a2d35; cursor: pointer; user-select: none; }
.stars-input span { transition: color 0.3s, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.stars-input span:hover { transform: scale(1.3); }
.stars-input span.active { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }

/* ==========================================
   7. КИНЕМАТОГРАФИЧНЫЙ ПЕРЕХОД (ЗАНАВЕС)
   ========================================== */
.page-transition { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #0f1115; z-index: 10000; opacity: 0; pointer-events: none; }
.page-transition.active { opacity: 1; pointer-events: all; }

/* ==========================================
   8. ПРОФИЛЬ (ВЫПАДАЮЩЕЕ МЕНЮ В ШАПКЕ)
   ========================================== */
.profile-menu { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; transition: all 0.3s; color: #e6e6e6; font-family: inherit; font-size: 15px; }
.profile-btn:hover, .profile-btn.active { background: rgba(79, 209, 197, 0.1); border-color: rgba(79, 209, 197, 0.3); }
.avatar { width: 32px; height: 32px; background: #4fd1c5; color: #0f1115; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: bold; font-size: 16px; }
.arrow { font-size: 10px; color: #888; transition: transform 0.3s; }
.profile-btn.active .arrow { transform: rotate(180deg); }
.dropdown { position: absolute; top: 120%; right: 0; background: #1a1d24; border: 1px solid #2a2d35; border-radius: 10px; width: 200px; padding: 8px 0; box-shadow: 0 10px 25px rgba(0,0,0,0.5); opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.5s ease; z-index: 100; }
.dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown a { display: block; padding: 10px 20px; color: #e6e6e6; text-decoration: none; font-size: 14px; transition: background 0.2s, color 0.5s ease; }
.dropdown a:hover { background: rgba(79, 209, 197, 0.1); color: #4fd1c5; }
.dropdown .divider { height: 1px; background: #2a2d35; margin: 8px 0; }

/* ==========================================
   9. СТРАНИЦА ПРОФИЛЯ
   ========================================== */
.profile-header-card { background: #1a1d24; border: 1px solid #2a2d35; border-radius: 16px; padding: 32px; margin-top: 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 24px; transition: background-color 0.5s ease, border-color 0.5s ease; }
.profile-info { display: flex; align-items: center; gap: 24px; }
.profile-avatar-large { width: 90px; height: 90px; background: #4fd1c5; color: #0f1115; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 40px; font-weight: bold; box-shadow: 0 0 20px rgba(79, 209, 197, 0.3); }
.profile-name-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.profile-name-row h1 { margin: 0; font-size: 28px; }
.badge { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.badge.developer { background: rgba(79, 209, 197, 0.15); color: #4fd1c5; border: 1px solid rgba(79, 209, 197, 0.3); box-shadow: 0 0 10px rgba(79, 209, 197, 0.2); }
.profile-bio { color: #aaa; font-size: 15px; margin-bottom: 8px; }
.profile-joined { color: #666; font-size: 13px; }

.profile-stats { display: flex; gap: 16px; background: #0f1115; padding: 16px 24px; border-radius: 12px; border: 1px solid #2a2d35; transition: background-color 0.5s ease, border-color 0.5s ease; }
.stat-box { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.stat-value { font-size: 24px; font-weight: bold; color: #4fd1c5; }
.stat-label { font-size: 12px; color: #888; text-transform: uppercase; margin-top: 4px; }

@media (max-width: 768px) {
  .profile-header-card { flex-direction: column; text-align: center; }
  .profile-info { flex-direction: column; }
  .profile-name-row { justify-content: center; }
}

/* ==========================================
   10. ПОДПИСКИ И СТАТИСТИКА
   ========================================== */
.profile-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
.btn-follow { padding: 10px 24px; background-color: #4fd1c5; color: #0f1115; border: 2px solid #4fd1c5; border-radius: 8px; font-weight: bold; font-size: 15px; cursor: pointer; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); width: 100%; }
.btn-follow:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(79, 209, 197, 0.4); }
.btn-follow.following { background-color: transparent; color: #4fd1c5; }
.btn-follow.following:hover { background-color: rgba(79, 209, 197, 0.1); }

@media (max-width: 768px) {
  .profile-actions { align-items: center; width: 100%; }
}

/* ==========================================
   11. ФУТЕР КАРТОЧКИ И ЛАЙКИ (SVG)
   ========================================== */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #2a2d35;
}

.like-btn {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  transition: all 0.2s;
  padding: 4px 8px;
  border-radius: 6px;
}

.like-btn:hover { color: #ccc; }

.heart-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.heart-icon svg {
  width: 100%;
  height: 100%;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.like-btn.liked { color: #ff5c8a; }

.like-btn.liked .heart-icon svg {
  animation: pop 0.4s ease;
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ==========================================
   12. ПОИСК (ЛУПА)
   ========================================== */
.header-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: #aaa;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.search-toggle:hover, .search-toggle.active {
  color: #4fd1c5;
  background: rgba(79, 209, 197, 0.1);
  border-color: rgba(79, 209, 197, 0.3);
}

.search-toggle svg { width: 20px; height: 20px; }

.search-panel {
  display: none;
  background: #1a1d24;
  border-bottom: 1px solid #2a2d35;
  position: absolute;
  top: 73px;
  left: 0;
  width: 100%;
  z-index: 90;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  transition: background-color 0.5s ease, border-color 0.5s ease;
}

.search-panel.show {
  display: block;
  animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-wrapper {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
  padding-bottom: 16px;
}

.search-wrapper input {
  width: 100%;
  padding: 12px 16px;
  background: #0f1115;
  border: 1px solid #2a2d35;
  color: #fff;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.3s, background-color 0.5s ease, color 0.5s ease;
}

.search-wrapper input:focus { outline: none; border-color: #4fd1c5; }

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #1a1d24;
  border: 1px solid #2a2d35;
  border-radius: 8px;
  margin-top: 4px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: none;
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  transition: background-color 0.5s ease, border-color 0.5s ease;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
  color: #e6e6e6;
  text-decoration: none;
}

.search-item:hover { background: rgba(79, 209, 197, 0.1); }
.verified-check {
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  margin-left: 4px;
  border-radius: 50%;
  background: #4fd1c5;
  color: #0f1115;
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}
.search-identity {
  min-width: 0;
}

.search-item .avatar {
  width: 24px; 
  height: 24px; 
  font-size: 12px;
  background: #4fd1c5;
  color: #0f1115;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
}

/* ==========================================
   13. СМЕНА ТЕМЫ (DARK / LIGHT)
   ========================================== */
.theme-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: #aaa;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.theme-toggle:hover {
  color: #4fd1c5;
  background: rgba(79, 209, 197, 0.1);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-toggle:active svg {
  transform: scale(0.8) rotate(45deg);
}

#theme-icon-dark, #theme-icon-light {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* --- СВЕТЛАЯ ТЕМА --- */
body.light-theme {
  background: #f4f6f8;
  color: #1a1d24;
}

body.light-theme .header,
body.light-theme .search-panel,
body.light-theme .card,
body.light-theme .form,
body.light-theme .profile-header-card,
body.light-theme .dropdown,
body.light-theme .search-results {
  background: #ffffff;
  border-color: #e1e4e8;
}

body.light-theme .nav-btn,
body.light-theme .search-toggle,
body.light-theme .theme-toggle,
body.light-theme .card p,
body.light-theme .card-detail,
body.light-theme .form label {
  color: #555;
}

body.light-theme .nav-btn:hover,
body.light-theme .nav-btn.active,
body.light-theme .search-toggle:hover,
body.light-theme .theme-toggle:hover {
  color: #0f1115;
  background: rgba(79, 209, 197, 0.2);
}

body.light-theme .card h3,
body.light-theme .logo {
  color: #0f1115;
}

body.light-theme .card-detail {
  background: #f4f6f8;
  border-left-color: #4fd1c5;
}

body.light-theme input,
body.light-theme textarea {
  background: #f4f6f8;
  border-color: #e1e4e8;
  color: #1a1d24;
}

body.light-theme .dropdown a {
  color: #1a1d24;
}

body.light-theme .dropdown a:hover {
  background: rgba(79, 209, 197, 0.1);
}

body.light-theme .page-transition,
body.light-theme #preloader {
  background-color: #f4f6f8;
}
/* ==========================================
   14. АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ========================================== */

@media (max-width: 768px) {
  /* Шапка */
  .header {
    flex-direction: column;
    padding: 12px 16px;
    gap: 12px;
  }

  .header-center {
    width: 100%;
    justify-content: space-between;
  }

  nav {
    flex-wrap: wrap;
  }

  .nav-btn {
    font-size: 14px;
    padding: 8px 12px;
  }

  .profile-btn .username {
    display: none; /* Скрываем ник в кнопке профиля, оставляем только аватар */
  }

  .profile-menu {
    position: absolute;
    top: 12px;
    right: 16px;
  }

  /* Выпадающие панели */
  .search-panel {
    top: auto;
    position: relative;
  }

  .search-wrapper {
    padding: 0 16px 16px 16px;
  }

  /* Основной контент */
  .container {
    margin: 20px auto;
    padding: 0 12px;
  }

  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .page-header h1 {
    font-size: 22px;
  }

  /* Карточки проектов в одну колонку */
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 16px;
  }

  /* Форма загрузки */
  .form {
    padding: 16px;
    margin: 16px auto;
  }

  /* Профиль */
  .profile-header-card {
    flex-direction: column;
    padding: 20px;
    text-align: center;
  }

  .profile-info {
    flex-direction: column;
  }

  .profile-name-row {
    justify-content: center;
    flex-wrap: wrap;
  }

  .profile-stats {
    width: 100%;
    justify-content: space-around;
    padding: 12px;
  }

  .profile-actions {
    width: 100%;
    align-items: center;
  }

  .btn-follow {
    max-width: 300px;
  }
}

/* Для очень маленьких экранов (например, iPhone SE) */
@media (max-width: 400px) {
  .nav-btn {
    font-size: 12px;
    padding: 6px 8px;
  }

  .page-header h1 {
    font-size: 18px;
  }

  .btn-add {
    width: 44px;
    height: 44px;
    font-size: 28px;
  }
}
.card-detail {
  font-size: 13px;
  color: #ccc;
  background: #0f1115;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 8px;
  border-left: 2px solid #4fd1c5;
  word-break: break-word;
}

.card-detail strong {
  color: #888;
}

body.light-theme .card-detail {
  background: #f4f6f8;
}
/* Кнопка удаления (корзина) */
.delete-btn {
  background: transparent;
  border: none;
  color: #888; /* Серый цвет по умолчанию */
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Красный цвет при наведении */
.delete-btn:hover {
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.1);
  transform: scale(1.1);
}

/* В светлой теме */
body.light-theme .delete-btn {
  color: #999;
}

body.light-theme .delete-btn:hover {
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.1);
}
/* Страница проекта */
.project-page {
  background: #1a1d24;
  padding: 40px;
  border-radius: 16px;
  border: 1px solid #2a2d35;
  max-width: 800px;
  margin: 40px auto;
}

.project-section {
  margin-bottom: 24px;
}

.project-section h3 {
  color: #4fd1c5;
  margin-bottom: 8px;
  font-size: 20px;
}

body.light-theme .project-page {
  background: #ffffff;
  border-color: #e1e4e8;
}
/* ==========================================
   15. ОНЛАЙН СЧЕТЧИК
   ========================================== */
.online-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(79, 209, 197, 0.1);
  border: 1px solid rgba(79, 209, 197, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
  color: #4fd1c5;
  cursor: default;
}

.online-dot {
  width: 8px;
  height: 8px;
  background-color: #4fd1c5;
  border-radius: 50%;
  box-shadow: 0 0 8px #4fd1c5;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(79, 209, 197, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(79, 209, 197, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 209, 197, 0); }
}

body.light-theme .online-badge {
  background: rgba(79, 209, 197, 0.15);
  color: #0f1115;
}
/* ==========================================
   16. МОДАЛЬНОЕ ОКНО (ИНСТРУКЦИЯ)
   ========================================== */
.instruction-link {
  display: inline-block;
  margin-top: 12px;
  color: #4fd1c5;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}

.instruction-link:hover {
  color: #3bb8ab;
}

/* Стили для модального окна */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #1a1d24;
  border: 1px solid #2a2d35;
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  width: 90%;
  position: relative;
  color: #e6e6e6;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  color: #4fd1c5;
  margin-bottom: 20px;
}

.close-modal {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  color: #888;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal:hover {
  color: #fff;
}

.instruction-step {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #2a2d35;
}

.instruction-step:last-of-type {
  border-bottom: none;
}

.instruction-step strong {
  color: #4fd1c5;
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.instruction-step p {
  color: #aaa;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.instruction-step code {
  background: #0f1115;
  padding: 2px 6px;
  border-radius: 4px;
  color: #4fd1c5;
  font-family: monospace;
}

.btn-download {
  display: block;
  text-align: center;
  margin-top: 24px;
  padding: 12px;
  background: #4fd1c5;
  color: #0f1115;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: background 0.3s;
}

.btn-download:hover {
  background: #3bb8ab;
}

body.light-theme .modal-content {
  background: #ffffff;
  border-color: #e1e4e8;
  color: #1a1d24;
}

body.light-theme .instruction-step p {
  color: #555;
}
pre code {
  font-family: 'Fira Code', 'Consolas', monospace;
}

body.light-theme .wokwi-container > div {
  background: #ffffff;
  border-color: #e1e4e8;
}
.delete-btn {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}
.delete-btn:hover {
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.1);
}
/* Обучение */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.course-progress {
  margin-bottom: 28px;
  padding: 20px 0;
  border-bottom: 1px solid #2a2d35;
}

.course-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.course-progress-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.course-progress-head p,
#course-progress-message {
  margin: 0;
  color: #888;
  font-size: 14px;
}

.course-progress-track {
  height: 8px;
  overflow: hidden;
  background: #2a2d35;
  border-radius: 4px;
}

.course-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: #4fd1c5;
  transition: width 0.3s ease;
}

.course-continue,
.course-next-link {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 6px;
  background: #4fd1c5;
  color: #0f1115;
  font-weight: 700;
  text-decoration: none;
}

.lesson-card.is-complete {
  border-color: #4fd1c5;
}

.lesson-card-status {
  display: inline-block;
  margin-top: 14px;
  color: #4fd1c5;
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 600px) {
  .course-progress-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.lesson-card {
  background: #1a1d24;
  border: 1px solid #2a2d35;
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s;
}

.lesson-card:hover {
  transform: translateY(-4px);
  border-color: #4fd1c5;
}

.lesson-number {
  color: #4fd1c5;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.lesson-card h3 {
  color: #fff;
  margin-bottom: 8px;
}

.lesson-card p {
  color: #888;
  font-size: 14px;
}

.lesson-theory {
  background: #1a1d24;
  padding: 20px;
  border-radius: 12px;
  border-left: 4px solid #4fd1c5;
  margin-bottom: 30px;
}

.lesson-theory p {
  margin-bottom: 10px;
  line-height: 1.6;
}

.lesson-theory code {
  background: #0f1115;
  padding: 2px 6px;
  border-radius: 4px;
  color: #4fd1c5;
}

.lesson-test {
  background: #1a1d24;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #2a2d35;
}

.test-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px;
  margin-bottom: 10px;
  background: #0f1115;
  border: 1px solid #2a2d35;
  color: #ccc;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.test-btn:hover {
  background: #2a2d35;
  color: #fff;
}

.test-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}