/* Admin Panel Styles */

/* Стили для административной панели */
.admin-panel {
  padding: 40px 0;
  min-height: 100vh;
}

.admin-panel .container {
  max-width: 1170px;
  margin: 0 auto;
  padding: 0 15px;
}

.admin-panel h1 {
  margin-bottom: 40px;
}

.admin-actions {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.form-section {
  background: #f9f9f9;
  border-radius: 8px;
  margin: 40px 0;
  overflow: hidden;
}

.form-section .form {
  padding: 0;
}

.form-section .form .container {
  padding: 0;
}

.form-section .form-content {
  max-width: 100%;
  margin-right: 0;
  padding: 40px;
}

.form-section h2 {
  font-size: 36px;
  line-height: 44px;
  margin-bottom: 40px;
  color: #333;
}

.form-section .form-details {
  max-width: 100%;
  margin-top: 0;
}

.form-section .form-group {
  position: relative;
  border: 1px solid #C1BBBB;
  background: #FFF;
  padding: 12px 23px 13px 23px;
  width: 100%;
  height: 74px;
  box-sizing: border-box;
  transition: .2s ease all;
  margin-bottom: 20px;
}

.form-section .form-input {
  width: 100%;
  height: 100%;
  padding: 0;
  outline: 0;
  border: 0;
  font-family: 'Museo Sans Cyrl Bold', sans-serif;
  font-size: 18px;
  line-height: 22px;
  color: #00b0f0;
  background: transparent;
}

.form-section .form-lable {
  color: #333;
  font-size: 18px;
  line-height: 22px;
  position: absolute;
  left: 23px;
  top: 26px;
  transition: .2s ease all;
  pointer-events: none;
}

.form-section .form-input:focus~.form-lable,
.form-section .form-input:not(:focus):valid~.form-lable {
  top: 12px;
  font-size: 14px;
}

.form-section .form-input:valid,
.form-section .form-input:focus {
  margin-top: 27px;
  height: auto;
}

.form-section textarea.form-input {
  resize: vertical;
  min-height: 120px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.form-section .form-group:focus-within {
  border-left: 5px solid #00b0f0;
}

.form-section .password-input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.form-section .password-input-group .form-input {
  flex: 1;
  position: relative;
}

.form-section .password-input-group .btn-secondary {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s;
}

.form-section .password-input-group .btn-secondary:first-of-type {
  right: 36px;
}

.form-section .password-input-group .btn-secondary:last-of-type {
  right: 0;
}

.form-section .form-group:focus-within .password-input-group .btn-secondary,
.form-section .form-input:not(:focus):valid ~ .btn-secondary {
  opacity: 1;
}

.form-section .password-input-group .form-lable {
  position: absolute;
  left: 0;
  top: 26px;
  transition: .2s ease all;
  pointer-events: none;
  z-index: 1;
}

.form-section .password-input-group .form-input:focus ~ .form-lable,
.form-section .password-input-group .form-input:not(:focus):valid ~ .form-lable {
  top: 12px;
  font-size: 14px;
}

.form-section .password-input-group .btn-secondary {
  padding: 6px 8px;
  min-width: 32px;
  font-size: 12px;
}

.form-section .form-button {
  margin-top: 40px;
  text-align: center;
}

.stats-section h2 {
  margin-bottom: 30px;
}

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

.stat-card {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 176, 240, 0.1);
}

.stat-card h3 {
  font-size: 18px;
  margin-bottom: 15px;
  color: #333;
}

.role-stats {
  text-align: left;
  margin-top: 15px;
}

.role-stats div {
  margin: 8px 0;
  font-size: 14px;
  color: #666;
}

/* Стили для секций управления */
.organizations-section, .streams-section, .intermediate-tests-section, .tests-submenu {
  margin-top: 40px;
}

.organizations-header, .streams-header, .tests-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.organizations-list, .streams-list, .tests-list {
  display: grid;
  gap: 16px;
}

.test-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  transition: box-shadow 0.3s ease;
}

.test-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.test-card h3 {
  margin: 0 0 12px 0;
  color: #333;
}

.test-card p {
  margin: 6px 0;
  color: #666;
}

.test-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Стили для подменю тестов */
.tests-submenu-header {
  text-align: center;
  margin-bottom: 30px;
}

.tests-submenu-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.tests-submenu-buttons .btn {
  min-width: 200px;
  position: relative;
}

.btn-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.development-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff6b6b;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Стили для визуального редактора вопросов */
.questions-editor {
  margin-top: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  background: #fafafa;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.editor-header h3 {
  margin: 0;
  color: #333;
}

