/* ========================================
   FORMS COMPONENT
   ======================================== */

/* ---------- БАЗОВЫЕ СТИЛИ ФОРМ ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
}

.form--login {
  animation: fadeIn 0.5s ease-out 0.3s backwards;
}

/* ===== ГРУППЫ ФОРМ ===== */
.create-topic__form {
  display: grid;
  gap: 20px;
}

.form__group {
  display: grid;
  gap: 5px;
  position: relative;
}

/* ===== ЛЕЙБЛЫ ===== */
.form__label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
  color: white;
  font-size: 1rem;
  cursor: pointer;

}

.form__label i,
.form__label-icon {
  color: #667eea;
  font-size: 0.9em;
  width: 16px;
  text-align: center;
}

/* ===== ОБЕРТКА ДЛЯ ИНПУТОВ ===== */
.form__control {
  position: relative;
  margin-bottom: 8px;
}

/* ===== ИНПУТЫ ===== */
.form__input {
  width: 100%;
  padding: 16px 52px 16px 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.form__select,
.form__textarea {
  width: 100%;
  padding: 16px 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.form__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  cursor: pointer;
}

.form__select option {
  background: var(--color-bg-primary);
  color: var(--color-text-white);
}

.form__textarea {
  min-height: 140px;
  resize: vertical;
}

.form__input--register {
  padding: 14px 52px 14px 14px;
  margin-bottom: 12px;
}

.form__input::placeholder,
.form__textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-size: 15px;
  line-height: 1;
  font-weight: 400;
}

.form__input:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.09);
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form__input--error,
.form__textarea--error,
.form__select--error {
  border-color: #ff4757;
  background: rgba(255, 71, 87, 0.05);
}

.form__input--error:focus,
.form__textarea--error:focus,
.form__select--error:focus {
  box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.1);
}

/* ===== ИКОНКИ В ИНПУТАХ ===== */
.form__icon {
  position: absolute;
  top: 50%;
  left: 21px;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.1rem;
  pointer-events: none;
  transition: color 0.3s ease;
}

.form__input:focus+.form__icon {
  color: #667eea;
}

/* ========================================
   НАТИВНЫЙ SELECT (для жалоб и форм)
   ======================================== */

.filters__select {
  width: 100%;
  padding: 14px 40px 14px 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.4;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filters__select:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
}

.filters__select:focus {
  outline: none;
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.filters__select option {
  background: #1a1a2e;
  color: #ffffff;
  padding: 12px;
}

/* Убираем стандартную стрелку в IE */
.filters__select::-ms-expand {
  display: none;
}

/* ===== УНИВЕРСАЛЬНЫЕ СТИЛИ ДЛЯ ВСЕХ SELECT ===== */
select:not([multiple]) {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
}

select:not([multiple]):hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.09);
}

