/* SukiInbox - Premium Design System with Glassmorphism */

:root {
  /* Colors */
  --bg-base: #0a0b0d;
  --bg-surface: rgba(20, 22, 26, 0.65);
  --bg-card: rgba(30, 34, 42, 0.45);
  --border-dim: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 242, 255, 0.5);
  
  --text-primary: #f0f2f5;
  --text-secondary: #9aa2b1;
  --text-muted: #5e6675;
  
  --accent-cyan: #00f2ff;
  --accent-purple: #b92bff;
  
  /* Channel colors */
  --ch-line: #06C755;
  --ch-email: #2b7fff;
  --ch-rakuten: #bf0000;
  --ch-yahoo: #ff3366;
  --ch-amazon: #ff9900;
  --ch-phone: #8a94a6;
  
  /* Status colors */
  --unhandled: #ff3b30;
  --pending: #ffcc00;
  --resolved: #34c759;

  /* Font */
  --font-main: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;
  --font-mono: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-main);
  height: 100vh;
  overflow: hidden;
}

/* 3-Column Layout */
.inbox-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at 50% -20%, rgba(185, 43, 255, 0.08), transparent 60%),
              radial-gradient(circle at 10% 40%, rgba(0, 242, 255, 0.05), transparent 50%);
}

/* --- 1. SIDEBAR (Left) --- */
.sidebar {
  width: 280px;
  background: rgba(13, 15, 18, 0.85);
  border-right: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-dim);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.accent-icon {
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 8px rgba(0, 242, 255, 0.4));
}

.status-badge.live {
  font-size: 0.65rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-purple), #7b2cff);
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.5px;
}

.nav-section {
  padding: 20px 16px;
}

.nav-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  padding-left: 8px;
}

.nav-list {
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  margin-bottom: 4px;
  gap: 12px;
}

.nav-item i {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0, 242, 255, 0.08);
  color: var(--accent-cyan);
  font-weight: 600;
}

.count-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 99px;
  color: var(--text-secondary);
}

.count-unhandled {
  background: rgba(255, 59, 48, 0.15);
  color: var(--unhandled);
}

/* Nav specific icon colors */
.unhandled-color { color: var(--unhandled); }
.pending-color { color: var(--pending); }
.resolved-color { color: var(--resolved); }
.ch-line-color { color: var(--ch-line); }
.ch-email-color { color: var(--ch-email); }
.ch-rakuten-color { color: var(--ch-rakuten); }
.ch-yahoo-color { color: var(--ch-yahoo); }
.ch-amazon-color { color: var(--ch-amazon); }
.ch-phone-color { color: var(--ch-phone); }

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border-dim);
}

.btn-sidebar {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sidebar:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

/* --- 2. THREAD PANE (Center) --- */
.thread-pane {
  width: 380px;
  border-right: 1px solid var(--border-dim);
  background: rgba(16, 18, 22, 0.4);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.pane-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-dim);
  background: rgba(10, 11, 13, 0.2);
}

.search-bar {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 8px 12px;
  gap: 10px;
}

.search-bar i {
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.search-bar input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.88rem;
  width: 100%;
}

.search-bar input:focus {
  outline: none;
}

.thread-list {
  flex-grow: 1;
  overflow-y: auto;
}