.questions-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-editor-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  position: relative;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.question-number {
  font-weight: bold;
  color: #00b0f0;
  margin-right: 10px;
}

.question-text-input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 16px;
  margin-bottom: 15px;
  width: 100%;
}

.question-text-input:focus {
  outline: none;
  border-color: #00b0f0;
  box-shadow: 0 0 0 2px rgba(0, 176, 240, 0.2);
}

.options-container {
  margin-bottom: 15px;
}

.option-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.option-input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 14px;
  margin-right: 10px;
}

.option-input:focus {
  outline: none;
  border-color: #00b0f0;
  box-shadow: 0 0 0 2px rgba(0, 176, 240, 0.2);
}

.correct-answer-radio {
  margin-right: 10px;
}

.question-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
}

.btn-danger-small {
  background: #dc3545;
  color: white;
  border: 1px solid #dc3545;
}

.btn-danger-small:hover {
  background: #c82333;
}

.btn-success-small {
  background: #28a745;
  color: white;
  border: 1px solid #28a745;
}

.btn-success-small:hover {
  background: #218838;
}

.no-questions {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 40px 20px;
  background: white;
  border: 2px dashed #ddd;
  border-radius: 8px;
  margin: 20px 0;
}

/* Стили для модального окна подтверждения */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 20px 0 20px;
  border-bottom: 1px solid #eee;
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
}

.modal-body {
  padding: 0 20px;
  margin-bottom: 20px;
}

.modal-body p {
  margin: 0;
  color: #666;
  line-height: 1.5;
}

.modal-footer {
  padding: 0 20px 20px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}

/* Адаптивность для модального окна */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-header, .modal-body {
    padding: 16px;
  }

  .user-card {
    padding: 12px;
  }
}

/* Стили для вкладок в модальном окне добавления пользователя */
.add-user-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid #dee2e6;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: #6c757d;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.tab-btn.active {
  color: #00b0f0;
  border-bottom-color: #00b0f0;
}

.tab-btn:hover {
  color: #00b0f0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Стили для результатов поиска пользователей */
.search-results {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-top: 10px;
}

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f8f9fa;
  transition: background-color 0.2s ease;
}

.search-result-item:hover {
  background-color: #f8f9fa;
}

.search-result-item.selected {
  background-color: #e3f2fd;
  border-left: 4px solid #00b0f0;
}

.search-result-item.already-in-stream {
  background-color: #f8f9fa;
  opacity: 0.7;
}

.search-result-item.already-in-stream .btn-disabled {
  background: #6c757d;
  color: white;
  cursor: not-allowed;
  opacity: 0.6;
}

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

.user-info h4 {
  margin: 0 0 4px 0;
  color: #333;
  font-size: 16px;
}

.user-info p {
  margin: 2px 0;
  font-size: 13px;
  color: #666;
}

/* Стили для кнопки действия в модальном окне */
.modal-actions {
  margin-bottom: 20px;
  text-align: center;
}

/* Стили для кнопки "Добавить" в результатах поиска */
.search-result-item .btn {
  padding: 6px 12px;
  font-size: 12px;
  min-width: 80px;
}

/* Стили для удаленных вопросов в визуальном редакторе */
.question-editor-card.deleted {
  opacity: 0.5;
  background-color: #f8f8f8;
  border-color: #ccc;
  position: relative;
}

.question-editor-card.deleted::before {
  content: "Будет удален при сохранении";
  position: absolute;
  top: 10px;
  right: 10px;
  background: #dc3545;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  z-index: 1;
}

.question-editor-card.deleted .question-text-input,
.question-editor-card.deleted .option-input,
.question-editor-card.deleted .correct-answer-radio {
  pointer-events: none;
  opacity: 0.7;
}

.deleted-questions-notice {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  padding: 12px 16px;
  margin-top: 20px;
  color: #856404;
}

.deleted-questions-notice p {
  margin: 0;
  font-size: 14px;
}

/* Responsive design для админ-панели */
@media (max-width: 1100px) {
  .form-section .form-content {
    padding: 30px 20px;
  }

  .form-section h2 {
    font-size: 32px;
    line-height: 40px;
  }
}

@media (max-width: 850px) {
  .form-section .form-group {
    width: 100%;
  }
}

