/* ========================================
   АУДИТ ФИЛИАЛА — ИЗОЛИРОВАННЫЕ СТИЛИ
   Все селекторы начинаются с #audit-form
   ======================================== */

* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  margin: 0;
  padding: 20px;
}

/* ========================================
   КОНТЕЙНЕР ФОРМЫ
   ======================================== */

#audit-form {
  max-width: 700px;
  margin: 0 auto;
  font-family: Arial, sans-serif;
  color: #ffffff;
  padding: 20px;
}

#audit-form * {
  box-sizing: border-box;
}

/* ========================================
   ШАГИ (СТРАНИЦЫ)
   ======================================== */

#audit-form .step {
  display: none;
}

#audit-form .step.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   ЗАГОЛОВКИ
   ======================================== */

#audit-form h2 {
  margin-bottom: 20px;
  font-size: 24px;
  font-weight: 700;
  color: #ffd700;
}

#audit-form h3 {
  margin: 24px 0 12px 0;
  font-size: 18px;
  font-weight: 600;
  color: #ffd700;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

/* ========================================
   ПОЛЯ ВВОДА
   ======================================== */

#audit-form input[type="text"],
#audit-form input[type="tel"],
#audit-form textarea {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transition:
    border-color 0.3s,
    background-color 0.3s;
  font-family: inherit;
}

#audit-form textarea {
  min-height: 100px;
  resize: vertical;
}

#audit-form input[type="text"]::placeholder,
#audit-form input[type="tel"]::placeholder,
#audit-form textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

#audit-form input[type="text"]:focus,
#audit-form input[type="tel"]:focus,
#audit-form textarea:focus {
  border-color: #ffd700;
  background-color: rgba(255, 255, 255, 0.15);
  outline: none;
}

#audit-form input.invalid,
#audit-form textarea.invalid {
  border-color: #ff6b6b;
  background-color: rgba(255, 107, 107, 0.1);
}

#audit-form input[readonly] {
  background-color: rgba(255, 255, 255, 0.05);
  cursor: default;
}

/* ========================================
   ГРУППА ПОЛЕЙ
   ======================================== */

#audit-form .field-group {
  margin-bottom: 20px;
}

#audit-form .field-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
}

#audit-form .field-group .required {
  color: #ffd700;
}

/* ========================================
   КНОПКИ
   ======================================== */

#audit-form button {
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd700 0%, #ff9800 100%);
  background-size: 200% 200%;
  background-position: 0% 50%;
  color: #1a1a2e;
  box-shadow: 0 8px 28px rgba(255, 170, 60, 0.2);
  transition:
    background-position 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s,
    border-color 0.3s,
    transform 0.2s;
  width: 100%;
  margin-top: 10px;
}

#audit-form button:hover:not(:disabled) {
  background-position: 100% 50%;
  border-color: #ffffff;
  box-shadow: 0 14px 40px rgba(255, 170, 60, 0.35);
  transform: translateY(-2px);
}

#audit-form button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 6px 20px rgba(255, 170, 60, 0.25);
}

#audit-form button:disabled {
  background: linear-gradient(135deg, #666666 0%, #444444 100%);
  color: #999999;
  cursor: not-allowed;
  box-shadow: none;
}

/* Кнопка "Назад" — прозрачная */
#audit-form .btn-back {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 10px 20px;
  font-size: 14px;
  margin-bottom: 16px;
  width: auto;
}

#audit-form .btn-back:hover:not(:disabled) {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
  border-color: #ffffff;
}

/* Вторичная кнопка */
#audit-form .btn-secondary {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

#audit-form .btn-secondary:hover:not(:disabled) {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.15) 100%
  );
  border-color: #ffffff;
}

/* Основная кнопка (зелёная) */
#audit-form .btn-primary {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  box-shadow: 0 8px 28px rgba(34, 197, 94, 0.2);
}

#audit-form .btn-primary:hover:not(:disabled) {
  box-shadow: 0 14px 40px rgba(34, 197, 94, 0.35);
}

/* ========================================
   СПИСОК (ФИЛИАЛЫ, ПОМЕЩЕНИЯ)
   ======================================== */

#audit-form .list-scroll {
  max-height: 250px;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  list-style: none;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

#audit-form .list-scroll li {
  padding: 14px 18px;
  cursor: pointer;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  transition:
    background 0.3s,
    padding-left 0.3s,
    color 0.3s;
}

#audit-form .list-scroll li:last-child {
  border-bottom: none;
}

#audit-form .list-scroll li:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.3) 0%,
    rgba(255, 152, 0, 0.3) 100%
  );
  padding-left: 24px;
}

#audit-form .list-scroll li.selected {
  background: linear-gradient(135deg, #ffd700 0%, #ff9800 100%);
  color: #1a1a2e;
  padding-left: 24px;
}

/* Скроллбар */
#audit-form .list-scroll::-webkit-scrollbar {
  width: 8px;
}

#audit-form .list-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

#audit-form .list-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #ffd700 0%, #ff9800 100%);
  border-radius: 4px;
}

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

#audit-form .selected-info {
  padding: 16px 20px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.1) 0%,
    rgba(255, 152, 0, 0.1) 100%
  );
  border: 2px solid rgba(255, 215, 0, 0.2);
}

#audit-form .selected-info div {
  margin-bottom: 8px;
  font-size: 14px;
}

#audit-form .selected-info div:last-child {
  margin-bottom: 0;
}

#audit-form .selected-info strong {
  color: #ffd700;
}

/* ========================================
   БЛОКИ АУДИТА (ЧЕК-ЛИСТЫ)
   ======================================== */

#audit-form .audit-block {
  margin-bottom: 24px;
  padding: 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

