/* ===== Базовые переменные и настройки ===== */
:root {
  /* Цветовая палитра */
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --secondary: #7C3AED;
  --accent: #EC4899;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  
  /* Нейтральные цвета */
  --dark: #0F172A;
  --dark-light: #1E293B;
  --dark-medium: #334155;
  --light: #F8FAFC;
  --light-dark: #E2E8F0;
  --light-medium: #CBD5E1;
  
  /* Текст */
  --text-primary: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  
  /* Фоны */
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-hover: rgba(51, 65, 85, 0.5);
  
  /* Границы */
  --border: rgba(148, 163, 184, 0.1);
  --border-light: rgba(148, 163, 184, 0.05);
  
  /* Тени */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
  
  /* Размеры */
  --sidebar-width: 280px;
  --header-height: 80px;
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Сброс стилей и базовые настройки ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ===== Типографика ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

/* ===== Компоненты ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn i {
  margin-right: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  background: #DC2626;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-block {
  display: flex;
  width: 100%;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
}

.card-title i {
  margin-right: 0.75rem;
  color: var(--primary);
}

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

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

.form-input, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: calc(var(--border-radius) / 2);
  color: var(--text-primary);
  font-family: inherit;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* ===== Макет ===== */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Боковая панель */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
}

.sidebar-header {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo img {
  height: 40px;
}

.sidebar-logo span {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-user {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.sidebar-user-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary);
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.4);
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info {
  text-align: center;
}

.sidebar-user-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sidebar-user-position {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.sidebar-menu {
  list-style: none;
  padding: 0 0.75rem;
}

.sidebar-menu li {
  margin-bottom: 0.25rem;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  border-radius: calc(var(--border-radius) / 2);
  position: relative;
}

.sidebar-menu a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-menu a.active {
  background: rgba(79, 70, 229, 0.15);
  color: var(--primary);
}

.sidebar-menu a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 70%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.sidebar-menu i {
  margin-right: 0.75rem;
  font-size: 1.125rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 1.25rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  border-radius: calc(var(--border-radius) / 2);
  padding-left: 0.5rem;
}

.sidebar-footer a:hover {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
}

.sidebar-footer i {
  margin-right: 0.75rem;
}

/* Основной контент */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  transition: margin-left 0.3s ease;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.main-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  display: inline-block;
}

.main-header h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
}

.mobile-menu-toggle {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.mobile-menu-toggle:hover {
  background: rgba(79, 70, 229, 0.2);
}

/* Сетка настроек */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.settings-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

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

.settings-card.full-width {
  grid-column: 1 / -1;
}

/* Секция ВКонтакте */
.vk-section {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(124, 58, 237, 0.1));
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.vk-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
}

.vk-section-title i {
  margin-right: 0.75rem;
  color: #0077FF;
}

.vk-linked-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.vk-user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: calc(var(--border-radius) / 2);
  border: 1px solid var(--border);
}

.vk-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #0077FF;
}

.vk-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.vk-profile-link a {
  color: var(--primary);
}

.vk-auth-container {
  margin-top: 1rem;
  text-align: center;
}

.vk-auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #0077FF;
  color: white;
  border: none;
  border-radius: calc(var(--border-radius) / 2);
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  margin-top: 0.5rem;
  box-shadow: 0 4px 14px rgba(0, 119, 255, 0.3);
}

.vk-auth-button:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 119, 255, 0.4);
}

.vk-auth-button i {
  margin-right: 0.5rem;
  font-size: 1.125rem;
}

.vk-sdk-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: calc(var(--border-radius) / 2);
  padding: 0.75rem;
  margin-top: 0.75rem;
  color: var(--text-primary);
  text-align: center;
}

.vk-loading {
  display: none;
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
}

.vk-loading i {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Активные заявки */
.requests-container {
  margin-top: 2rem;
}

.request-item {
  background: var(--bg-secondary);
  border-radius: calc(var(--border-radius) / 2);
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--warning);
  transition: var(--transition);
}

.request-item:hover {
  transform: translateX(5px);
}

.request-field {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--warning);
}

.request-values {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.request-date {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Уведомления */
.notification-button {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  z-index: 1000;
  transition: var(--transition);
}

.notification-button:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.5);
}

.notification-button .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: white;
  font-size: 0.75rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.notifications-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.notifications-modal.active {
  display: flex;
  opacity: 1;
}

.notifications-modal-content {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.notifications-modal.active .notifications-modal-content {
  transform: scale(1);
}

.notifications-modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notifications-modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notifications-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notifications-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.notifications-modal-body {
  padding: 0;
  max-height: calc(80vh - 80px);
  overflow-y: auto;
}

.notification-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

.notification-item:hover {
  background: var(--bg-hover);
}

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

.notification-item.unread {
  background: rgba(79, 70, 229, 0.05);
  border-left: 3px solid var(--primary);
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.notification-title {
  font-weight: 600;
  color: var(--text-primary);
}

.notification-time {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.notification-message {
  color: var(--text-secondary);
  line-height: 1.4;
}

.notification-type {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.notification-type.success {
  background: var(--success);
}

.notification-type.error {
  background: var(--danger);
}

.notification-type.warning {
  background: var(--warning);
}

.notification-type.info {
  background: var(--info);
}

/* Уведомления (toast) */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toast {
  background: var(--bg-secondary);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  min-width: 300px;
  max-width: 450px;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transform: translateX(150%);
  opacity: 0;
  animation: slideIn 0.4s forwards;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 4px 0 0 4px;
}

.toast.success::before {
  background: var(--success);
}

.toast.error::before {
  background: var(--danger);
}

.toast.warning::before {
  background: var(--warning);
}

.toast.info::before {
  background: var(--info);
}

.toast-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast.info .toast-icon {
  color: var(--info);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.toast-message {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  transition: var(--transition);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

@keyframes slideIn {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  to {
    transform: translateX(150%);
    opacity: 0;
  }
}

/* ===== Адаптивность ===== */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }
  
  .main-header h1 {
    font-size: 1.75rem;
  }
  
  .settings-card {
    padding: 1.25rem;
  }
  
  .vk-section {
    padding: 1.25rem;
  }
  
  .vk-user-info {
    flex-direction: column;
    text-align: center;
  }
  
  .notifications-modal-content {
    width: 95%;
    max-height: 90vh;
  }
  
  .toast {
    min-width: 250px;
    max-width: 350px;
  }
}

@media (max-width: 576px) {
  .sidebar {
    width: 100%;
    max-width: 300px;
  }
  
  .main-header h1 {
    font-size: 1.5rem;
  }
  
  .card {
    padding: 1rem;
  }
  
  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
  }
  
  .form-input, .form-select {
    padding: 0.625rem 0.875rem;
  }
}