:root {
  --bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --card-bg: #f8fafc;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --card-bg: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 30px 16px;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 650px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}

.lang-select:focus {
  border-color: var(--primary);
}

.status-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

/* Main Box */
.main-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
}

.seo-title-group h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.seo-title-group p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Email Display Input & Copy */
.email-box {
  display: flex;
  gap: 8px;
}

.email-box input {
  flex: 1;
  padding: 10px 12px;
  font-size: 1.05rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  outline: none;
}

.email-box input:focus {
  border-color: var(--primary);
}

/* Buttons & Toolbar */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn svg {
  flex-shrink: 0;
}

.btn:hover {
  background: var(--border);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-copy.copied {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Timer */
.timer-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-bar-container {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 100%;
  background: var(--primary);
  transition: width 1s linear;
}

/* Inbox Card */
.inbox-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.inbox-header {
  padding: 12px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.92rem;
}

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

.count-badge {
  background: var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
}

.email-list {
  display: flex;
  flex-direction: column;
}

.empty-inbox {
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.email-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.email-item:last-child {
  border-bottom: none;
}

.email-item:hover {
  background: var(--card-bg);
}

.email-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.email-item-sender {
  font-weight: 600;
  font-size: 0.88rem;
}

.email-item-subject {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-item-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* SEO Article Section */
.seo-article {
  margin-top: 10px;
  padding: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seo-article h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

.seo-article h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 6px;
}

.seo-article p, .seo-article ul, .seo-article ol {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.seo-article ul, .seo-article ol {
  padding-left: 20px;
}

/* AdSense Container */
.ads-container {
  width: 100%;
  min-height: 90px;
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 15px 0;
  border-top: 1px solid var(--border);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 12px;
}

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

.modal-sub {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

.test-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.form-group input, .form-group textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.9rem;
}
