/* Luna ファイルエージェント — ダッシュボード用パネル */

.luna-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.5rem;
  height: 3.5rem;
  padding: 0 1rem;
  border: none;
  border-radius: 999px;
  background: var(--cf-orange, #f38020);
  color: #fff;
  font-family: var(--cf-font, Inter, sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgb(243 128 32 / 0.35);
  cursor: pointer;
}

.luna-fab:hover {
  background: var(--cf-orange-hover, #e5700f);
}

.luna-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}

.luna-panel.is-open {
  pointer-events: auto;
}

.luna-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.luna-panel.is-open .luna-backdrop {
  opacity: 1;
}

.luna-dialog {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(100vw, 720px);
  height: min(92vh, 760px);
  background: var(--cf-bg, #fff);
  border-top-left-radius: var(--cf-radius-lg, 12px);
  box-shadow: 0 -8px 40px rgb(0 0 0 / 0.12);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.luna-panel.is-open .luna-dialog {
  transform: translateY(0);
}

.luna-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--cf-border, #e2e5e9);
}

.luna-kicker {
  margin: 0;
  font-size: 0.75rem;
  color: var(--cf-muted, #6b7280);
}

.luna-title {
  margin: 0.15rem 0 0;
  font-size: 1.25rem;
}

.luna-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--cf-muted, #6b7280);
  cursor: pointer;
}

.luna-status {
  margin: 0;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--cf-orange, #f38020);
  background: var(--cf-orange-soft, #fff4eb);
}

.luna-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1rem 0;
  border-bottom: 1px solid var(--cf-border, #e2e5e9);
}

.luna-tab {
  border: none;
  background: transparent;
  padding: 0.5rem 0.75rem;
  border-radius: var(--cf-radius, 8px) var(--cf-radius, 8px) 0 0;
  font: inherit;
  color: var(--cf-muted, #6b7280);
  cursor: pointer;
}

.luna-tab.is-active {
  color: var(--cf-text, #1d2433);
  background: var(--cf-surface, #f6f6f7);
  font-weight: 600;
}

.luna-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.luna-tab-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.luna-messages {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.25rem;
}

.luna-msg {
  display: flex;
  margin-bottom: 0.75rem;
}

.luna-msg--user {
  justify-content: flex-end;
}

.luna-msg--assistant {
  justify-content: flex-start;
}

.luna-msg-bubble {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--cf-radius-lg, 12px);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.5;
}

.luna-msg--user .luna-msg-bubble {
  background: var(--cf-orange, #f38020);
  color: #fff;
}

.luna-msg--assistant .luna-msg-bubble {
  background: var(--cf-surface, #f6f6f7);
  color: var(--cf-text, #1d2433);
}

.luna-msg-status {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--cf-muted, #6b7280);
}

.luna-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--cf-border, #e2e5e9);
}

.luna-input {
  flex: 1;
  resize: vertical;
  min-height: 2.75rem;
  max-height: 8rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--cf-border, #e2e5e9);
  border-radius: var(--cf-radius, 8px);
  font: inherit;
}

.luna-send {
  align-self: flex-end;
  border: none;
  border-radius: var(--cf-radius, 8px);
  padding: 0.65rem 1rem;
  background: var(--cf-orange, #f38020);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.luna-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.luna-files,
.luna-preview {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1rem 1rem;
}

.luna-file-item {
  display: flex;
  gap: 0.65rem;
  width: 100%;
  margin-bottom: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--cf-border, #e2e5e9);
  border-radius: var(--cf-radius, 8px);
  background: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.luna-file-item.is-active {
  border-color: var(--cf-orange, #f38020);
  background: var(--cf-orange-soft, #fff4eb);
}

.luna-file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.luna-file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.luna-file-path,
.luna-file-sub {
  font-size: 0.8rem;
  color: var(--cf-muted, #6b7280);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.luna-empty {
  margin: 0;
  color: var(--cf-muted, #6b7280);
  font-size: 0.9rem;
}

.luna-preview-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--cf-radius, 8px);
}

.luna-preview-text {
  margin: 0;
  padding: 0.75rem;
  background: var(--cf-surface, #f6f6f7);
  border-radius: var(--cf-radius, 8px);
  overflow: auto;
  max-height: 60vh;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.luna-preview-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--cf-orange, #f38020);
  font-weight: 600;
  text-decoration: none;
}

.luna-preview-hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--cf-muted, #6b7280);
}

@media (min-width: 900px) {
  .luna-dialog {
    width: min(96vw, 960px);
    height: min(88vh, 820px);
    right: 1rem;
    bottom: 1rem;
    border-radius: var(--cf-radius-lg, 12px);
  }

  .luna-panel.is-open .luna-dialog {
    transform: translateY(0);
  }
}
