/* ==========================================
   ОСНОВНЫЕ ПЕРЕМЕННЫЕ
========================================== */

.custom-converter {
  --cf-primary: #6574ec;
  --cf-primary-dark: #4f5fd7;
  --cf-primary-light: #eef1ff;
  --cf-accent: #53d9c1;

  --cf-text: #252a44;
  --cf-muted: #697089;
  --cf-border: #dfe3f4;
  --cf-background: #ffffff;
  --cf-soft-background: #f7f8ff;

  --cf-success: #15945f;
  --cf-danger: #d64545;

  font-family: "Inter", Arial, sans-serif;
  color: var(--cf-text);
  background: var(--cf-background);

  width: calc(100% - 24px);
  max-width: 560px;
  margin: 48px auto;
  padding: 30px;

  border: 1px solid rgba(101, 116, 236, 0.1);
  border-radius: 22px;

  box-shadow:
    0 4px 12px rgba(31, 40, 90, 0.04),
    0 18px 50px rgba(75, 88, 170, 0.08);
}

.custom-converter,
.custom-converter *,
.custom-converter *::before,
.custom-converter *::after {
  box-sizing: border-box;
}


/* ==========================================
   КНОПКА ВЫБОРА ФАЙЛОВ
========================================== */

.nice-btn {
  display: block;
  width: fit-content;
  max-width: 100%;

  margin: 18px auto 0;
  padding: 11px 22px;

  border: 1px solid #dce2fa;
  border-radius: 12px;

  background: #f5f7ff;
  color: var(--cf-primary);

  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;

  cursor: pointer;

  box-shadow: 0 3px 10px rgba(101, 116, 236, 0.05);

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.nice-btn input[type="file"] {
  display: none;
}

.nice-btn:hover {
  color: var(--cf-primary-dark);
  background: #edf1ff;
  border-color: #cbd3fa;
  box-shadow: 0 6px 16px rgba(101, 116, 236, 0.1);
  transform: translateY(-1px);
}

.nice-btn:active {
  transform: translateY(0);
}

.nice-btn:focus-visible {
  outline: 3px solid rgba(101, 116, 236, 0.22);
  outline-offset: 3px;
}


/* ==========================================
   КНОПКА КОНВЕРТАЦИИ
========================================== */

.convert-btn {
  display: block;

  width: 100%;
  max-width: 360px;

  margin: 24px auto 0;
  padding: 16px 26px;

  border: 0;
  border-radius: 14px;

  background: linear-gradient(
    135deg,
    var(--cf-primary),
    #7985f3
  );

  color: #ffffff;

  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;

  cursor: pointer;

  box-shadow:
    0 8px 20px rgba(101, 116, 236, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease,
    opacity 0.2s ease;
}

.convert-btn:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-2px);

  box-shadow:
    0 12px 25px rgba(101, 116, 236, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.convert-btn:active:not(:disabled) {
  transform: translateY(0);
}

.convert-btn:focus-visible {
  outline: 3px solid rgba(101, 116, 236, 0.25);
  outline-offset: 4px;
}

.convert-btn:disabled {
  background: #c8ccdc;
  color: #f8f8fb;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.8;
}


/* ==========================================
   ФАЙЛЫ И ПОДПИСИ
========================================== */

.nice-file {
  margin-bottom: 18px;
}

#file-count {
  display: block;
  margin: 12px 0 0;

  color: var(--cf-muted);

  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
}


/* ==========================================
   ВЫБОР ФОРМАТА
========================================== */

#format-dropdown {
  position: relative;
  z-index: 30;
  margin: 8px 0 18px;
}

.cf-select {
  position: relative;
  width: 100%;
  user-select: none;
}

.cf-select-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  min-height: 52px;
  padding: 13px 15px;

  border: 1px solid var(--cf-border);
  border-radius: 13px;

  background: var(--cf-soft-background);
  color: var(--cf-text);

  font-size: 16px;
  font-weight: 600;

  cursor: pointer;

  box-shadow: 0 2px 7px rgba(42, 51, 100, 0.03);

  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.cf-select-selected:hover {
  border-color: #bdc6f2;
  background: #f3f5ff;
}

