:root {
  --bg-gradient: linear-gradient(180deg, #EAF4FF 0%, #FDE7EF 100%);
  --btn-gradient: linear-gradient(135deg, #86B6FF, #FFA7C2);
  --fg: #222;
  --mut: #f2f4f8;
  --border: #e5e8ee;
  --shadow: rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--fg);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  min-height: 100vh;
}

header {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 24px;
  margin: 0 16px 0 0;
  background: var(--btn-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

nav a {
  text-decoration: none;
  color: var(--fg);
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s;
}

nav a:hover {
  background: var(--mut);
}

nav a.active {
  background: var(--btn-gradient);
  color: white;
  font-weight: 600;
}

.user-info {
  margin-left: auto;
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Уведомления */
.notification-bell-wrapper {
  margin-left: auto;
  position: relative;
}

.notification-bell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #e5e8ee;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  position: relative;
}

.notification-bell:hover {
  background: white;
  border-color: #667eea;
  transform: scale(1.05);
}

.bell-icon {
  font-size: 20px;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Выпадающее меню пользователя */
.user-menu-wrapper {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #e5e8ee;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.user-menu-trigger:hover {
  background: white;
  border-color: #86B6FF;
  box-shadow: 0 4px 12px rgba(134, 182, 255, 0.15);
  transform: translateY(-1px);
}

.user-menu-trigger:active {
  transform: translateY(0);
}

.user-avatar {
  font-size: 20px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e8ee;
  display: block;
}

.user-name {
  color: #333;
  font-weight: 600;
}

.user-arrow {
  font-size: 10px;
  color: #999;
  transition: transform 0.2s;
}

.user-menu-trigger.active .user-arrow {
  transform: rotate(180deg);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 1000;
  overflow: hidden;
  border: 1px solid #e5e8ee;
}

.user-menu-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s;
  border-bottom: 1px solid #f0f0f0;
}

.user-menu-item:last-child {
  border-bottom: none;
}

.user-menu-item:hover {
  background: #f8f9fa;
  color: #86B6FF;
}

.menu-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

main {
  padding: 32px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

h2, h3 {
  color: var(--fg);
  margin-top: 0;
}

h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px var(--shadow);
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--btn-gradient);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px var(--shadow);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.btn-secondary {
  background: var(--mut);
  color: var(--fg);
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b, #ff8787);
}

.btn-small {
  padding: 6px 12px;
  font-size: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--btn-gradient);
  color: white;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background: rgba(134, 182, 255, 0.05);
}

form {
  max-width: 600px;
}

label {
  display: block;
  margin-bottom: 16px;
  font-weight: 500;
}

label span {
  display: block;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #86B6FF;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.flash {
  margin: 0 0 24px 0;
}

/* Современные уведомления */
.flash-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: 100%;
  max-width: 600px;
  padding: 0 20px;
  pointer-events: none;
}

.flash-notification {
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: auto;
}

.flash-notification.show {
  opacity: 1;
  transform: translateY(0);
}

.flash-notification.hide {
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
}

.flash-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.flash-icon {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.flash-message {
  flex: 1;
}

/* Success notification */
.flash-notification.success .flash-content {
  background: rgba(40, 167, 69, 0.15);
  color: #155724;
  border-left: 4px solid #28a745;
}

.flash-notification.success .flash-icon {
  background: #28a745;
  color: white;
}

/* Error notification */
.flash-notification.error .flash-content {
  background: rgba(220, 53, 69, 0.15);
  color: #721c24;
  border-left: 4px solid #dc3545;
}

.flash-notification.error .flash-icon {
  background: #dc3545;
  color: white;
}

/* Info notification */
.flash-notification.info .flash-content {
  background: rgba(23, 162, 184, 0.15);
  color: #0c5460;
  border-left: 4px solid #17a2b8;
}

.flash-notification.info .flash-icon {
  background: #17a2b8;
  color: white;
}

/* Warning notification */
.flash-notification.warning .flash-content {
  background: rgba(255, 193, 7, 0.15);
  color: #856404;
  border-left: 4px solid #ffc107;
}

.flash-notification.warning .flash-icon {
  background: #ffc107;
  color: white;
}

/* Адаптивность */
@media (max-width: 768px) {
  .flash-container {
    top: 70px;
    max-width: 100%;
    padding: 0 16px;
  }
  
  .flash-content {
    padding: 14px 18px;
    font-size: 14px;
  }
  
  .flash-icon {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }
}

footer {
  padding: 24px;
  text-align: center;
  color: #666;
  margin-top: 48px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.theme-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px var(--shadow);
  transition: transform 0.2s;
  cursor: pointer;
}

.theme-card:hover {
  transform: translateY(-4px);
}

.theme-card h3 {
  margin: 0 0 12px 0;
  background: var(--btn-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.dashboard-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px var(--shadow);
  text-align: center;
  transition: transform 0.2s;
}

.dashboard-card:hover {
  transform: translateY(-4px);
}

.dashboard-card h3 {
  margin: 0 0 16px 0;
  font-size: 20px;
}

.dashboard-card .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.question-block {
  background: var(--mut);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.answer-option {
  padding: 10px;
  margin: 8px 0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.answer-option:hover {
  background: #e3f2fd;
}

.answer-option input {
  margin-right: 10px;
}

.timer-container {
  text-align: center;
  padding: 48px;
}

.timer-display {
  font-size: 72px;
  font-weight: 700;
  background: var(--btn-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 24px 0;
}

.timer-controls {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
}

.motivation-text {
  font-size: 20px;
  color: #666;
  margin-top: 24px;
  font-style: italic;
}

.schedule-item {
  background: white;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  border-left: 4px solid transparent;
  border-image: var(--btn-gradient) 1;
}

.schedule-item.completed {
  opacity: 0.6;
}

.schedule-item.paid {
  border-left-color: #28a745;
}

.schedule-item.unpaid {
  border-left-color: #dc3545;
}

.idea-item {
  background: #fff3cd;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  border-left: 4px solid #ffc107;
}

.note-item {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px var(--shadow);
}

.note-item.completed {
  background: #d4edda;
}

.profile-section {
  max-width: 800px;
  margin: 0 auto;
}

.profile-field {
  margin-bottom: 20px;
}

.profile-field label {
  font-weight: 600;
  color: #555;
}

.auth-container {
  max-width: 500px;
  margin: 80px auto;
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 8px 24px var(--shadow);
}

.auth-container h2 {
  text-align: center;
  background: var(--btn-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.hero {
  text-align: center;
  padding: 60px 20px;
}

.hero h1 {
  font-size: 48px;
  background: var(--btn-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}

.hero p {
  font-size: 20px;
  color: #666;
  margin-bottom: 32px;
}

.stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 32px;
}

.stat-item {
  text-align: center;
}

.stat-item .number {
  font-size: 36px;
  font-weight: 700;
  background: var(--btn-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-item .label {
  color: #666;
  margin-top: 8px;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .user-info {
    margin-left: 0;
  }
  
  .dashboard-grid, .grid {
    grid-template-columns: 1fr;
  }
  
  .timer-display {
    font-size: 48px;
  }
}

/* Нижняя навигация для админских страниц */
.admin-navigation-bottom {
  margin-top: 50px;
  padding-top: 30px;
  text-align: center;
  border-top: 1px solid #e1e5e9;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============ Единообразие отображения текста вопросов (формат А4) ============ */
/* Используется во всех местах: создание, просмотр, прохождение, результаты */
.question-text-unified {
    max-width: 794px; /* Фиксированная ширина как А4 (21cm) */
    width: 100%;
    line-height: 1.6;
    white-space: pre-wrap; /* Сохраняем переносы строк */
    word-wrap: break-word; /* Переносим длинные слова */
    font-size: 16px;
}

/* Textarea для ввода вопросов */
textarea.question-text-input {
    max-width: 794px;
    width: 100%;
    line-height: 1.6;
    font-size: 16px;
    font-family: inherit;
}
