/* main.css - Адаптивные стили для мобильных устройств */

/* Базовые настройки и CSS переменные */
:root {
  --primary-color: #4e73df;
  --primary-dark: #224abe;
  --secondary-color: #858796;
  --success-color: #1cc88a;
  --danger-color: #e74a3b;
  --warning-color: #f6c23e;
  --light-color: #f8f9fc;
  --dark-color: #5a5c69;
  --white: #ffffff;
  --border-radius: 0.5rem;
  --border-radius-sm: 0.35rem;
  --box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
  --box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --transition: all 0.3s ease;
  --sidebar-width: 280px;
  --header-height: 60px;
}

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

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

body {
  font-family: 'Open Sans', sans-serif;
  background: radial-gradient(circle, var(--primary-color) 0%, var(--primary-dark) 100%);
  min-height: 100vh;
  line-height: 1.6;
  color: #333;
  overflow-x: hidden;
}

/* Навигация проекта - адаптивная */
.project-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: rgba(255, 255, 255, 0.98);
  padding: 12px 20px;
  box-shadow: var(--box-shadow-sm);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.project-nav__links-wrapper {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.project-nav a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  white-space: nowrap;
}

.project-nav a:hover {
  background: rgba(78, 115, 223, 0.1);
  color: var(--primary-dark);
}

/* Мобильное меню */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--primary-color);
  cursor: pointer;
  padding: 5px;
}

/* Основные контейнеры */
.with-nav {
  position: relative;
  min-height: 100vh;
  padding-top: var(--header-height);
}

.radial-bg {
  background: radial-gradient(circle, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  min-height: calc(100vh - var(--header-height));
}

/* Белая панель форм - адаптивная */
.white-plate {
  background: var(--white);
  border-radius: 15px;
  padding: 30px;
  box-shadow: var(--box-shadow);
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.white-plate::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
}

.white-plate--payment {
  max-width: 450px;
}

.white-plate__header {
  margin-bottom: 25px;
  text-align: center;
}

.white-plate__logo {
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  font-weight: 800;
  color: var(--dark-color);
  margin: 0;
  line-height: 1.3;
}

.white-plate__logo span {
  color: var(--primary-color);
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.white-plate__line-between {
  height: 1px;
  background: linear-gradient(90deg, transparent, #e3e6f0, transparent);
  margin: 20px 0;
}

.white-plate__line-between--main {
  margin: 25px 0;
}

/* Формы - адаптивные */
.form-group {
  margin-bottom: 1.25rem;
}

.form-control {
  border: 1px solid #d1d3e2;
  border-radius: var(--border-radius-sm);
  padding: 12px 15px;
  font-size: 16px; /* Увеличено для мобильных */
  transition: var(--transition);
  background: var(--white);
  width: 100%;
  -webkit-appearance: none; /* Убирает стили iOS */
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
  outline: none;
}

.custom-select {
  border: 1px solid #d1d3e2;
  border-radius: var(--border-radius-sm);
  padding: 12px 15px;
  font-size: 16px;
  background: var(--white);
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5' viewBox='0 0 4 5'%3e%3cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 8px 10px;
}

label {
  font-weight: 600;
  color: var(--dark-color);
  margin-bottom: 8px;
  display: block;
  font-size: 14px;
}

/* Кнопки - адаптивные */
.btn {
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  padding: 14px 24px;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  text-align: center;
  min-height: 50px;
  touch-action: manipulation; /* Улучшает тач-события */
}

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

.btn-lg {
  padding: 16px 30px;
  font-size: 18px;
  min-height: 56px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--white);
  box-shadow: 0 2px 4px rgba(78, 115, 223, 0.3);
}

.btn-primary:hover,
.btn-primary:focus {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(78, 115, 223, 0.4);
}

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

.btn-light {
  background: var(--white);
  color: var(--dark-color);
  border: 1px solid #d1d3e2;
}

.btn-light.active {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

.btn-danger {
  background: var(--danger-color);
  color: var(--white);
}

.btn-link {
  color: var(--primary-color);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  min-height: auto;
}

/* Левая панель - адаптивная */
.left-panel {
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--white);
  min-height: 100vh;
  padding: 20px 15px;
  width: var(--sidebar-width);
  position: fixed;
  left: 0;
  top: var(--header-height);
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.left-panel--mobile-hidden {
  transform: translateX(-100%);
}

.left-panel__logo {
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.left-panel__logo-title {
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 700;
  margin-bottom: 5px;
}

.left-panel__logo-subtitle {
  font-size: 12px;
  opacity: 0.8;
  font-weight: 400;
}

.left-panel__user {
  margin: 25px 0;
  display: flex;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.left-panel__user-photo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.left-panel__user-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.left-panel__user-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.left-panel__navigation {
  margin-top: 25px;
}

.left-panel__navigation-title {
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 15px;
  opacity: 0.7;
  font-weight: 600;
  letter-spacing: 0.5px;
}

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

.left-panel__navigation li {
  margin-bottom: 5px;
}

.left-panel__navigation a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  font-weight: 500;
  font-size: 14px;
}

.left-panel__navigation a:hover,
.left-panel__navigation a.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
}

/* Основная область контента - адаптивная */
.main-wrapper {
  margin-left: var(--sidebar-width);
  padding: 25px 20px;
  background: var(--light-color);
  min-height: calc(100vh - var(--header-height));
  transition: margin-left 0.3s ease;
}

.main-wrapper--full {
  margin-left: 0;
}

.body--dashboard {
  background: var(--light-color);
}

.admin-heading-1 {
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 25px;
  color: var(--dark-color);
  position: relative;
  padding-bottom: 12px;
  line-height: 1.3;
}

.admin-heading-1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
  border-radius: 2px;
}

/* Область форм - адаптивная */
.form-wrapper {
  padding: 25px 20px;
  background: var(--light-color);
  min-height: calc(100vh - var(--header-height));
}

/* Карточки - адаптивные */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--box-shadow);
  margin-bottom: 25px;
  transition: var(--transition);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0.5rem 1.5rem rgba(58, 59, 69, 0.2);
}