#audit-form .audit-block h3 {
  margin: 0 0 16px 0;
  padding-bottom: 10px;
}

#audit-form .checkbox-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.2s;
}

#audit-form .checkbox-item:last-child {
  border-bottom: none;
}

#audit-form .checkbox-item:hover {
  background: rgba(255, 255, 255, 0.05);
  margin: 0 -10px;
  padding-left: 10px;
  padding-right: 10px;
  border-radius: 8px;
}

#audit-form .checkbox-item input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  margin-right: 14px;
  cursor: pointer;
  accent-color: #4ade80;
  border-radius: 6px;
}

#audit-form .checkbox-item label {
  cursor: pointer;
  font-size: 15px;
  color: #ffffff;
  flex: 1;
}

#audit-form .checkbox-item.checked label {
  color: #4ade80;
}

#audit-form .checkbox-item.unchecked label {
  color: rgba(255, 255, 255, 0.7);
}

/* ========================================
   СООБЩЕНИЯ О ВАЛИДАЦИИ
   ======================================== */

#audit-form .validation-message {
  margin-top: 12px;
  padding: 12px 16px;
  color: #ff6b6b;
  font-size: 14px;
  border-radius: 12px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  display: none;
}

#audit-form .validation-message.visible {
  display: block;
}

/* ========================================
   ЗАГРУЗКА
   ======================================== */

#audit-form .loading {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}

#audit-form .loading::after {
  content: "";
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%,
  20% {
    content: "";
  }
  40% {
    content: ".";
  }
  60% {
    content: "..";
  }
  80%,
  100% {
    content: "...";
  }
}

/* ========================================
   КНОПКИ ВЫБОРА (СТРАНИЦА 4)
   ======================================== */

#audit-form .choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

#audit-form .audited-rooms-list {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  margin-top: 16px;
}

#audit-form .audited-room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#audit-form .audited-room-item:last-child {
  border-bottom: none;
}

#audit-form .audited-room-item .room-name {
  font-weight: 600;
  color: #ffd700;
}

#audit-form .audited-room-item .room-stats {
  font-size: 14px;
}

#audit-form .audited-room-item .room-stats .checked {
  color: #4ade80;
}

#audit-form .audited-room-item .room-stats .unchecked {
  color: #ff6b6b;
}

/* ========================================
   СТРАНИЦА 6: Статус загрузки
   ======================================== */

.upload-status {
  margin: 20px 0;
  padding: 15px 20px;
  border-radius: 10px;
  text-align: center;
}

.upload-status.success {
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.upload-status.warning {
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.upload-success,
.upload-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.upload-success {
  color: #4ade80;
}

.upload-warning {
  color: #ffc107;
}

.status-icon {
  font-size: 1.5em;
}

.download-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}

.download-buttons .btn-primary {
  font-size: 1.1em;
  padding: 15px 30px;
}

/* ========================================
   СООБЩЕНИЕ ОБ УСПЕХЕ
   ======================================== */

#audit-form .success-message {
  text-align: center;
  padding: 40px 20px;
}

#audit-form .success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #1a1a2e;
}

#audit-form .success-message p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
}

/* ========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ======================================== */

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  #audit-form {
    padding: 12px;
  }

  #audit-form h2 {
    font-size: 20px;
  }

  #audit-form .audit-block {
    padding: 14px;
  }

  #audit-form .checkbox-item {
    padding: 10px 0;
  }

  #audit-form .checkbox-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
  }
}

/* ========================================
   ПОДДЕРЖКА НАЖАТИЯ НА МОБИЛЬНЫХ
   ======================================== */

@media (hover: none) {
  #audit-form button:active:not(:disabled) {
    background-position: 100% 50%;
    border-color: #ffffff;
    box-shadow: 0 14px 40px rgba(255, 170, 60, 0.35);
  }

  #audit-form .btn-primary:active:not(:disabled) {
    box-shadow: 0 14px 40px rgba(34, 197, 94, 0.35);
  }

  #audit-form .list-scroll li:active {
    background: linear-gradient(135deg, #ffd700 0%, #ff9800 100%);
    color: #1a1a2e;
  }
}

/* ========================================
   ФОТОГРАФИИ В АУДИТЕ
   ======================================== */

.photos-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 15px;
  min-height: 20px;
}

.photo-preview {
  position: relative;
  width: calc(50% - 6px);
  max-width: 150px;
  aspect-ratio: 4/3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
}

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

.photo-preview .photo-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 107, 107, 0.9);
  border: none;
  color: white;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}

.photo-preview .photo-delete:hover {
  background: #ff4444;
  transform: scale(1.1);
}

.photo-preview .photo-number {
  position: absolute;
  bottom: 5px;
  left: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.photo-actions {
  margin-top: 10px;
}

.btn-add-photo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-add-photo:hover {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
}

.btn-add-photo.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.photo-btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
}

.photo-btn-text {
  color: var(--text-secondary);
  font-size: 14px;
}

.photos-count {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Адаптив для мобильных */
@media (max-width: 480px) {
  .photo-preview {
    width: calc(50% - 6px);
  }
  
  .btn-add-photo {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================
   ЭКРАН ВВОДА PIN-КОДА
   ======================================== */

#pin-step {
  text-align: center;
  max-width: 350px;
  margin: 40px auto;
}

.pin-container {
  margin: 20px 0;
}

#pin-input {
  width: 100%;
  max-width: 200px;
  padding: 15px;
  font-size: 2.5em;
  text-align: center;
  letter-spacing: 0.5em;
  border: 2px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.3s;
}

#pin-input:focus {
  border-color: var(--accent-primary);
}

#pin-error {
  min-height: 20px;
  margin-top: -10px;
  margin-bottom: 15px;
}
