:root {
  --primary: #6C63FF;
  --primary-dark: #5a52d5;
  --bg-light: #F8FAFC;
  --bg-dark: #1A202C;
  --text-light: #2D3748;
  --text-dark: #E2E8F0;
  --card-light: #FFFFFF;
  --card-dark: #2D3748;
  --success: #4CAF50;
  --error: #F44336;
  --warning: #FF9800;
  --border-radius: 12px;
  --border-radius-full: 24px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] {
  --bg: var(--bg-light);
  --text: var(--text-light);
  --card: var(--card-light);
  --border: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --bg: var(--bg-dark);
  --text: var(--text-dark);
  --card: var(--card-dark);
  --border: rgba(255, 255, 255, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* Экран загрузки */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-content {
  text-align: center;
  padding: 20px;
}

.loading-logo {
  font-size: 4rem;
  margin-bottom: 2rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.progress-bar {
  width: 200px;
  height: 6px;
  background: rgba(108, 99, 255, 0.2);
  border-radius: 3px;
  margin: 2rem auto;
  overflow: hidden;
}

.progress {
  width: 30%;
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  animation: loading 2s ease-in-out infinite;
}

.motivation-text {
  font-size: 1.1rem;
  opacity: 0.8;
  margin-top: 1rem;
  min-height: 1.5rem;
}

@keyframes loading {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(300%); }
}

.hidden {
  display: none !important;
}

/* Кнопка назад */
.back-button {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.back-button button {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Основное приложение */
.app {
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
}

.header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.main-content {
  padding: 1.5rem;
  min-height: calc(100vh - 140px);
  padding-bottom: 100px; /* Добавляем отступ для нижнего меню */
}

/* Нижнее меню */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  display: flex;
  padding: 0.5rem;
  border-top: 1px solid var(--border);
  max-width: 500px;
  margin: 0 auto;
  z-index: 100;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  color: var(--text);
  opacity: 0.6;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.tab-btn.active {
  opacity: 1;
  background: rgba(108, 99, 255, 0.1);
  color: var(--primary);
}

.tab-btn .icon {
  font-size: 1.2rem;
}

.tab-btn .label {
  font-size: 0.75rem;
  font-weight: 500;
}

/* FAB кнопка */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

/* Карточки целей */
.goal-card {
  background: var(--card);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
}

.goal-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.goal-icon {
  font-size: 1.5rem;
  margin-right: 0.75rem;
}

.goal-title {
  font-weight: 600;
  font-size: 1.1rem;
  flex: 1;
}

.goal-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.7;
  transition: all 0.3s;
}

.icon-btn:hover {
  opacity: 1;
  background: rgba(108, 99, 255, 0.1);
}

.edit-btn {
  color: var(--primary);
}

.delete-btn {
  color: var(--error);
}

.goal-date {
  color: var(--text);
  opacity: 0.7;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Прогресс-бар для целей */
.goal-progress {
  margin: 1rem 0;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(108, 99, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.8rem;
  opacity: 0.7;
  text-align: center;
  margin-top: 0.5rem;
}

/* Состояние пустого экрана */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  opacity: 0.7;
}

.empty-state p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Секции профиля */
.profile-section {
  background: var(--card);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.profile-section h2 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
  color: var(--primary);
}

/* Переключатель темы */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Выпадающий список */
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Кнопка подписки */
.subscribe-btn {
  width: 100%;
  padding: 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1rem;
  font-weight: 600;
  transition: all 0.3s;
}

.subscribe-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* СТРУКТУРА ПЛАНЕРА - СПИСОК ДАТ */
.dates-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.date-item {
  background: var(--card);
  padding: 1.25rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.date-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.date-info {
  flex: 1;
}

.date-title {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.date-stats {
  font-size: 0.85rem;
  opacity: 0.7;
}

.date-actions {
  display: flex;
  gap: 0.5rem;
}

/* СТРАНИЦА ЗАДАЧ НА ДЕНЬ - КОМПАКТНАЯ */
.tasks-page {
  padding: 0;
}

.day-header {
  background: var(--card);
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.day-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.day-stats {
  opacity: 0.7;
  font-size: 0.9rem;
}

/* КОМПАКТНЫЙ СПИСОК ЗАДАЧ */
.compact-tasks {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1.5rem;
}

.compact-task {
  display: grid;
  grid-template-columns: 60px 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.compact-task:hover {
  background: rgba(108, 99, 255, 0.05);
}

.compact-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
}

.compact-text {
  font-size: 0.9rem;
  line-height: 1.3;
}

/* КНОПКИ ДЕЙСТВИЙ ДЛЯ ЗАДАЧ */
.compact-task-actions {
  display: flex;
  gap: 0.25rem;
}

/* ИСПРАВЛЕННЫЙ ПЕРЕКЛЮЧАТЕЛЬ - УМЕНЬШЕННЫЙ КРЕСТИК И ПУСТОЙ ЗЕЛЕНЫЙ */
.compact-toggle {
  width: 36px;
  height: 20px;
  background: var(--error);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 2px;
}

.compact-toggle.completed {
  background: var(--success);
  justify-content: flex-end;
}

.compact-handle {
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.compact-toggle:not(.completed) .compact-handle::after {
  content: "❌";
  font-size: 8px;
}

.compact-toggle.completed .compact-handle::after {
  content: "";
}

/* СТРУКТУРА ДНЕВНИКА */
.notes-dates-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.note-date-item {
  background: var(--card);
  padding: 1.25rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.note-date-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.note-date-info {
  flex: 1;
}

.note-date-title {
  font-weight: 600;
  color: var(--primary);
}

.note-date-preview {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

/* СТРАНИЦА ЗАПИСИ ДНЕВНИКА */
.note-page {
  padding: 0;
}

.note-header {
  background: var(--card);
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.note-page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.note-content {
  padding: 1.5rem;
  background: var(--card);
  margin: 1rem 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  min-height: 200px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.note-actions {
  display: flex;
  gap: 1rem;
  margin: 1rem 1.5rem;
}

.note-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.note-edit {
  background: var(--primary);
  color: white;
}

.note-delete {
  background: var(--error);
  color: white;
}

.note-cancel {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.note-editor {
  padding: 1.5rem;
  background: var(--card);
  margin: 1rem 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
}

.note-textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  line-height: 1.5;
}

.note-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.add-text-btn {
  width: 100%;
  margin: 1rem 1.5rem;
}

/* УСИЛЕННЫЕ КНОПКИ */
.enhanced-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 3px 6px rgba(108, 99, 255, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.enhanced-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 10px rgba(108, 99, 255, 0.4);
}

.enhanced-btn.delete {
  background: var(--error);
  box-shadow: 0 3px 6px rgba(244, 67, 54, 0.3);
}

.enhanced-btn.delete:hover {
  background: #d32f2f;
  box-shadow: 0 5px 10px rgba(244, 67, 54, 0.4);
}

.add-task-btn {
  width: 100%;
  margin-top: 1rem;
}

/* МОДАЛЬНЫЕ ОКНА */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--card);
  border-radius: var(--border-radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
  color: var(--text);
}

.close-btn:hover {
  opacity: 1;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.time-input-group {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.time-input {
  flex: 1;
}

.ampm-select {
  width: 80px;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn:hover {
  transform: translateY(-1px);
}

/* МОДАЛЬНОЕ ОКНО ПОДТВЕРЖДЕНИЯ УДАЛЕНИЯ */
.confirm-modal .modal-content {
  max-width: 350px;
}

.confirm-text {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 1rem;
}

/* Кнопка добавления на главный экран */
.add-to-home-btn {
  width: 100%;
  padding: 1rem;
  background: var(--warning);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1rem;
  font-weight: 600;
  transition: all 0.3s;
}

.add-to-home-btn:hover {
  background: #e68900;
  transform: translateY(-2px);
}

/* Адаптивность */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.3rem;
  }
  
  .main-content {
    padding: 1rem;
    padding-bottom: 100px;
  }
  
  .goal-card {
    padding: 1rem;
  }
  
  .tab-btn .label {
    font-size: 0.7rem;
  }
  
  .modal-content {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  .compact-tasks {
    padding: 0 1rem;
  }
  
  .note-content, .note-editor, .note-actions {
    margin: 1rem;
  }
  
  .add-text-btn {
    margin: 1rem;
  }
}

@media (min-width: 769px) {
  .app {
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    min-height: 100vh;
  }
}

/* Утилиты */
.text-center {
  text-align: center;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.mt-1 {
  margin-top: 1rem;
}

.mt-2 {
  margin-top: 2rem;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 1rem;
}

.w-full {
  width: 100%;
}

/* Специальные стили для модального окна подтверждения режима */
.age-warning {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid var(--error);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin: 1rem 0;
}

.age-warning-text {
  color: var(--error);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.age-warning-details {
  font-size: 0.9rem;
  opacity: 0.8;
  line-height: 1.4;
}

/* Стили для страницы оплаты */
.payment-method-btn {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
}

.payment-method-btn:hover {
  border-color: var(--primary);
  background: rgba(108, 99, 255, 0.05);
  transform: translateY(-2px);
}