/* ================================================================
   platform.css v3
   M&A Platform - Custom Styles
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600&family=Outfit:wght@400;500;600;700&display=swap');

/* ----------------------------------------------------------------
   CSS Variables
   ---------------------------------------------------------------- */
:root {
  /* Brand Colors */
  --ma-primary:       #0F2744;
  --ma-primary-hover: #1a3a5c;
  --ma-accent:        #1D6FA4;
  --ma-accent-light:  #E8F4FB;

  /* Status Colors */
  --ma-error:         #C0392B;
  --ma-error-bg:      #FDECEA;
  --ma-success:       #1D9E75;
  --ma-success-bg:    #E8F8F2;
  --ma-warning:       #E67E22;

  /* Neutrals */
  --ma-bg:            #F4F6F9;
  --ma-surface:       #FFFFFF;
  --ma-border:        #DDE3EC;
  --ma-border-focus:  #1D6FA4;
  --ma-text:          #1A1F2E;
  --ma-text-sub:      #5A6478;
  --ma-text-muted:    #8C96A8;

  /* Shadows */
  --ma-shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --ma-shadow-md:  0 4px 16px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --ma-shadow-lg:  0 12px 40px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.05);

  /* Radius */
  --ma-radius-sm: 6px;
  --ma-radius-md: 12px;
  --ma-radius-lg: 20px;

  /* Chat Colors */
  --ma-bubble-mine:        #D9F0E9;
  --ma-bubble-other:       #F0F0EE;
  --ma-bubble-mine-text:   #085041;
  --ma-bubble-other-text:  #2C2C2A;
  --ma-unread-badge:       #1D9E75;
  --ma-send-btn:           #185FA5;
  --ma-send-btn-hover:     #0C447C;

  --ma-chat-max-width:    720px;
  --ma-bubble-max-width:  72%;
  --ma-thread-padding:    16px;
  --ma-input-height-min:  52px;
  --ma-input-height-max:  120px;

  --ma-bubble-font-size:   14px;
  --ma-bubble-line-height: 1.6;
  --ma-meta-font-size:     12px;
  --ma-time-font-size:     11px;
}

/* ================================================================
   SWELL干渉リセット（プラットフォームページ共通）
   ================================================================ */

.ma-auth-wrap *,
.ma-mypage *,
.ma-deal-list *,
.ma-deal-detail *,
.ma-post-deal *,
.ma-profile *,
.ma-inbox *,
.ma-chat * {
  box-sizing: border-box;
}

/* SWELLがh1-h3にmarginを付けることがあるため打ち消し */
.ma-mypage h2,
.ma-mypage h3,
.ma-deal-list h2,
.ma-deal-list h3,
.ma-deal-detail h1,
.ma-deal-detail h2,
.ma-deal-detail h3,
.ma-post-deal h2,
.ma-post-deal h3,
.ma-profile h2,
.ma-profile h3 {
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.4;
}

/* SWELLがbuttonにスタイルを当てることがあるため打ち消し */
.ma-mypage button,
.ma-deal-list button,
.ma-deal-detail button,
.ma-post-deal button,
.ma-profile button {
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1;
}

/* SWELLがaタグに色を付けることがあるため打ち消し */
.ma-deal-list a,
.ma-deal-detail a,
.ma-mypage a {
  text-decoration: none;
}

/* SWELLがinput/textareaにスタイルを当てることがあるため打ち消し */
.ma-post-deal input,
.ma-post-deal select,
.ma-post-deal textarea,
.ma-profile input,
.ma-profile textarea {
  font-family: 'Noto Sans JP', sans-serif;
  appearance: none;
  -webkit-appearance: none;
}

.ma-post-deal select {
  appearance: auto;
  -webkit-appearance: auto;
}

/* ================================================================
   AUTH PAGES（ログイン・登録）
   ================================================================ */

.ma-auth-wrap {
  min-height: 60vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px 64px;
  background: var(--ma-bg);
  font-family: 'Noto Sans JP', sans-serif;
}

.ma-auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--ma-surface);
  border-radius: var(--ma-radius-lg);
  box-shadow: var(--ma-shadow-lg);
  padding: 48px 44px;
  border: 1px solid var(--ma-border);
}

.ma-auth-card__eyebrow {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ma-accent);
  margin-bottom: 10px;
}

.ma-auth-card__title {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ma-primary);
  margin: 0 0 6px;
  line-height: 1.2;
}

