@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --bg-color: #fafafa;
  --card-bg: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --accent-color: #000000;
  --accent-hover: #374151;
  --blue-accent: #2563eb;
  --blue-hover: #1d4ed8;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 48px;
}

.header div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.header img {
  width: 48px !important;
  height: 48px !important;
  object-fit: contain;
}

.header h1 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 8px;
}

/* Sections */
.address-section, .inbox-section, .info-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.address-section:hover, .inbox-section:hover {
  box-shadow: var(--shadow-md);
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent-color);
  color: #fff;
}

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

.btn-secondary {
  background: #fff;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btn-copy {
  background: #fff;
  color: var(--blue-accent);
  border-color: #bfdbfe;
}

.btn-copy:hover {
  background: #eff6ff;
  border-color: var(--blue-accent);
}

.btn-danger {
  background: #fff;
  color: var(--danger-color);
  border-color: #fca5a5;
}

.btn-danger:hover {
  background: #fef2f2;
  border-color: var(--danger-color);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

/* Inputs & Selects */
input[type="text"], select {
  padding: 10px 16px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input[type="text"]:focus, select:focus {
  border-color: var(--blue-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Address Box */
.address-box {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.address-box input {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 500;
  background: #f9fafb;
}

.address-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

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

.custom-address {
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.custom-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Inbox Section */
.inbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.badge {
  background: #f3f4f6;
  color: var(--text-primary);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.auto-refresh-info {
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auto-refresh-info label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.email-list {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 500px;
  overflow-y: auto;
}

.email-item {
  display: flex;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.email-item:hover {
  background: #f9fafb;
}

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

.email-item.unread {
  background: #f0f9ff;
  border-left: 3px solid var(--blue-accent);
}

.email-item-content {
  flex: 1;
  min-width: 0;
}

.email-item-from {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.email-item-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding-left: 16px;
  white-space: nowrap;
}

.empty-inbox {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-secondary);
}

.empty-inbox p:first-child {
  font-size: 2rem;
  margin-bottom: 12px;
}

/* Modal View */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal:not(.hidden) .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: #f9fafb;
  position: sticky;
  top: 0;
}

.email-detail {
  padding: 24px;
}

.email-meta {
  background: #f9fafb;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.meta-row {
  margin-bottom: 6px;
  font-size: 0.875rem;
  display: flex;
}

.meta-row strong {
  width: 80px;
  color: var(--text-secondary);
  font-weight: 500;
}

.email-body-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.tab-btn {
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}

.tab-btn:hover {
  background: #f3f4f6;
  color: var(--text-primary);
}

.tab-btn.active {
  background: #f3f4f6;
  color: var(--text-primary);
}

.email-body {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: auto;
}

/* Info Box */
.info-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.875rem;
}

.info-box p {
  display: flex;
  justify-content: space-between;
}

/* Footer */
.footer {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 32px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111827;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: slideUp 0.3s ease;
}

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

@media (max-width: 640px) {
  .address-box { flex-direction: column; }
  .address-controls { flex-direction: column; align-items: stretch; }
  .custom-input-group { flex-direction: column; align-items: stretch; }
  .custom-input-group input { width: 100%; }
  .modal-content { border-radius: 0; height: 100vh; max-height: 100vh; }
  .container { padding: 20px 16px; }
  .address-section, .inbox-section, .info-section { padding: 20px; }
}
