@use "../../../scss/globals.scss";

.game-options-modal {
  &__container {
    display: flex;
    gap: calc(globals.$spacing-unit * 2);
    min-height: 520px;
  }

  &__sidebar {
    width: 210px;
    min-width: 210px;
    display: flex;
    flex-direction: column;
    gap: globals.$spacing-unit;
    padding: calc(globals.$spacing-unit * 2) calc(globals.$spacing-unit * 1.75);
    border-right: 1px solid globals.$border-color;
    background: globals.$dark-background-color;
  }

  &__sidebar-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: globals.$spacing-unit;
    border: 0;
    background: transparent;
    color: globals.$muted-color;
    text-align: left;
    padding: calc(globals.$spacing-unit * 1.25)
      calc(globals.$spacing-unit * 1.5);
    border-radius: 4px;
    cursor: pointer;
    font-size: globals.$body-font-size;
    line-height: 1.2;
    transition:
      color 0.2s ease,
      background-color 0.1s ease;

    &:hover {
      background: rgba(255, 255, 255, 0.15);
    }

    &--active {
      background: rgba(255, 255, 255, 0.1);
    }

    &-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      opacity: 0.9;
    }
  }

  &__panel {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: calc(globals.$spacing-unit * 2.5);
    min-width: 0;
    padding: calc(globals.$spacing-unit * 2.5);
  }

  &__panel-header {
    display: flex;
    flex-direction: column;
    gap: calc(globals.$spacing-unit / 2);
  }

  &__section {
    display: flex;
    flex-direction: column;
    gap: calc(globals.$spacing-unit * 1.5);
  }

  &__header {
    display: flex;
    flex-direction: column;
    gap: globals.$spacing-unit;

    &-description {
      font-weight: 400;
    }
  }

  &__cloud-panel {
    display: flex;
    flex-direction: column;
    gap: globals.$spacing-unit;
  }

  &__row {
    display: flex;
    gap: globals.$spacing-unit;
    flex-wrap: wrap;
  }

  &__tool-button-wrapper {
    display: inline-flex;
  }

  &__executable-field {
    display: flex;
    flex-direction: column;
    gap: globals.$spacing-unit;

    &-input {
      width: 100%;
    }

    &-buttons {
      display: flex;
      gap: globals.$spacing-unit;
      flex-wrap: wrap;
      margin-top: calc(globals.$spacing-unit / 2);
    }
  }

  &__wine-prefix {
    display: flex;
    flex-direction: column;
    gap: calc(globals.$spacing-unit * 2);

    &-input {
      width: 100%;
    }
  }

  &__launch-options {
    display: flex;
    flex-direction: column;
    gap: globals.$spacing-unit;

    &-input {
      width: 100%;
    }
  }

  &__inline-code {
    font-family: monospace;
    user-select: text;
  }

  &__mangohud-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(globals.$spacing-unit / 2);
  }

  &__gamemode-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(globals.$spacing-unit / 2);
  }

  &__mangohud-label {
    display: inline-flex;
    align-items: center;
    gap: calc(globals.$spacing-unit / 2);

    &--disabled {
      text-decoration: underline dotted;
      text-underline-offset: 2px;
    }
  }

  &__gamemode-label {
    display: inline-flex;
    align-items: center;
    gap: calc(globals.$spacing-unit / 2);

    &--disabled {
      text-decoration: underline dotted;
      text-underline-offset: 2px;
    }
  }

  &__mangohud-link {
    display: inline-flex;
    align-items: center;
    gap: calc(globals.$spacing-unit / 3);
  }

  &__gamemode-link {
    display: inline-flex;
    align-items: center;
    gap: calc(globals.$spacing-unit / 3);
  }

  &__auto-run-select {
    min-width: 180px;
    flex-shrink: 0;
  }

  &__downloads {
    display: flex;
    flex-direction: column;
    gap: globals.$spacing-unit;
  }

  &__danger-zone {
    display: flex;
    flex-direction: column;
    gap: globals.$spacing-unit;

    &-description {
      font-weight: 400;
    }

    &-buttons {
      display: flex;
      gap: globals.$spacing-unit;
      flex-wrap: wrap;
    }
  }

  &__category-note {
    font-size: globals.$small-font-size;
    color: globals.$muted-color;
  }

  @media (max-width: 860px) {
    &__container {
      flex-direction: column;
      min-height: 0;
    }

    &__sidebar {
      width: 100%;
      min-width: 0;
      padding: calc(globals.$spacing-unit * 1.5) calc(globals.$spacing-unit * 2)
        globals.$spacing-unit;
      border-right: none;
      border-bottom: 1px solid globals.$border-color;
      flex-direction: row;
      flex-wrap: wrap;
    }

    &__panel {
      padding-top: globals.$spacing-unit;
    }
  }
}

.drive-selector {
  display: flex;
  flex-direction: column;
  gap: globals.$spacing-unit;

  &__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: calc(globals.$spacing-unit / 2);

    &::-webkit-scrollbar {
      width: 5px;
    }

    &::-webkit-scrollbar-track {
      background: transparent;
    }

    &::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.15);
      border-radius: 3px;
    }
  }

  &__list-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.5;
    margin-bottom: 6px;
    font-weight: 600;
  }

  &__custom {
    margin-top: calc(globals.$spacing-unit / 2);
  }

  &__error {
    margin: calc(globals.$spacing-unit / 2) 0 0;
    color: globals.$error-color;
    font-size: globals.$small-font-size;
  }

  &__path-row {
    display: flex;
    gap: 8px;
    align-items: center;

    > *:first-child {
      flex: 1;
    }
  }

  &__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: calc(globals.$spacing-unit / 2);
  }
}

.drive-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: globals.$dark-background-color;
  border: 1px solid globals.$border-color;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s;

  &:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
  }

  &--selected {
    border-color: rgba(255, 255, 255, 0.35) !important;
    background: rgba(255, 255, 255, 0.08) !important;
  }

  &--nospace {
    opacity: 0.6;
    cursor: not-allowed;
  }

  &__icon {
    flex-shrink: 0;
    opacity: 0.7;
    color: #fff;
  }

  &__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }

  &__top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
  }

  &__label {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  &__space {
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    color: #fff;
    opacity: 0.8;
  }

  &--nospace &__space {
    color: #f87171;
    opacity: 1;
  }

  &__bar {
    position: relative;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
  }

  &__bar-used {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(168, 162, 158, 0.6);
    border-radius: 2px;
  }

  &__bar-game {
    position: absolute;
    top: 0;
    bottom: 0;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    opacity: 0.9;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
  }

  &__tag {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    color: #f87171;
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.25);
  }
}

.transfer-progress {
  margin-top: 6px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;

  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
  }

  &__title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
  }

  &__pct {
    font-size: 18px;
    font-weight: 700;
    color: globals.$muted-color;
  }

  &__track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
  }

  &__fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    transition: width 0.3s ease;
  }

  &__stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    opacity: 0.7;
  }

  &__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
  }
}

.cancel-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.cancel-confirm-modal {
  background: #1e1e1e;
  border-radius: 16px;
  padding: 24px 32px;
  min-width: 420px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);

  h4 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
  }

  p {
    margin: 0 0 20px;
    font-size: 15px;
    opacity: 0.75;
    line-height: 1.6;
  }
}

.cancel-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;

  button {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
  }
}
