/* ============================================================
   BULK SENDER ADMIN — CLEAN GMAIL-LIKE UI
   ============================================================ */

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

:root {
  --bg:          #f6f8fc;
  --white:       #ffffff;
  --text:        #202124;
  --muted:       #5f6368;
  --border:      #e0e0e0;
  --blue:        #1a73e8;
  --blue-hover:  #1557b0;
  --red:         #ea4335;
  --green:       #34a853;
  --yellow:      #fbbc04;
  --active-bg:   #d3e3fd;
  --active-text: #041e49;
  --font:        'Google Sans', 'Roboto', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ── Login ─────────────────────────────────────────── */
#auth-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 360px;
  text-align: center;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 4px;
}

.login-card input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
}

.login-card input:focus { border-color: var(--blue); }

.error-msg {
  background: #fce8e6;
  color: var(--red);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ── App Layout ────────────────────────────────────── */
#app-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 500;
}

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

.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 12px 8px;
  overflow-y: auto;
}

.compose-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: none;
  border-radius: 24px;
  padding: 14px 20px 14px 16px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.1);
  margin-bottom: 8px;
  width: 100%;
  transition: box-shadow 0.15s;
}

.compose-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

nav { display: flex; flex-direction: column; gap: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 0 24px 24px 0;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  margin-right: 8px;
}

.nav-link:hover { background: rgba(0,0,0,0.05); }
.nav-link.active { background: var(--active-bg); color: var(--active-text); font-weight: 500; }

.nav-badge {
  margin-left: auto;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
}

.nav-link.active .nav-badge { color: var(--active-text); }

/* ── Main Content ──────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  position: relative;
}

.tab { display: none; }
.tab.active { display: block; }

.tab-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
}

.tab-header h2 { font-size: 18px; font-weight: 500; }
.tab-header p  { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Add Row Form ──────────────────────────────────── */
.add-row {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
}

.add-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}

.add-row input:focus { border-color: var(--blue); }

/* ── Data Table ────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  background: #f8f9fa;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: #f8f9fa; }

.empty-cell {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Gmail-style Email List ────────────────────────── */
.email-list {
  display: flex;
  flex-direction: column;
}

.email-row {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  gap: 14px;
  transition: background 0.1s;
}

.email-row:hover { background: #f2f6fc; box-shadow: inset 0 0 0 1px var(--border); }

.email-row.unread { font-weight: 600; background: var(--white); }

.email-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

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

.email-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.email-sender {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 140px;
  max-width: 200px;
}

.email-subject {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-snippet {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.email-date { font-size: 12px; color: var(--muted); white-space: nowrap; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.pill-green    { background: #e6f4ea; color: #137333; }
.pill-blue     { background: #e8f0fe; color: #1a73e8; }
.pill-red      { background: #fce8e6; color: #c5221f; }
.pill-yellow   { background: #fef7e0; color: #b06000; }
.pill-gray     { background: #f1f3f4; color: var(--muted); }

/* ── Detail Panel ──────────────────────────────────── */
.detail-panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--white);
  overflow-y: auto;
  padding: 24px;
  z-index: 10;
}

.detail-close {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 14px;
  color: var(--blue);
  cursor: pointer;
  margin-bottom: 20px;
  padding: 0;
}

.detail-close:hover { text-decoration: underline; }

.detail-email-header {
  margin-bottom: 20px;
}

.detail-subject {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 12px;
}

.detail-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.detail-body-box {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 20px;
}

.detail-recipients-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
}

/* ── Compose Modal ─────────────────────────────────── */
.compose-modal {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 520px;
  max-width: 95vw;
  background: var(--white);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  overflow: hidden;
}

.compose-header {
  background: #404040;
  color: white;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
}

.compose-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.compose-body {
  display: flex;
  flex-direction: column;
}

.compose-field {
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  gap: 10px;
}

.compose-field label {
  font-size: 13px;
  color: var(--muted);
  width: 48px;
  flex-shrink: 0;
  padding-top: 6px;
}

.compose-field input,
.compose-field select,
.compose-field textarea {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 14px;
  padding: 6px 0;
  background: transparent;
  resize: none;
}

.compose-field textarea { min-height: 60px; }
.compose-field.compose-msg { border-bottom: none; }
.compose-field.compose-msg textarea { min-height: 180px; padding: 12px 0; }

.compose-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #f8f9fa;
}

.compose-delay {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.compose-delay select {
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 13px;
  background: transparent;
  cursor: pointer;
}

/* ── Buttons ───────────────────────────────────────── */
.btn-blue {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 22px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}

.btn-ghost:hover { background: rgba(0,0,0,0.05); }

.btn-danger {
  background: none;
  border: none;
  color: var(--red);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-danger:hover { background: #fce8e6; }