.card-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--white);
  border-radius: 12px 12px 0 0 !important;
  padding: 20px;
  font-weight: 700;
  font-size: clamp(1rem, 3vw, 1.125rem);
  border: none;
}

.card-body {
  padding: 25px 20px;
}

/* Таблицы - адаптивные */
.table-responsive {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

.table {
  background: var(--white);
  margin-bottom: 0;
  width: 100%;
  min-width: 600px; /* Минимальная ширина для горизонтального скролла */
}

.table th {
  background: var(--light-color);
  border-bottom: 2px solid #e3e6f0;
  font-weight: 700;
  color: var(--dark-color);
  padding: 15px 12px;
  font-size: 14px;
  white-space: nowrap;
}

.table td {
  padding: 15px 12px;
  vertical-align: middle;
  border-color: #e3e6f0;
  font-size: 14px;
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background: rgba(78, 115, 223, 0.05);
}

.fs-14 {
  font-size: 14px;
}

/* Бейджи */
.badge {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-pill {
  border-radius: 50rem;
}

/* Группы кнопок - адаптивные */
.btn-group {
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  box-shadow: var(--box-shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: #d1d3e2;
}

.btn-group .btn {
  flex: 1;
  min-width: 80px;
  margin: 0;
  border-radius: 0;
  border: none;
}

/* Сетка и расположение */
.row {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.row:last-child {
  margin-bottom: 0;
}

.col {
  flex: 1;
  min-width: 200px;
}

.mb-3 {
  margin-bottom: 1rem !important;
}

.mb-4 {
  margin-bottom: 1.5rem !important;
}

.text-right {
  text-align: right;
}

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

.justify-content-start {
  justify-content: flex-start;
}

.justify-content-between {
  justify-content: space-between;
}

.align-items-center {
  align-items: center;
}

/* Оверлей для мобильного меню */
.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-overlay--visible {
  opacity: 1;
  visibility: visible;
}

/* Медиа-запросы для адаптивности */

/* Планшеты и маленькие ноутбуки */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 250px;
  }
  
  .white-plate {
    padding: 25px;
    margin: 20px;
  }
  
  .main-wrapper {
    padding: 20px 15px;
  }
  
  .form-wrapper {
    padding: 20px 15px;
  }
}

/* Планшеты (портрет) и большие телефоны */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
    --header-height: 56px;
  }
  
  .project-nav {
    padding: 10px 15px;
  }
  
  .project-nav__links-wrapper {
    gap: 10px;
  }
  
  .project-nav a {
    font-size: 13px;
    padding: 6px 10px;
  }
  
  .mobile-menu-toggle {
    display: block;
    position: fixed;
    top: 10px;
    left: 15px;
    z-index: 1101;
    background: var(--white);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--box-shadow-sm);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .left-panel {
    transform: translateX(-100%);
  }
  
  .left-panel--mobile-visible {
    transform: translateX(0);
  }
  
  .main-wrapper {
    margin-left: 0;
    padding: 20px 15px;
  }
  
  .white-plate {
    padding: 20px;
    margin: 15px;
    border-radius: 12px;
  }
  
  .flex-center {
    padding: 20px 15px;
  }
  
  .card-body {
    padding: 20px 15px;
  }
  
  .btn-group {
    flex-direction: column;
    background: none;
    gap: 8px;
  }
  
  .btn-group .btn {
    border-radius: var(--border-radius-sm);
    box-shadow: var(--box-shadow-sm);
  }
  
  .admin-heading-1 {
    margin-bottom: 20px;
  }
}

