/* auth-styles.css */
/* Стили для авторизации и правой панели истории */

/* ========== ИНФОРМАЦИОННЫЕ БАННЕРЫ ========== */

.info-banner {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  color: #1a1a1a;
  padding: 20px 30px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 9000;
  max-width: 500px;
  animation: slideDown 0.3s ease;
}

.info-banner.warning {
  background: #fff9e6;
  border-color: #ffd700;
  color: #856404;
}

.info-banner.error {
  background: #fff0f0;
  border-color: #ff6b6b;
  color: #721c24;
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.banner-content {
  text-align: center;
}

.banner-content h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  font-weight: 600;
}

.banner-content p {
  margin: 10px 0;
  font-size: 14px;
  opacity: 0.95;
}

.banner-content ul {
  text-align: left;
  margin: 15px 0;
  padding-left: 20px;
}

.banner-content ul li {
  margin: 8px 0;
  font-size: 14px;
}

.primary-btn {
  background: #1a1a1a;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 15px;
}

.primary-btn:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Индикатор синхронизации */
.sync-indicator {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 13px;
  z-index: 9999;
  display: none;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(10px);
}

/* Кнопка входа в sidebar */
.sidebar-signin-btn {
  margin-top: 20px;
  background: #1a1a1a;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.sidebar-signin-btn:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Встроенная кнопка CloudKit Sign-In - минималистичная */
#apple-sign-in-button {
  margin-top: 16px;
  width: 100%;
}

/* Минималистичные стили для CloudKit кнопки */
#apple-sign-in-button > div {
  background: #000000 !important;
  border-radius: 10px !important;
  padding: 12px 20px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
  border: none !important;
  text-align: center !important;
  color: white !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

#apple-sign-in-button > div:hover {
  background: #1a1a1a !important;
  transform: scale(1.02);
}

/* Принудительно белый цвет для всех дочерних элементов */
#apple-sign-in-button > div * {
  color: white !important;
}

/* Скрыть дубликаты кнопок, если CloudKit создаст несколько */
#apple-sign-in-button > div:not(:first-child) {
  display: none !important;
}

/* ========== МОДАЛЬНОЕ ОКНО АВТОРИЗАЦИИ ========== */

.auth-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.auth-modal-content {
  background-color: white;
  padding: 40px 35px;
  border-radius: 16px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.auth-close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.auth-close:hover {
  color: #333;
}

#auth-title {
  margin: 0 0 25px 0;
  text-align: center;
  font-size: 26px;
  font-weight: 600;
  color: #1a1a1a;
}

.auth-benefits {
  margin-bottom: 25px;
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
  border-radius: 12px;
  border: 1px solid #e1e8ed;
}

