:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --card-bg: #020617;
  --card-border: #1f2937;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --text-main: #e5e7eb;
  --text-soft: #9ca3af;
  --danger: #f97373;
  --radius-xl: 18px;
  --radius-lg: 12px;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.7);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1d283a 0, #020617 50%, #000 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  padding: 24px;
}

.app-shell {
  width: 100%;
  max-width: 1080px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), #020617);
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow-soft);
  padding: 22px 22px 26px;
  position: relative;
  overflow: hidden;
}

/* Glow background */
.app-shell::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 55%),
    radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.12), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
  z-index: -1;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0%, #ffffff, #3b82f6 45%, #1d4ed8 100%);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.35);
}

h1 {
  font-size: 22px; /* hơi to hơn 1 chút */
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-soft);
}

.pill {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.7);
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.3);
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr);
  gap: 18px;
}

.card {
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.88), #020617);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(31, 41, 55, 0.9);
  padding: 16px 16px 14px;
  backdrop-filter: blur(18px);
  position: relative;
}

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

.card-title {
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title span.tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(15, 23, 42, 0.9);
  color: var(--accent);
}

textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;              /* chỉ cho kéo dọc */
  border-radius: var(--radius-lg);
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(circle at top left, #020617, #020617);
  padding: 11px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.8);

  /* 👇 thêm 3 dòng này để không xuống dòng + có thanh trượt ngang */
  white-space: nowrap;     /* không cho xuống dòng */
  overflow-x: auto;        /* hiện thanh trượt ngang khi quá dài */
  overflow-y: auto;        /* vẫn trượt dọc bình thường */
}


textarea::placeholder {
  color: #4b5563;
}

.helper-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 12px;
  font-size: 13px;
  color: var(--text-soft);
}

.helper-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.counter {
  font-variant-numeric: tabular-nums;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid rgba(55, 65, 81, 0.9);
}

button {
  border-radius: 999px;
  border: none;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #f9fafb;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.12s ease;
  white-space: nowrap;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.55);
  filter: brightness(1.03);
}

button:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4);
  filter: brightness(0.97);
}

button.secondary {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.9);
  box-shadow: none;
  padding: 6px 12px;
  font-size: 13px;
}

button.secondary:not(:disabled):hover {
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.8);
}

.results-card {
  margin-top: 4px;
}

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

.results-header-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.results-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.9);
  color: var(--text-soft);
}

/* Làm nổi bật badge email trong mỗi block tài khoản */
.email-block .badge {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.8);
  color: #bfdbfe;
  font-weight: 600;
}

.status-text {
  font-size: 13px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
}

.status-dot.loading {
  background: #facc15;
  animation: pulse 1s infinite;
}