.ma-auth-card__sub {
  font-size: 13px;
  color: var(--ma-text-sub);
  margin: 0 0 32px;
}

.ma-auth-error {
  font-size: 13px;
  color: var(--ma-error);
  background: var(--ma-error-bg);
  border: 1px solid rgba(192, 57, 43, .2);
  border-radius: var(--ma-radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-weight: 500;
}

.ma-auth-success {
  font-size: 13px;
  color: var(--ma-success);
  background: var(--ma-success-bg);
  border: 1px solid rgba(29, 158, 117, .2);
  border-radius: var(--ma-radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-weight: 500;
}

.ma-auth-notice.is-error {
  font-size: 13px;
  color: var(--ma-error);
  background: var(--ma-error-bg);
  border: 1px solid rgba(192, 57, 43, .2);
  border-radius: var(--ma-radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-weight: 500;
}

.ma-auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ma-auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ma-auth-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ma-auth-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ma-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ma-auth-required {
  font-size: 11px;
  font-weight: 500;
  color: var(--ma-error);
  background: var(--ma-error-bg);
  padding: 1px 6px;
  border-radius: 4px;
}

.ma-auth-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 14px;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--ma-text);
  background: #FAFBFC;
  border: 1.5px solid var(--ma-border);
  border-radius: var(--ma-radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-sizing: border-box;
}

.ma-auth-input::placeholder {
  color: var(--ma-text-muted);
}

.ma-auth-input:focus {
  border-color: var(--ma-border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(29, 111, 164, .12);
}

.ma-auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}

.ma-auth-check-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--ma-text-sub);
  cursor: pointer;
  line-height: 1.5;
}

.ma-auth-check-label input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--ma-accent);
  flex-shrink: 0;
}

.ma-auth-link--small {
  font-size: 12px;
  color: var(--ma-accent);
  text-decoration: none;
  white-space: nowrap;
}

.ma-auth-link--small:hover {
  text-decoration: underline;
}

.ma-auth-role-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ma-auth-role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  background: #FAFBFC;
  border: 1.5px solid var(--ma-border);
  border-radius: var(--ma-radius-md);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  text-align: center;
}

.ma-auth-role-card input[type="radio"] {
  display: none;
}

.ma-auth-role-card:has(input:checked) {
  border-color: var(--ma-accent);
  background: var(--ma-accent-light);
  box-shadow: 0 0 0 3px rgba(29, 111, 164, .12);
}

.ma-auth-role-card__icon {
  font-size: 22px;
  line-height: 1;
}

.ma-auth-role-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ma-text);
}

.ma-auth-role-card__desc {
  font-size: 11px;
  color: var(--ma-text-sub);
}

.ma-auth-agree {
  padding: 14px 16px;
  background: #F8F9FB;
  border-radius: var(--ma-radius-sm);
  border: 1px solid var(--ma-border);
}

.ma-auth-btn {
  width: 100%;
  height: 48px;
  background: var(--ma-primary);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  border: none;
  border-radius: var(--ma-radius-sm);
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(15, 39, 68, .25);
  margin-top: 4px;
}

.ma-auth-btn:hover {
  background: var(--ma-primary-hover);
  box-shadow: 0 4px 12px rgba(15, 39, 68, .3);
}

.ma-auth-btn:active {
  transform: translateY(1px);
}

.ma-auth-btn:disabled {
  background: var(--ma-text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.ma-auth-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--ma-border);
  text-align: center;
  font-size: 13px;
  color: var(--ma-text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ma-auth-link {
  color: var(--ma-accent);
  text-decoration: none;
  font-weight: 500;
}

.ma-auth-link:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .ma-auth-card {
    padding: 36px 24px;
  }

  .ma-auth-field-row {
    grid-template-columns: 1fr;
  }

  .ma-auth-card__title {
    font-size: 22px;
  }
}

/* ================================================================
   CHAT
   ================================================================ */

.ma-inbox {
  max-width: var(--ma-chat-max-width);
  margin: 0 auto;
  font-family: 'Noto Sans JP', sans-serif;
}

.ma-inbox__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--ma-border);
  margin-bottom: 8px;
}

.ma-inbox__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ma-text);
  margin: 0;
}

.ma-inbox__count {
  font-size: 12px;
  color: var(--ma-text-sub);
}

.ma-inbox__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ma-inbox__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--ma-radius-sm);
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--ma-border);
}