@media (max-width: 770px) {
  .admin-panel {
    padding: 20px 0;
  }

  .admin-panel .container {
    padding: 0 10px;
  }

  .admin-panel h1 {
    font-size: 36px;
    line-height: 44px;
    margin-bottom: 30px;
  }

  .admin-actions {
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
  }

  .tests-submenu-buttons {
    flex-direction: column;
    align-items: center;
  }

  .tests-submenu-buttons .btn {
    min-width: 250px;
  }

  .questions-editor {
    padding: 15px;
  }

  .question-editor-card {
    padding: 15px;
  }

  .question-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .option-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .option-input {
    width: 100%;
    margin-right: 0;
  }

  .question-actions {
    flex-direction: column;
  }

  .question-actions .btn {
    width: 100%;
  }

  .form-section .form-content {
    padding: 20px 15px;
  }

  .form-section h2 {
    font-size: 28px;
    line-height: 36px;
    margin-bottom: 30px;
  }

  .form-section .form-group {
    height: 60px;
    padding: 10px 18px;
  }

  .form-section .form-lable {
    font-size: 16px;
    left: 18px;
    top: 22px;
  }

  .form-section .form-input:focus~.form-lable,
  .form-section .form-input:not(:focus):valid~.form-lable {
    top: 8px;
    font-size: 12px;
  }

  .form-section .password-input-group .btn-secondary {
    right: 0;
  }

  .form-section .password-input-group .btn-secondary:first-of-type {
    right: 32px;
  }

  .form-section .password-input-group .btn-secondary:last-of-type {
    right: 0;
  }

  .stats-overview {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .stat-card {
    padding: 15px;
  }
}

@media (max-width: 600px) {
  .admin-panel {
    padding: 15px 0;
  }

  .form-section .form-content {
    padding: 15px 10px;
  }

  .form-section h2 {
    font-size: 24px;
    line-height: 32px;
  }

  .form-section .form-group {
    height: 55px;
    padding: 8px 15px;
  }

  .form-section .form-lable {
    font-size: 14px;
    left: 15px;
    top: 18px;
  }

  .form-section .password-input-group .btn-secondary {
    right: 0;
  }

  .form-section .password-input-group .btn-secondary:first-of-type {
    right: 30px;
  }

  .form-section .password-input-group .btn-secondary:last-of-type {
    right: 0;
  }

  .form-section .password-input-group .btn-secondary {
    padding: 4px 6px;
    min-width: 28px;
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .admin-panel {
    padding: 10px 0;
  }

  .admin-panel .container {
    padding: 0 5px;
  }

  .admin-panel h1 {
    font-size: 28px;
    line-height: 36px;
    margin-bottom: 20px;
  }

  .admin-actions {
    gap: 10px;
    margin-bottom: 20px;
  }

  .admin-actions .btn {
    padding: 12px 20px;
    font-size: 14px;
  }

  .form-section .form-content {
    padding: 10px 8px;
  }

  .form-section h2 {
    font-size: 20px;
    line-height: 28px;
    margin-bottom: 20px;
  }

  .form-section .form-group {
    height: 50px;
    padding: 6px 12px;
  }

  .form-section .form-lable {
    font-size: 12px;
    left: 12px;
    top: 16px;
  }

  .form-section .form-input:focus~.form-lable,
  .form-section .form-input:not(:focus):valid~.form-lable {
    top: 6px;
    font-size: 10px;
  }

  .form-section .form-input {
    font-size: 16px; /* Предотвращает зум на iOS */
  }

  .form-section .password-input-group .btn-secondary {
    right: 0;
  }

  .form-section .password-input-group .btn-secondary:first-of-type {
    right: 26px;
  }

  .form-section .password-input-group .btn-secondary:last-of-type {
    right: 0;
  }

  .form-section .password-input-group .btn-secondary {
    padding: 3px 4px;
    min-width: 24px;
    font-size: 8px;
  }

  .form-section .form-button .btn {
    width: 100%;
    padding: 12px;
  }

  .stats-section h2 {
    font-size: 24px;
    line-height: 32px;
    margin-bottom: 20px;
  }

  .stats-overview {
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card h3 {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .stat-value {
    font-size: 20px;
  }

  .role-stats div {
    font-size: 12px;
    margin: 6px 0;
  }
}

@media (max-width: 320px) {
  .admin-panel h1 {
    font-size: 24px;
    line-height: 32px;
  }

  .form-section h2 {
    font-size: 18px;
    line-height: 26px;
  }

  .form-section .form-group {
    height: 45px;
    padding: 4px 10px;
  }

  .form-section .form-lable {
    left: 10px;
    top: 14px;
  }

  .form-section .password-input-group {
    right: 10px;
  }

  .stats-section h2 {
    font-size: 20px;
    line-height: 28px;
  }

  .stat-card h3 {
    font-size: 14px;
  }

  .stat-value {
    font-size: 18px;
  }
}