.auth-benefits p {
  margin: 0 0 12px 0;
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.auth-benefits ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.auth-benefits li {
  margin: 10px 0;
  font-size: 14px;
  color: #555;
  line-height: 1.5;
}

/* ========== КНОПКИ АВТОРИЗАЦИИ ========== */

.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-btn {
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

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

.auth-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Apple Button */
.apple-btn {
  background-color: #000;
  color: white;
}

.apple-btn:hover {
  background-color: #1a1a1a;
}

/* Google Button */
.google-btn {
  background-color: #fff;
  color: #333;
  border: 2px solid #e0e0e0;
}

.google-btn:hover {
  border-color: #4285F4;
  background-color: #f8f9fa;
}

/* Email Button */
.email-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.email-btn:hover {
  background: linear-gradient(135deg, #5568d3 0%, #6a4091 100%);
}

.email-btn-secondary {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.email-btn-secondary:hover {
  background: linear-gradient(135deg, #e082ea 0%, #e4465b 100%);
}

/* Anonymous Button */
.anonymous-btn {
  background-color: #f5f5f5;
  color: #333;
  border: 2px solid #e0e0e0;
}

.anonymous-btn:hover {
  background-color: #ebebeb;
  border-color: #d0d0d0;
}

.auth-divider {
  text-align: center;
  margin: 10px 0;
  color: #999;
  font-size: 14px;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background-color: #ddd;
}

.auth-divider::before {
  left: 0;
}

.auth-divider::after {
  right: 0;
}

/* ========== EMAIL ФОРМА ========== */

.email-form {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.email-form input {
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 16px;
  transition: all 0.2s;
  font-family: inherit;
}

.email-form input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-btn-text {
  background: none;
  border: none;
  color: #667eea;
  cursor: pointer;
  font-size: 15px;
  padding: 10px;
  transition: color 0.2s;
  font-weight: 500;
}

.auth-btn-text:hover {
  color: #5568d3;
}

/* ========== СТАТУС ========== */

.auth-status {
  margin-top: 15px;
  padding: 12px 16px;
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  display: none;
  animation: slideIn 0.3s ease;
}

.auth-status.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  display: block;
}

.auth-status.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  display: block;
}

.auth-status.warning {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
  display: block;
}

/* ========== УВЕДОМЛЕНИЕ О МИГРАЦИИ ========== */

.migration-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-size: 15px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
}

.migration-notification.show {
  opacity: 1;
  transform: translateX(0);
}

/* ========== ЛЕВАЯ ПАНЕЛЬ ИСТОРИИ (SIDEBAR) - МИНИМАЛИЗМ ========== */

.history-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 280px;
  background-color: #fafafa;
  border-right: 1px solid #e0e0e0;
  box-shadow: none;
  transform: translateX(0); /* Открыт по умолчанию */
  transition: transform 0.3s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

/* Свернутое состояние */
.history-sidebar.collapsed {
  transform: translateX(-280px); /* Прячем влево */
}

.history-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 24px 20px 16px 70px; /* Отступ слева для бургер-иконки */
  border-bottom: 1px solid #e0e0e0;
  background-color: white;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: -0.2px;
}

.sidebar-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.sidebar-close:hover {
  background-color: #f5f5f5;
  color: #333;
}

.sidebar-user-info {
  padding: 16px 20px;
  background: #f5f5f5;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e0e0e0;
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #666;
}

.sidebar-user-details {
  flex: 1;
}

.sidebar-user-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.sidebar-user-email {
  font-size: 13px;
  opacity: 0.9;
  margin: 2px 0 0 0;
}

.sidebar-signout-btn {
  background: white;
  border: 1px solid #e0e0e0;
  color: #666;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-signout-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
  color: #333;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.sidebar-text-item {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-text-item:hover {
  border-color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateX(-2px);
}

.sidebar-text-item.selected {
  border-color: #1a1a1a;
  border-width: 2px;
  background-color: #fafafa;
}

.sidebar-text-preview {
  font-size: 14px;
  color: #333;
  margin: 0 0 8px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-text-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #999;
}

.sidebar-text-date {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar-text-date svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.sidebar-text-favorite {
  color: #fbbf24;
}

.sidebar-text-favorite svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: currentColor;
}

.icon-star-filled {
  fill: #fbbf24;
  stroke: #fbbf24;
}

.sidebar-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.sidebar-empty-icon {
  margin-bottom: 16px;
  opacity: 0.3;
}

.sidebar-empty-icon svg {
  width: 48px;
  height: 48px;
  stroke: currentColor;
}

.sidebar-empty-text {
  font-size: 15px;
  line-height: 1.5;
}

/* ========== КНОПКА ПЕРЕКЛЮЧЕНИЯ SIDEBAR ========== */

.sidebar-toggle-btn {
  position: fixed;
  left: 16px;
  top: 16px;
  background: white;
  color: #333;
  border: 1px solid #e0e0e0;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  font-size: 0; /* Убираем стандартный текст */
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.2s;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke: #333;
}

.sidebar-toggle-btn:hover {
  background: #f5f5f5;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

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

/* ========== АДАПТИВ ========== */

@media (max-width: 768px) {
  .auth-modal-content {
    padding: 30px 25px;
    max-width: 95%;
  }

  .history-sidebar {
    width: 100%;
  }

  .sidebar-toggle-btn {
    width: 44px;
    height: 44px;
    right: 16px;
    top: 16px;
  }
}

@media (max-width: 480px) {
  #auth-title {
    font-size: 22px;
  }

  .auth-btn {
    padding: 12px 16px;
    font-size: 15px;
  }

  .auth-benefits {
    padding: 16px;
  }

  .auth-benefits li {
    font-size: 13px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .auth-modal-content {
    background-color: #1f2937;
    color: #f9fafb;
  }

  #auth-title {
    color: #f9fafb;
  }

  .auth-benefits {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-color: #374151;
  }

  .auth-benefits p {
    color: #f9fafb;
  }

  .auth-benefits li {
    color: #d1d5db;
  }

  .email-form input {
    background-color: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }

  .email-form input:focus {
    border-color: #667eea;
  }

  .history-sidebar {
    background-color: #1f2937;
    border-left-color: #374151;
  }

  .sidebar-header {
    background-color: #111827;
    border-bottom-color: #374151;
  }

  .sidebar-header h3 {
    color: #f9fafb;
  }

  .sidebar-text-item {
    background-color: #111827;
    border-color: #374151;
  }

  .sidebar-text-preview {
    color: #f9fafb;
  }
}