.ma-inbox__item:hover {
  background: var(--ma-bg);
}

.ma-inbox__item.is-unread {
  background: var(--ma-accent-light);
}

.ma-inbox__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ma-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.ma-inbox__body {
  flex: 1;
  min-width: 0;
}

.ma-inbox__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ma-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ma-inbox__case {
  font-size: 11px;
  color: var(--ma-accent);
  margin-top: 1px;
}

.ma-inbox__preview {
  font-size: 12px;
  color: var(--ma-text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.ma-inbox__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.ma-inbox__time {
  font-size: var(--ma-time-font-size);
  color: var(--ma-text-muted);
}

.ma-inbox__badge {
  background: var(--ma-unread-badge);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.ma-inbox__empty {
  text-align: center;
  color: var(--ma-text-muted);
  padding: 48px 0;
  font-size: 14px;
}

.ma-chat {
  max-width: var(--ma-chat-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 400px;
  font-family: 'Noto Sans JP', sans-serif;
}

.ma-chat__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--ma-border);
  flex-shrink: 0;
}

.ma-chat__back {
  font-size: 13px;
  color: var(--ma-accent);
  text-decoration: none;
  white-space: nowrap;
}

.ma-chat__partner {
  flex: 1;
}

.ma-chat__partner-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ma-text);
}

.ma-chat__partner-role {
  font-size: 11px;
  color: var(--ma-text-sub);
  margin-left: 6px;
}

.ma-chat__deal-label {
  font-size: 11px;
  color: var(--ma-accent);
  background: var(--ma-accent-light);
  padding: 3px 8px;
  border-radius: 4px;
}

.ma-chat__thread {
  flex: 1;
  overflow-y: auto;
  padding: var(--ma-thread-padding);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ma-chat__date-divider {
  text-align: center;
  font-size: 11px;
  color: var(--ma-text-muted);
  margin: 8px 0;
  position: relative;
}

.ma-chat__date-divider::before,
.ma-chat__date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--ma-border);
}

.ma-chat__date-divider::before { left: 0; }
.ma-chat__date-divider::after  { right: 0; }

.ma-chat__message {
  display: flex;
  flex-direction: column;
  max-width: var(--ma-bubble-max-width);
}

.ma-chat__message.is-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.ma-chat__message.is-other {
  align-self: flex-start;
  align-items: flex-start;
}

.ma-chat__bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: var(--ma-bubble-font-size);
  line-height: var(--ma-bubble-line-height);
  word-break: break-word;
}

.is-mine .ma-chat__bubble {
  background: var(--ma-bubble-mine);
  color: var(--ma-bubble-mine-text);
  border-bottom-right-radius: 4px;
}

.is-other .ma-chat__bubble {
  background: var(--ma-bubble-other);
  color: var(--ma-bubble-other-text);
  border-bottom-left-radius: 4px;
}

.ma-chat__status {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.ma-chat__time {
  font-size: var(--ma-time-font-size);
  color: var(--ma-text-muted);
}

.ma-chat__read-status {
  font-size: var(--ma-time-font-size);
  color: var(--ma-text-muted);
}

.ma-chat__read-status.is-read {
  color: var(--ma-accent);
}

.ma-chat__error {
  font-size: 13px;
  color: var(--ma-error);
  text-align: center;
  padding: 8px;
  flex-shrink: 0;
}

.ma-chat__form {
  padding: 12px 0 0;
  border-top: 1px solid var(--ma-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ma-chat__input {
  width: 100%;
  min-height: var(--ma-input-height-min);
  max-height: var(--ma-input-height-max);
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--ma-text);
  border: 1.5px solid var(--ma-border);
  border-radius: var(--ma-radius-sm);
  resize: none;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
  overflow-y: auto;
}

.ma-chat__input:focus {
  border-color: var(--ma-border-focus);
}

.ma-chat__send {
  align-self: flex-end;
  height: 40px;
  padding: 0 20px;
  background: var(--ma-send-btn);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--ma-radius-sm);
  cursor: pointer;
  transition: background .15s;
}

.ma-chat__send:hover {
  background: var(--ma-send-btn-hover);
}

.ma-chat__send:disabled {
  background: var(--ma-text-muted);
  cursor: not-allowed;
}

@media (max-width: 767px) {
  .ma-chat__bubble {
    max-width: 85%;
  }

  .ma-chat__form {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-bottom: 12px;
  }
}