.status-dot.error {
  background: #f87171;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.5); opacity: 1; }
  100% { transform: scale(1); opacity: 0.7; }
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.results-list::-webkit-scrollbar {
  width: 6px;
}

.results-list::-webkit-scrollbar-track {
  background: transparent;
}

.results-list::-webkit-scrollbar-thumb {
  background: rgba(55, 65, 81, 0.9);
  border-radius: 999px;
}

.email-block {
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  padding: 10px 11px;
  background: radial-gradient(circle at top left, var(--accent-soft), rgba(15, 23, 42, 0.95));
}

.email-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.email-block-line {
  font-size: 12px;
  color: var(--text-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  background: rgba(15, 23, 42, 0.8);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.8);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emails-for-line {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.single-email {
  border-radius: 10px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.95);
  padding: 8px 9px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
}

.single-email-main {
  min-width: 0;
}

.single-email-meta {
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

/* Làm subject nổi bật hơn */
.subject {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  color: #e5e7eb;
  text-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
}

/* from rõ hơn một chút */
.from {
  font-size: 12px;
  color: #cbd5f5;
}

/* Nội dung preview dễ đọc hơn */
.preview {
  font-size: 13px;
  color: #e5e7eb;
  margin-top: 4px;
}

/* Khối meta phía dưới */
.email-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
}

.timestamp {
  font-size: 11px;
  color: var(--text-soft);
}

details {
  margin-top: 6px;
  border-radius: 8px;
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), #020617);
  border: 1px dashed rgba(55, 65, 81, 0.8);
  padding: 6px 7px;
}

summary {
  font-size: 13px;
  cursor: pointer;
  color: var(--accent);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

summary::before {
  content: "▶";
  font-size: 10px;
  transform-origin: center;
  transition: transform 0.12s ease;
}

details[open] summary::before {
  transform: rotate(90deg);
}

.body-html-container {
  margin-top: 6px;
  max-height: 320px;
  overflow: auto;
  background: #ffffff;
  border-radius: 6px;
  padding: 6px;
  color: #111827;
  font-size: 13px;
}

.body-html-container iframe {
  width: 100%;
  border: none;
}

.error-message {
  font-size: 13px;
  color: var(--danger);
  margin-top: 4px;
}

.empty-state {
  font-size: 13px;
  color: var(--text-soft);
  text-align: center;
  padding: 12px 4px 2px;
}

@media (max-width: 640px) {
  body {
    padding: 14px;
  }
  .app-shell {
    padding: 16px 14px 18px;
    border-radius: 20px;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  main {
    grid-template-columns: minmax(0, 1fr);
  }
  .email-block-header {
    align-items: flex-start;
  }
  .single-email {
    grid-template-columns: minmax(0, 1fr);
  }
  .email-actions {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* ======= OVERRIDES: highlight email in green + remove shadows ======= */

/* Đổi màu tag email (badge) thành xanh lá */
.email-block .badge,
.single-email .badge {
  background: rgba(34, 197, 94, 0.18) !important;   /* xanh lá nhạt */
  border-color: rgba(34, 197, 94, 0.9) !important;
  color: #4ade80 !important;                         /* xanh lá sáng */
  font-weight: 600 !important;
}

/* Đổi màu email-inline trong header */
.email-block-line {
  border-color: rgba(34, 197, 94, 0.85) !important;
  background: rgba(34, 197, 94, 0.12) !important;
  color: #86efac !important;
}

/* Làm subject cũng có ánh xanh nhẹ */
.subject {
  text-shadow: 0 0 10px rgba(34, 197, 94, 0.35) !important;
}

/* Xóa TẤT CẢ box-shadow để giao diện sạch hơn */
*, .app-shell, button, .card, .single-email, .email-block {
  box-shadow: none !important;
}

/* Glow background cũng tắt luôn nếu muốn tinh giản */
.app-shell::before {
  background: none !important;
}

/* ======= OVERRIDE: timestamp highlight in soft green ======= */

.timestamp {
  color: #84f3a8 !important;          /* xanh lá nhạt dễ nhìn */
  font-weight: 500 !important;        /* đậm nhẹ để nổi bật */
  text-shadow: 0 0 6px rgba(34, 197, 94, 0.35) !important; /* ánh sáng xanh nhẹ */
}

/* ======= OVERRIDE: tăng cỡ chữ ~20% ======= */

/* Tiêu đề chính */
h1 {
  font-size: 26px !important; /* 22px × 1.2 */
}

/* Subtitle dưới title */
.subtitle {
  font-size: 17px !important; /* 14px × 1.2 */
}

/* Pill nhỏ bên cạnh */
.pill {
  font-size: 16px !important; /* 13px × 1.2 */
}

/* Title trong card */
.card-title {
  font-size: 18px !important; /* 15px × 1.2 */
}

.card-title span.tag {
  font-size: 14px !important; /* 12px × 1.2 */
}

/* Text trong textarea */
textarea {
  font-size: 12px !important; /* 14px × 1.2 */
}

/* Hàng helper dưới textarea */
.helper-row {
  font-size: 16px !important; /* 13px × 1.2 */
}

/* Nút bấm chính */
button {
  font-size: 17px !important; /* 14px × 1.2 */
}

/* Nút secondary nhỏ hơn */
button.secondary {
  font-size: 16px !important; /* 13px × 1.2 */
}

/* Tiêu đề phần results */
.results-header h2 {
  font-size: 18px !important; /* 15px × 1.2 */
}

/* Badge chung */
.badge {
  font-size: 14px !important; /* 12px × 1.2 */
}

/* Badge / line hiển thị email */
.email-block-line {
  font-size: 14px !important; /* 12px × 1.2 */
}

/* Status text */
.status-text {
  font-size: 16px !important; /* 13px × 1.2 */
}

/* Subject email */
.subject {
  font-size: 18px !important; /* 15px × 1.2 */
}

/* From */
.from {
  font-size: 14px !important; /* 12px × 1.2 */
}

/* Preview nội dung */
.preview {
  font-size: 16px !important; /* 13px × 1.2 */
}

/* Timestamp (đã đổi sang xanh lá trước đó) */
.timestamp {
  font-size: 13px !important; /* 11px × 1.2 */
}

/* Nội dung HTML trong khung trắng */
.body-html-container {
  font-size: 16px !important; /* 13px × 1.2 */
}

/* Empty state khi không có kết quả */
.empty-state {
  font-size: 16px !important; /* 13px × 1.2 */
}

/* Summary trong <details> */
summary {
  font-size: 16px !important; /* 13px × 1.2 */
}

/* ======= OVERRIDE: remove ALL text shadows ======= */
*, 
*:before, 
*:after {
  text-shadow: none !important;
}