.cf-select.open .cf-select-selected {
  border-color: var(--cf-primary);
  background: #ffffff;

  box-shadow:
    0 0 0 4px rgba(101, 116, 236, 0.1),
    0 5px 15px rgba(43, 53, 120, 0.06);
}

.cf-select-selected::after {
  content: "";

  flex-shrink: 0;

  width: 9px;
  height: 9px;
  margin-left: auto;
  margin-right: 3px;

  border-right: 2px solid var(--cf-primary);
  border-bottom: 2px solid var(--cf-primary);

  transform: rotate(45deg) translateY(-2px);

  transition: transform 0.2s ease;
}

.cf-select.open .cf-select-selected::after {
  transform: rotate(225deg) translate(-2px, -2px);
}


/* ==========================================
   ВЫПАДАЮЩИЙ СПИСОК
========================================== */

.cf-select-dropdown {
  display: none;

  position: absolute;
  z-index: 100;

  top: calc(100% + 8px);
  left: 0;

  width: 100%;
  max-height: 300px;

  overflow-x: hidden;
  overflow-y: auto;

  border: 1px solid rgba(101, 116, 236, 0.14);
  border-radius: 14px;

  background: #ffffff;

  box-shadow:
    0 18px 50px rgba(37, 45, 100, 0.14),
    0 4px 12px rgba(37, 45, 100, 0.06);
}

.cf-select.open .cf-select-dropdown {
  display: block;
  animation: cf-dropdown-show 0.18s ease;
}

