@import url("./theme.css");

/* =========================================================
   Модалка загрузки файлов (#upload-modal)
   ========================================================= */

#upload-modal .modal-content {
  width: 100%;
  max-width: 560px;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
  margin: 0 auto;
}

#upload-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: relative;
}

#upload-modal .modal-title {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
  text-align: center;
}

#upload-modal .modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

#upload-modal .modal-close-btn:hover {
  color: var(--text-primary);
}

#upload-modal .modal-body {
  padding: 24px;
  background: var(--bg-elevated);
}

#upload-modal .modal-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* ===== Drop-zone ===== */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  background: var(--bg-hover);
  position: relative;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone:hover {
  border-color: var(--border-accent);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-glow);
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
  box-shadow: 0 0 20px rgba(124, 92, 255, 0.15);
}

.drop-zone.has-files {
  border-color: var(--success);
  background: var(--success-soft);
}

.drop-zone-content {
  pointer-events: none;
  user-select: none;
}

.drop-zone-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin: 0 auto 12px;
  display: block;
  transition: color 0.25s;
}

.drop-zone.dragover .drop-zone-icon {
  color: var(--accent);
}

.drop-zone.has-files .drop-zone-icon {
  color: var(--success);
}

.drop-zone-text {
  color: var(--text-primary);
  font-size: 14px;
  margin: 0 0 4px 0;
}

.drop-zone-link {
  color: var(--text-accent);
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
}

.drop-zone-link:hover {
  color: #c4b5fd;
}

.drop-zone-hint {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 8px 0 0 0;
}

.drop-zone-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

/* ===== Список файлов ===== */
.file-list {
  margin-top: 16px;
  display: none;
  max-height: 150px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.file-item:hover {
  background: var(--bg-elevated);
}

.file-name {
  color: var(--text-primary);
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 12px;
}

.file-size {
  color: var(--text-secondary);
  font-size: 12px;
  margin-right: 12px;
  white-space: nowrap;
}

.file-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition:
    color 0.2s,
    transform 0.1s;
}

.file-remove:hover {
  color: var(--danger);
  transform: scale(1.1);
}

.file-remove:active {
  transform: scale(0.9);
}

/* ===== Кнопки модалки ===== */
.modal-btn {
  padding: 9px 24px;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  min-width: 120px;
}

.modal-btn-cancel {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.modal-btn-cancel:hover {
  background: var(--bg-elevated);
  border-color: var(--border-accent);
}

.modal-btn-upload {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.3);
}

.modal-btn-upload:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124, 92, 255, 0.4);
}

.modal-btn-upload:active {
  transform: scale(0.97);
}

/* ===== Описание загрузки ===== */
.upload-description {
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--accent);
  color: var(--text-primary);
}

.upload-description-text {
  margin: 0 0 8px 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.upload-description-text strong {
  color: var(--text-primary);
}

.upload-description-list {
  margin: 8px 0 12px 0;
  padding-left: 24px;
  list-style-type: disc;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.upload-description-list li {
  margin-bottom: 2px;
}

.upload-description-list li::marker {
  color: var(--accent);
}

.upload-description-note {
  margin: 8px 0 0 0;
  padding: 8px 12px;
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.upload-description-note strong {
  color: var(--danger);
}

/* =========================================================
   Адаптив
   ========================================================= */

#report-period-modal .modal-content {
  width: 100%;
  max-width: 460px;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  margin: 0 auto;
}

#report-period-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: relative;
}

#report-period-modal .modal-title {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
  text-align: center;
}

#report-period-modal .modal-close-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s ease;
}

#report-period-modal .modal-close-btn:hover {
  color: var(--text-primary);
}

#report-period-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 24px 250px;
  background: var(--bg-elevated);
}

#report-period-modal .report-period-fields {
  display: flex;
  gap: 16px;
  width: 100%;
}

#report-period-modal .report-period-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#report-period-modal .report-period-field-label {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

#report-period-modal .modal-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 14px;
  box-sizing: border-box;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

#report-period-modal .modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#report-period-modal .modal-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

#report-period-modal .modal-checkbox-label:hover {
  color: var(--text-primary);
}

#uploadAllReportsCheckbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  display: inline-block;
  position: relative;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

#uploadAllReportsCheckbox:hover {
  border-color: var(--border-accent);
}

#uploadAllReportsCheckbox:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}

#uploadAllReportsCheckbox:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

#uploadAllReportsCheckbox:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

#report-period-modal .modal-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

#report-period-modal .modal-btn {
  padding: 9px 24px;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  min-width: 120px;
}

#report-period-modal .modal-btn-cancel {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

#report-period-modal .modal-btn-cancel:hover {
  background: var(--bg-elevated);
  border-color: var(--border-accent);
}

#report-period-modal .modal-btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.3);
}

#report-period-modal .modal-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124, 92, 255, 0.4);
}

#report-period-modal .modal-btn-primary:active {
  transform: scale(0.97);
}

@media (max-width: 600px) {
  #report-period-modal .modal-content {
    max-width: 100%;
    min-width: 0;
    margin: 0;
    border-radius: var(--radius-lg);
  }

  #report-period-modal .modal-header {
    padding: 12px 16px;
  }

  #report-period-modal .modal-title {
    font-size: 14px;
  }

  #report-period-modal .modal-body {
    padding: 16px 16px 250px;
  }

  #report-period-modal .report-period-fields {
    flex-direction: column;
    gap: 12px;
  }

  #report-period-modal .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  #report-period-modal .modal-btn {
    flex: 1;
    min-width: 100px;
    max-width: 160px;
    padding: 8px 16px;
    font-size: 13px;
  }

  #upload-modal .modal-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    border-radius: var(--radius-lg);
  }

  #upload-modal .modal-header {
    padding: 12px 16px;
  }

  #upload-modal .modal-title {
    font-size: 14px;
  }

  #upload-modal .modal-body {
    padding: 16px;
  }

  #upload-modal .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .drop-zone {
    padding: 28px 16px;
    min-height: 120px;
  }

  .drop-zone-icon {
    width: 36px;
    height: 36px;
  }

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

  .modal-btn {
    padding: 8px 16px;
    font-size: 13px;
    flex: 1;
    min-width: 100px;
    max-width: 160px;
  }

  .file-item {
    padding: 6px 10px;
  }

  .file-name {
    font-size: 12px;
  }

  .upload-description {
    padding: 12px 16px;
    margin-bottom: 16px;
  }

  .upload-description-text {
    font-size: 13px;
  }

  .upload-description-list {
    font-size: 12px;
    padding-left: 20px;
  }

  .upload-description-note {
    font-size: 12px;
    padding: 6px 10px;
  }
}

@media (max-width: 400px) {
  #upload-modal .modal-footer {
    flex-direction: column;
    align-items: center;
  }

  .drop-zone {
    padding: 20px 12px;
    min-height: 100px;
  }

  .drop-zone-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 8px;
  }

  .drop-zone-text {
    font-size: 12px;
  }

  .drop-zone-hint {
    font-size: 10px;
  }

  .modal-btn {
    min-width: 100%;
    max-width: 100%;
  }

  .upload-description {
    padding: 10px 12px;
    margin-bottom: 12px;
  }

  .upload-description-text {
    font-size: 12px;
  }

  .upload-description-list {
    font-size: 11px;
    padding-left: 16px;
  }

  .upload-description-note {
    font-size: 11px;
    padding: 4px 8px;
  }
}