/* Телефоны */
@media (max-width: 576px) {
  :root {
    --header-height: 52px;
  }
  
  .project-nav__links-wrapper {
    flex-direction: column;
    gap: 5px;
    align-items: center;
  }
  
  .project-nav a {
    width: 100%;
    text-align: center;
    padding: 10px;
  }
  
  .white-plate {
    padding: 20px 15px;
    margin: 10px;
    border-radius: 10px;
  }
  
  .main-wrapper {
    padding: 15px 10px;
  }
  
  .form-wrapper {
    padding: 15px 10px;
  }
  
  .card-header {
    padding: 15px;
  }
  
  .card-body {
    padding: 15px;
  }
  
  .btn {
    padding: 12px 20px;
    font-size: 15px;
    min-height: 48px;
  }
  
  .btn-lg {
    padding: 14px 24px;
    font-size: 16px;
    min-height: 52px;
  }
  
  .form-control,
  .custom-select {
    padding: 14px 12px;
    font-size: 16px; /* Предотвращает zoom в iOS */
  }
  
  .table th,
  .table td {
    padding: 12px 8px;
    font-size: 13px;
  }
  
  .left-panel__user {
    flex-direction: column;
    text-align: center;
  }
  
  .left-panel__user-photo {
    margin-right: 0;
    margin-bottom: 10px;
  }
  
  .admin-heading-1 {
    text-align: center;
  }
  
  .admin-heading-1::after {
    left: 50%;
    transform: translateX(-50%);
  }
  
  .text-right {
    text-align: center;
  }
}

/* Очень маленькие телефоны */
@media (max-width: 375px) {
  .white-plate {
    padding: 15px 12px;
    margin: 8px;
  }
  
  .main-wrapper {
    padding: 12px 8px;
  }
  
  .form-wrapper {
    padding: 12px 8px;
  }
  
  .btn {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 44px;
  }
  
  .card-header {
    padding: 12px 15px;
  }
  
  .card-body {
    padding: 12px;
  }
  
  .table th,
  .table td {
    padding: 10px 6px;
    font-size: 12px;
  }
}

/* Портретная ориентация */
@media (max-height: 600px) and (orientation: portrait) {
  .white-plate {
    margin: 10px auto;
    padding: 20px;
  }
  
  .flex-center {
    padding: 15px 10px;
    align-items: flex-start;
  }
  
  .left-panel {
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height));
  }
}

/* Ландшафтная ориентация для мобильных */
@media (max-height: 500px) and (orientation: landscape) {
  .with-nav {
    padding-top: var(--header-height);
  }
  
  .flex-center {
    padding: 10px;
    align-items: flex-start;
  }
  
  .white-plate {
    margin: 10px auto;
    max-height: calc(100vh - var(--header-height) - 20px);
    overflow-y: auto;
  }
}

/* Утилитарные классы */
.clearfix::after {
  content: "";
  clear: both;
  display: table;
}

.d-flex {
  display: flex;
}

.justify-content-center {
  justify-content: center;
}

.align-items-center {
  align-items: center;
}

/* Анимации */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.white-plate,
.card {
  animation: fadeIn 0.4s ease-out;
}

.left-panel--mobile-visible {
  animation: slideIn 0.3s ease-out;
}

/* Улучшения для доступности */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Высококонтрастный режим */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0044cc;
    --primary-dark: #002266;
  }
  
  .btn-primary {
    background: var(--primary-dark);
  }
}

/* Темный режим */
@media (prefers-color-scheme: dark) {
  .white-plate,
  .card,
  .table {
    background: #2d3748;
    color: #e2e8f0;
  }
  
  .form-control,
  .custom-select {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
  }
  
  .table th {
    background: #4a5568;
    color: #e2e8f0;
  }
}