.loading-placeholder {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.thread-card {
  padding: 16px;
  border-bottom: 1px solid var(--border-dim);
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.thread-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background 0.2s;
}

.thread-card:hover {
  background: rgba(255, 255, 255, 0.02);
}

.thread-card.active {
  background: rgba(255, 255, 255, 0.04);
}

.thread-card.active::before {
  background: var(--accent-cyan);
}

.thread-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.thread-channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.thread-channel-badge.line { background: rgba(6, 199, 85, 0.12); color: var(--ch-line); }
.thread-channel-badge.email { background: rgba(43, 127, 255, 0.12); color: var(--ch-email); }
.thread-channel-badge.rakuten { background: rgba(191, 0, 0, 0.12); color: var(--ch-rakuten); }
.thread-channel-badge.yahoo { background: rgba(255, 51, 102, 0.12); color: var(--ch-yahoo); }
.thread-channel-badge.amazon { background: rgba(255, 153, 0, 0.12); color: var(--ch-amazon); }
.thread-channel-badge.phone { background: rgba(138, 148, 166, 0.12); color: var(--ch-phone); }

.thread-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.thread-customer-name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.thread-snippet {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.thread-tags {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.unhandled { background: var(--unhandled); }
.status-indicator.pending { background: var(--pending); }
.status-indicator.resolved { background: var(--resolved); }

.meta-tag {
  font-size: 0.7rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-dim);
}

/* --- 3. DETAIL PANE (Right) --- */
.detail-pane {
  flex-grow: 1;
  background: rgba(13, 15, 18, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  color: var(--text-muted);
  gap: 16px;
}

.empty-state i {
  width: 48px;
  height: 48px;
  stroke-width: 1.2px;
}

.empty-state h3 {
  color: var(--text-secondary);
}

.detail-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* 3A. Customer Profile Card */
.customer-profile-card {
  padding: 20px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-dim);
}

.customer-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.customer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #000;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.customer-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.customer-name-row h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.rank-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(0, 242, 255, 0.15);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 99px;
}

.customer-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.customer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid var(--border-dim);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.stat-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* 3B. Integrated Timeline */
.timeline-container {
  flex-grow: 1;
  padding: 24px;
  overflow-y: auto;
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
}

.timeline-header {
  margin-bottom: 20px;
}

.timeline-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.timeline-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.timeline-events {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 20px;
}

.timeline-events::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border-dim);
}

.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 12px 16px;
  position: relative;
}

.timeline-card::after {
  content: '';
  position: absolute;
  left: -20px;
  top: 14px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 2px solid var(--border-dim);
}

/* Channel specific timeline card highlights */
.timeline-card.line::after { border-color: var(--ch-line); background: var(--ch-line); }
.timeline-card.email::after { border-color: var(--ch-email); background: var(--ch-email); }
.timeline-card.rakuten::after { border-color: var(--ch-rakuten); background: var(--ch-rakuten); }
.timeline-card.yahoo::after { border-color: var(--ch-yahoo); background: var(--ch-yahoo); }
.timeline-card.amazon::after { border-color: var(--ch-amazon); background: var(--ch-amazon); }
.timeline-card.phone::after { border-color: var(--ch-phone); background: var(--ch-phone); }

.timeline-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.timeline-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-card-channel-name {
  font-size: 0.75rem;
  font-weight: 700;
}

.line-text { color: var(--ch-line); }
.email-text { color: var(--ch-email); }
.rakuten-text { color: var(--ch-rakuten); }
.yahoo-text { color: var(--ch-yahoo); }
.amazon-text { color: var(--ch-amazon); }
.phone-text { color: var(--ch-phone); }

.timeline-card-sender {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-card-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timeline-card-body {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* 3C. Reply Composer */
.reply-composer {
  padding: 16px 24px 20px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-dim);
}

.composer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.channel-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.composer-actions {
  display: flex;
  gap: 8px;
}

.composer-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-dim);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 6px 12px;
  font-family: var(--font-main);
  font-size: 0.78rem;
}

.composer-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.btn-ai {
  background: linear-gradient(135deg, rgba(185, 43, 255, 0.15), rgba(0, 242, 255, 0.1));
  border: 1px solid rgba(185, 43, 255, 0.4);
  color: #e5c3ff;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ai i {
  width: 14px;
  height: 14px;
}

.btn-ai:hover {
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(185, 43, 255, 0.2);
  transform: translateY(-0.5px);
}

.composer-body {
  position: relative;
  margin-bottom: 12px;
}

.composer-body textarea {
  width: 100%;
  height: 110px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.88rem;
  padding: 12px;
  resize: none;
  transition: border-color 0.2s;
}

.composer-body textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* AI Draft Preview Modal box */
.ai-draft-preview {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  background: rgba(22, 14, 30, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(185, 43, 255, 0.4);
  border-radius: 6px;
  padding: 10px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.ai-draft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #e5c3ff;
}

.ai-draft-header i {
  vertical-align: middle;
}

.btn-ai-apply {
  background: var(--accent-purple);
  border: none;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.ai-draft-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: pre-wrap;
  max-height: 80px;
  overflow-y: auto;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.composer-status-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.composer-status-select select {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-dim);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: var(--font-main);
  font-size: 0.8rem;
}

.btn-send {
  background: linear-gradient(135deg, var(--accent-cyan), #00bfff);
  border: none;
  color: #000;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 800;
  padding: 10px 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-send:hover {
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
  transform: translateY(-0.5px);
}

.btn-send i {
  width: 16px;
  height: 16px;
}