@keyframes cf-dropdown-show {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cf-select-dropdown::-webkit-scrollbar {
  width: 9px;
}

.cf-select-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.cf-select-dropdown::-webkit-scrollbar-thumb {
  background: #d7dcf5;
  border: 2px solid #ffffff;
  border-radius: 20px;
}

.cf-select-dropdown::-webkit-scrollbar-thumb:hover {
  background: #bcc5ee;
}


/* ==========================================
   ПОИСК ФОРМАТА
========================================== */

.search-input {
  display: block;
  position: sticky;
  z-index: 5;
  top: 0;

  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;

  border: 0;
  border-bottom: 1px solid #e5e8f5;
  border-radius: 14px 14px 0 0;
  outline: 0;

  background: rgba(248, 249, 255, 0.97);
  color: var(--cf-text);

  font-family: inherit;
  font-size: 15px;

  backdrop-filter: blur(8px);
}

.search-input::placeholder {
  color: #9197ac;
}

.search-input:focus {
  background: #ffffff;
  box-shadow: inset 0 -2px 0 var(--cf-primary);
}


/* ==========================================
   ГРУППЫ И ВАРИАНТЫ
========================================== */

.cf-group-label {
  padding: 10px 15px 6px;

  background: #f7f8fc;
  color: #7783aa;

  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cf-option {
  position: relative;

  display: flex;
  align-items: center;
  gap: 10px;

  min-height: 46px;
  padding: 11px 15px 11px 44px;

  border-bottom: 1px solid #f0f2f8;

  color: #343a56;

  font-size: 15px;
  font-weight: 500;

  cursor: pointer;

  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    padding-left 0.15s ease;
}

.cf-option:last-child {
  border-bottom: 0;
}

.cf-option:hover {
  padding-left: 47px;
  background: #f1f3ff;
  color: var(--cf-primary-dark);
}

.cf-option.active {
  background: var(--cf-primary-light);
  color: var(--cf-primary-dark);
  font-weight: 700;
}

.cf-option.active::after {
  content: "✓";

  position: absolute;
  right: 15px;

  color: var(--cf-primary);

  font-size: 14px;
  font-weight: 800;
}

.cf-option .file-icon {
  position: absolute;
  left: 16px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 20px;

  font-size: 17px;
  opacity: 0.82;
}


/* ==========================================
   ЗОНА ЗАГРУЗКИ
========================================== */

.drop-zone {
  position: relative;

  margin-bottom: 22px;
  padding: 42px 25px;

  overflow: hidden;

  border: 2px dashed #c8cff5;
  border-radius: 18px;

  background:
    radial-gradient(
      circle at top,
      rgba(101, 116, 236, 0.07),
      transparent 58%
    ),
    #fafaff;

  text-align: center;
  cursor: pointer;

  transition:
    border-color 0.25s ease,
    background-color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.25s ease;
}

.drop-zone::before {
  content: "";

  position: absolute;

  width: 130px;
  height: 130px;

  top: -80px;
  right: -50px;

  border-radius: 50%;

  background: rgba(101, 116, 236, 0.06);

  pointer-events: none;
}

.drop-zone:hover {
  border-color: #8d98f2;
  background-color: #f6f7ff;

  box-shadow:
    0 10px 28px rgba(101, 116, 236, 0.1),
    inset 0 0 0 1px rgba(101, 116, 236, 0.03);

  transform: translateY(-1px);
}

.drop-zone.dragover {
  border-color: var(--cf-primary);
  background: #eff1ff;

  box-shadow:
    0 0 0 5px rgba(101, 116, 236, 0.1),
    0 15px 35px rgba(101, 116, 236, 0.17);

  transform: scale(1.01);
}

.drop-zone input[type="file"] {
  position: absolute;
  z-index: 1;

  inset: 0;

  width: 100%;
  height: 100%;

  opacity: 0;
  cursor: pointer;
}

.drop-content {
  position: relative;
  z-index: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;

  pointer-events: none;
}

.drop-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 66px;
  height: 66px;
  margin-bottom: 3px;

  border-radius: 20px;

  background: linear-gradient(
    145deg,
    #eef0ff,
    #ffffff
  );

  color: var(--cf-primary);

  font-size: 39px;
  line-height: 1;

  box-shadow:
    0 8px 20px rgba(101, 116, 236, 0.12),
    inset 0 0 0 1px rgba(101, 116, 236, 0.1);

  user-select: none;

  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.drop-zone:hover .drop-icon {
  transform: translateY(-3px) scale(1.03);

  box-shadow:
    0 12px 25px rgba(101, 116, 236, 0.16),
    inset 0 0 0 1px rgba(101, 116, 236, 0.12);
}

.drop-text strong {
  display: block;

  color: #2f344d;

  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.drop-text span {
  color: var(--cf-muted);

  font-size: 13.5px;
  line-height: 1.55;
}

.drop-text a {
  color: var(--cf-primary);
  font-weight: 650;
  text-decoration: none;
}

.drop-text a:hover {
  color: var(--cf-primary-dark);
  text-decoration: underline;
}


/* ==========================================
   ОБЩИЙ ПРОГРЕСС
========================================== */

#progress-wrap {
  width: 100%;
  height: 12px;
  margin-top: 18px;

  overflow: hidden;

  border-radius: 999px;

  background: #edf0fa;

  box-shadow: inset 0 1px 3px rgba(40, 48, 90, 0.08);
}

#progress-bar {
  position: relative;

  width: 0;
  height: 100%;

  overflow: hidden;

  border-radius: inherit;

  background: linear-gradient(
    90deg,
    var(--cf-primary),
    #7587ef,
    var(--cf-accent)
  );

  box-shadow: 0 2px 8px rgba(101, 116, 236, 0.2);

  transition: width 0.35s ease;
}

#progress-bar::after {
  content: "";

  position: absolute;
  inset: 0;

  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(255, 255, 255, 0.32) 45%,
    transparent 70%
  );

  transform: translateX(-100%);
  animation: cf-progress-shine 1.5s infinite;
}

@keyframes cf-progress-shine {
  to {
    transform: translateX(100%);
  }
}


/* ==========================================
   СПИСОК ФАЙЛОВ
========================================== */

#result {
  margin-top: 18px;
}

