/* ==========================================================================
   overlays.css — modal, menu konteks, toast, drop zone, progres impor
   ========================================================================== */

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade-in 160ms var(--ease);
}

.modal-layer.is-closing {
  animation: fade-in 140ms var(--ease) reverse forwards;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: var(--bg-scrim);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  max-height: min(86vh, 760px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--modal-bg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop-in 240ms var(--ease-out);
}

.modal--wide {
  width: min(600px, 100%);
}

.modal--narrow {
  width: min(400px, 100%);
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 0;
}

.modal__head-text {
  min-width: 0;
}

.modal__eyebrow {
  margin-bottom: 5px;
}

.modal__title {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.modal__sub {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
}

.modal__close {
  width: 30px;
  height: 30px;
  margin: -4px -4px 0 0;
  flex: none;
}

.modal__close .icon {
  width: 16px;
  height: 16px;
}

.modal__body {
  padding: 20px 22px;
  overflow-y: auto;
  min-height: 0;
}

.modal__body--flush {
  padding: 14px 22px 20px;
}

.modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 22px 19px;
  border-top: 1px solid var(--divider);
}

.modal__foot--between {
  justify-content: space-between;
}

.modal__foot--between > .inline-actions {
  margin-left: auto;
}

.modal__foot-note {
  color: var(--text-3);
  font-size: 11.5px;
}

.btn--danger {
  background: #ff3b54;
  color: #fff;
}

.btn--danger:hover {
  background: #ff526a;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 15px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.confirm-icon .icon {
  width: 21px;
  height: 21px;
}

.confirm-text {
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.55;
}

.confirm-text strong {
  color: var(--text);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Drop zone impor
   -------------------------------------------------------------------------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 196px;
  padding: 26px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 13px;
  background: var(--bg-hover);
  text-align: center;
  transition: border-color 160ms var(--ease), background 160ms var(--ease),
    transform 160ms var(--ease);
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone.is-dragover {
  transform: scale(1.008);
}

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 13px;
  border-radius: 50%;
  background: var(--bg-hover-strong);
  color: var(--text-2);
}

.dropzone__icon .icon {
  width: 21px;
  height: 21px;
}

.dropzone h3 {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dropzone p {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}

.import-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.import-formats {
  margin-top: 13px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.import-formats strong {
  color: var(--text-2);
  font-weight: 500;
}

/* Progress */

.progress {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: var(--bg-active);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  transition: width 200ms var(--ease);
}

.progress__bar--indeterminate {
  width: 40% !important;
  animation: progress-slide 1.1s var(--ease) infinite;
}

@keyframes progress-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  color: var(--text-3);
  font-size: 11.5px;
}

.progress-meta strong {
  color: var(--text-2);
  font-weight: 500;
}

.import-progress-file {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-2);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-progress-file span {
  color: var(--text-3);
}

.import-result-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.import-result-title .icon {
  color: #3ddc84;
  width: 18px;
  height: 18px;
}

/* --------------------------------------------------------------------------
   Menu konteks
   -------------------------------------------------------------------------- */

.context-menu {
  position: fixed;
  z-index: 500;
  min-width: 216px;
  max-width: 280px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--menu-bg);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  animation: pop-in 120ms var(--ease-out);
}

.context-menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 31px;
  padding: 5px 9px;
  border-radius: 6px;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  transition: background 100ms var(--ease), color 100ms var(--ease);
}

.context-menu__item:hover,
.context-menu__item:focus-visible {
  background: var(--accent);
  color: #fff;
  outline: none;
}

.context-menu__item .icon {
  width: 15px;
  height: 15px;
  color: var(--text-2);
  flex: none;
}

.context-menu__item:hover .icon,
.context-menu__item:focus-visible .icon {
  color: #fff;
}

.context-menu__item--danger {
  color: #ff6b80;
}

.context-menu__item--danger .icon {
  color: #ff6b80;
}

.context-menu__item--danger:hover {
  background: #e0203b;
  color: #fff;
}

.context-menu__item--danger:hover .icon {
  color: #fff;
}

.context-menu__shortcut {
  margin-left: auto;
  color: var(--text-3);
  font-size: 10.5px;
}

.context-menu__item:hover .context-menu__shortcut {
  color: rgba(255, 255, 255, 0.7);
}

.context-menu__divider {
  height: 1px;
  margin: 5px 7px;
  background: var(--divider);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast-region {
  position: fixed;
  z-index: 600;
  right: 20px;
  bottom: calc(var(--player-height) + 18px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: var(--toast-bg);
  color: #f5f5f7;
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  line-height: 1.4;
  pointer-events: auto;
  animation: toast-in 240ms var(--ease-out);
}

.toast.is-leaving {
  animation: toast-out 180ms var(--ease) forwards;
}

.toast .icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: #a1a1a6;
}

.toast--success .icon {
  color: #3ddc84;
}

.toast--error .icon {
  color: #ff6b80;
}

.toast__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  margin: -4px -7px -4px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 19px;
  line-height: 1;
  opacity: 0.72;
  cursor: pointer;
}

.toast__close:hover {
  background: rgba(255, 255, 255, 0.12);
  opacity: 1;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(6px); }
}

/* --------------------------------------------------------------------------
   Drop overlay global
   -------------------------------------------------------------------------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(8, 8, 10, 0.66);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  pointer-events: none;
  animation: fade-in 140ms var(--ease);
}

.drop-overlay__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(520px, 100%);
  min-height: 280px;
  padding: 40px;
  border: 2px dashed rgba(255, 255, 255, 0.34);
  border-radius: 22px;
  background: rgba(30, 30, 32, 0.66);
  color: #fff;
  text-align: center;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}

.drop-overlay__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.drop-overlay__icon .icon {
  width: 28px;
  height: 28px;
}

.drop-overlay h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.drop-overlay p {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Pengaturan
   -------------------------------------------------------------------------- */

.settings {
  display: grid;
  gap: 18px;
}

.settings-page {
  width: 100%;
  max-width: 820px;
}

.settings-page .settings {
  grid-template-columns: minmax(0, 1fr);
}

.settings-group {
  display: grid;
  gap: 3px;
}

.settings-group__title {
  margin-bottom: 5px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--divider);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row__text {
  flex: 1;
  min-width: 0;
}

.settings-row__title {
  font-size: 13px;
  font-weight: 500;
}

.settings-row__sub {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.45;
}

.settings-row__action {
  flex: none;
}

.settings-kbd {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-input);
  color: var(--text-2);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg-input);
}

.segmented--wrap {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 330px;
}

.segmented__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 500;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}

.segmented__btn .icon {
  width: 13px;
  height: 13px;
}

.segmented__btn:hover {
  color: var(--text);
}

.segmented__btn.is-active {
  background: var(--bg-app);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segmented__btn--disabled,
.segmented__btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.segmented__btn--disabled:hover,
.segmented__btn:disabled:hover {
  color: var(--text-3);
}

.storage-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  color: var(--text-3);
  font-size: 11.5px;
}

.storage-bar {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--bg-active);
  overflow: hidden;
}

.storage-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.about-line {
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.6;
  padding-top: 2px;
}

.about-line strong {
  color: var(--text-2);
  font-weight: 500;
}