select:not([multiple]):focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* ===== КНОПКА ПЕРЕКЛЮЧЕНИЯ ПАРОЛЯ ===== */
.form__toggle-password {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px;
  font-size: 1.1rem;
  transition: color 0.3s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form__toggle-password:hover {
  color: #667eea;
}

.form__toggle-password:focus {
  outline: none;
  color: #667eea;
}

.form__toggle-password:active {
  transform: translateY(-50%) scale(0.95);
}

/* ===== ГРУППЫ ===== */
.form__row {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
}

.form__actions {
  display: flex;
  gap: 15px;
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.form__actions .btn {
  flex: 1;
}

/* ===== ОШИБКИ ===== */
.form__error {
  font-size: 0.85rem;
  color: #ff4757;
  min-height: 20px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.form__error:not(:empty) {
  opacity: 1;
  transform: translateY(0);
}

/* ===== ОПЦИИ ФОРМЫ ===== */
.form__options {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===== ЧЕКБОКС ===== */
.checkbox {
  display: flex;
  align-items: center;
  /* justify-content: center; */
  gap: 10px;
  cursor: pointer;
  user-select: none;
  color: #b0b0b0;
  font-size: 0.95rem;
  line-height: 1;
  transition: all 0.3s ease;
}

.checkbox:hover {
  color: white;
}

.checkbox__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.checkbox__input:focus-visible+.checkbox__box {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

.checkbox__box {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  justify-content: center;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
}

.checkbox__icon {
  color: white;
  font-size: 0.8rem;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.checkbox__input:checked+.checkbox__box {
  border-color: #667eea;
  background: #667eea;
}

.checkbox__input:checked+.checkbox__box .checkbox__icon {
  opacity: 1;
  transform: scale(1);
}

.checkbox__text {
  line-height: 1;
}

/* ===== ССЫЛКИ ===== */
.form__link {
  color: #667eea;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1;
  transition: all 0.3s ease;
}

.form__link:hover {
  color: #f093fb;
}

.form__link:active {
  color: #9e46a8;
  transform: scale(0.98);
}

.form__link:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 3px;
  border-radius: 2px;
}

/* ===== РАЗДЕЛИТЕЛЬ ===== */
.form__divider {
  position: relative;
  text-align: center;
}

.form__divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.1) 50%,
      transparent 100%);
}

.form__divider-text {
  position: relative;
  display: inline-block;
  padding: 0 15px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ===== СОЦИАЛЬНАЯ АВТОРИЗАЦИЯ ===== */
.auth__social {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
}

/* ===== СООБЩЕНИЯ ФОРМЫ ===== */
.form__message {
  display: none;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.form__message--error {
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.2);
  color: #ff6b81;
}

.form__message--success {
  background: rgba(46, 213, 115, 0.1);
  border: 1px solid rgba(46, 213, 115, 0.2);
  color: #2ed573;
}

.form__message:not(:empty) {
  display: block;
  padding: 15px;
  margin-bottom: 20px;
}

.form__message.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ===== ПОДСКАЗКИ ===== */
.form__hint {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* ===== СЧЁТЧИК СИМВОЛОВ ===== */
.char-counter {
  text-align: right;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 5px;
}

/* ===== Убираем подсветку автозаполнения ===== */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px rgba(255, 255, 255, 0.05) inset !important;
  -webkit-text-fill-color: #ffffff !important;
  transition: background-color 5000s ease-in-out 0s;
}

input:-moz-autofill {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
}

/* ===== ИЗБРАННОЕ ДЛЯ ПОСТОВ ===== */
.post__favorite.active {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.post__favorite.active i {
  color: #ffd700;
}

.post__favorite.active i.fa-bookmark {
  font-weight: 900;
}

/* Активный лайк */
.post__like.liked {
  color: #ff4757;
  background: rgba(255, 71, 87, 0.1);
}

.post__like.liked i {
  color: #ff4757;
}

/* Активное избранное */
.post__favorite.active {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.post__favorite.active i {
  color: #ffd700;
}

/* ===== СТИЛИ ДЛЯ ГРУППИРОВКИ OPTGROUP ===== */
optgroup {
  font-weight: 600;
  color: #667eea;
  background: #1a1a2e;
  padding: 8px 0;
}

optgroup option {
  padding-left: 32px;
  font-weight: 400;
  color: #b0b0b0;
  background: #1a1a2e;
}

optgroup option:hover {
  background: rgba(102, 126, 234, 0.2);
}

/* Скрываем пустые блоки ошибок */
.form__error {
  display: none;
  color: #ff4757;
  font-size: 0.85rem;
  margin-top: 5px;
  align-items: center;
  gap: 5px;
}

/* Показываем только когда есть текст */
.form__error:not(:empty) {
  display: flex;
}

.form__error::before {
  content: "⚠️";
  font-size: 0.9rem;
}

/* Также для общих контейнеров ошибок */
.form__message--error,
.form__message--success {
  display: none;
}

.form__message--error:not(:empty),
.form__message--success:not(:empty) {
  display: block;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
  .form__input {
    padding: 14px 48px 14px 16px;
  }

  .form__options {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .auth__social {
    flex-direction: column;
  }

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

@media (max-width: 576px) {
  .form__input {
    padding: 12px 44px 12px 14px;
    font-size: 0.95rem;
  }

  .form__toggle-password {
    right: 14px;
  }

  .form__actions {
    flex-direction: column;
  }
}