#result .file-item {
  margin-top: 10px !important;
  padding: 14px !important;

  border: 1px solid #e8eaf4 !important;
  border-radius: 13px;

  background: #ffffff;

  box-shadow: 0 4px 14px rgba(39, 47, 91, 0.04);

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

#result .file-item:hover {
  border-color: #d4d9f2 !important;
  box-shadow: 0 7px 20px rgba(39, 47, 91, 0.07);
}

#result .file-name {
  overflow: hidden;

  color: var(--cf-text);

  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;

  text-overflow: ellipsis;
  white-space: nowrap;
}

#result .status-text {
  color: var(--cf-muted);

  font-size: 13px;
  line-height: 1.45;
}

#result .remove-btn {
  padding: 5px 7px !important;

  border-radius: 7px !important;

  font-family: inherit;
  font-size: 12px;

  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

#result .remove-btn:hover {
  background: #fff0f0 !important;
  color: var(--cf-danger) !important;
}

#result a {
  display: inline-flex;
  align-items: center;

  margin-top: 8px;

  color: var(--cf-primary-dark);

  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;

  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

#result a:hover {
  color: #3445cd;
  text-decoration: underline;
  transform: translateY(-1px);
}

#result .zip-link-all {
  justify-content: center;

  width: 100%;
  margin-top: 16px !important;
  padding: 13px 18px;

  border: 1px solid #d9def8;
  border-radius: 12px;

  background: #f3f5ff;
  color: var(--cf-primary-dark);

  text-align: center;
}


/* ==========================================
   ПОДПИСЬ ПОД КНОПКОЙ
========================================== */

.upload-limit {
  margin-top: 18px;

  color: var(--cf-muted);

  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.upload-limit a {
  color: var(--cf-primary);

  font-weight: 600;
  text-decoration: none;

  transition: color 0.2s ease;
}

.upload-limit a:hover {
  color: var(--cf-primary-dark);
  text-decoration: underline;
}

.upload-limit span {
  color: #7b8196;
  font-size: 12.5px;
}


/* ==========================================
   МОБИЛЬНАЯ ВЕРСИЯ
========================================== */

@media (max-width: 640px) {
  .custom-converter {
    width: calc(100% - 20px);
    margin: 20px auto;
    padding: 20px 16px;

    border-radius: 18px;
  }

  .drop-zone {
    padding: 34px 16px;
    border-radius: 15px;
  }

  .drop-icon {
    width: 58px;
    height: 58px;

    border-radius: 17px;

    font-size: 34px;
  }

  .drop-text strong {
    font-size: 15px;
  }

  .drop-text span {
    font-size: 13px;
  }

  .convert-btn {
    max-width: none;
    padding: 15px 18px;

    font-size: 16px;
  }

  .cf-select-selected {
    min-height: 50px;
    padding: 12px 13px;

    font-size: 15px;
  }

  .cf-option {
    min-height: 44px;

    font-size: 14px;
  }

  #result .file-item-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  #result .file-item-row-right {
    width: 100% !important;
    min-width: 0 !important;

    text-align: left !important;
  }

  #result .file-name {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}


/* ==========================================
   УМЕНЬШЕНИЕ АНИМАЦИЙ
========================================== */

@media (prefers-reduced-motion: reduce) {
  .custom-converter *,
  .custom-converter *::before,
  .custom-converter *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================
   ДИНАМИЧЕСКИЙ СПИСОК ФОРМАТОВ
========================================== */

.cf-selected-value {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cf-select-selected {
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
}

.cf-option {
  width: 100%;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  background: #ffffff;
  text-align: left;
  font-family: inherit;
}

.cf-option[hidden],
.cf-group-label[hidden] {
  display: none !important;
}

.cf-select-empty {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #f0caca;
  border-radius: 13px;
  background: #fff7f7;
  color: var(--cf-danger);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

#result:empty {
  display: none;
}

@media (max-width: 640px) {
  .file-item-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .file-item-row-right {
    width: 100% !important;
    min-width: auto !important;
    text-align: left !important;
  }
}
