/* style.css — Humanear Broadcast UI */
/* Brand: Green #4a6b35, Charcoal #2a2a2a, Sage #7a9060, Silver #d0d0d0, White #fff */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0f2f0;
  color: #2a2a2a;
  min-height: 100vh;
}

/* -------------------------------------------------------
   LOGIN
------------------------------------------------------- */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  background: #fff;
  border-radius: 10px;
  padding: 2.5rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  text-align: center;
}

.login-box h1 { color: #4a6b35; margin-bottom: 0.5rem; font-size: 1.6rem; }
.login-box p  { color: #5a5a5a; margin-bottom: 1rem; font-size: 0.95rem; }

.login-box input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s;
}
.login-box input:focus { outline: none; border-color: #4a6b35; }

#login-msg { margin-top: 0.75rem; font-size: 0.9rem; color: #4a6b35; min-height: 1.2em; }
#login-msg.error { color: #c0392b; }

/* -------------------------------------------------------
   BUTTONS
------------------------------------------------------- */
button, .btn {
  background: #4a6b35;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-block;
  text-decoration: none;
}
button:hover, .btn:hover   { background: #7a9060; }
button:disabled, .btn:disabled { background: #d0d0d0; cursor: not-allowed; color: #fff; }

.btn-secondary {
  background: #fff;
  color: #4a6b35;
  border: 1px solid #4a6b35;
}
.btn-secondary:hover { background: #f0f2f0; }

.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #e74c3c; }

/* -------------------------------------------------------
   LAYOUT — NAV + SHELL
------------------------------------------------------- */
#app { display: flex; flex-direction: column; min-height: 100vh; }

nav {
  background: #2a2a2a;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  color: #4a6b35;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin-right: 2rem;
  padding: 1rem 0;
  white-space: nowrap;
}

nav a {
  color: #d0d0d0;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 1rem 1rem;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
nav a:hover  { color: #fff; }
nav a.active { color: #fff; border-bottom-color: #4a6b35; }

#view-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* -------------------------------------------------------
   CARDS / PANELS
------------------------------------------------------- */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  margin-bottom: 1.25rem;
}

.card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: #2a2a2a; }

/* -------------------------------------------------------
   FORM ELEMENTS
------------------------------------------------------- */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #5a5a5a;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s;
  margin-bottom: 1rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #4a6b35;
}

textarea { resize: vertical; min-height: 200px; }

.field { margin-bottom: 1rem; }
.field label { margin-bottom: 0.3rem; }
.field input, .field select, .field textarea { margin-bottom: 0; }

/* -------------------------------------------------------
   COMPOSE VIEW
------------------------------------------------------- */
.compose-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}

/* Tab switcher — plain text vs HTML upload */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e8e8e8;
  margin-bottom: 1rem;
}
.tab-btn {
  background: none;
  color: #5a5a5a;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: -2px;
}
.tab-btn.active { color: #4a6b35; border-bottom-color: #4a6b35; font-weight: 600; }
.tab-btn:hover { background: #f0f2f0; }

/* HTML preview iframe */
#html-preview {
  width: 100%;
  height: 320px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 1rem;
}

/* Recipient preview panel */
.recipient-panel { position: sticky; top: 5rem; }

.recipient-count {
  font-size: 2rem;
  font-weight: 700;
  color: #4a6b35;
  line-height: 1;
}
.recipient-label { font-size: 0.8rem; color: #5a5a5a; margin-bottom: 1rem; }

.recipient-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.recipient-list-item {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #f0f0f0;
  color: #2a2a2a;
}
.recipient-list-item:last-child { border-bottom: none; }
.recipient-list-item span { color: #5a5a5a; font-size: 0.8rem; display: block; }
.recipient-empty { padding: 1rem; text-align: center; color: #aaa; font-size: 0.85rem; }

/* Send confirmation overlay */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.overlay.hidden { display: none; }
.overlay-box {
  background: #fff;
  border-radius: 10px;
  padding: 2rem;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.overlay-box h3 { margin-bottom: 0.5rem; }
.overlay-box p  { color: #5a5a5a; font-size: 0.9rem; margin-bottom: 1.25rem; }
.overlay-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* Status messages */
.status-msg {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-top: 0.75rem;
  display: none;
}
.status-msg.success { background: #e8f5e0; color: #2e6b1a; display: block; }
.status-msg.error   { background: #fdecea; color: #c0392b; display: block; }
.status-msg.loading { background: #f0f2f0; color: #5a5a5a; display: block; }

/* -------------------------------------------------------
   SEND HISTORY VIEW
------------------------------------------------------- */
.history-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.history-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5a5a5a;
  border-bottom: 2px solid #e8e8e8;
}
.history-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: #f8f9f8; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-sent    { background: #e8f5e0; color: #2e6b1a; }
.badge-failed  { background: #fdecea; color: #c0392b; }
.badge-partial { background: #fef3e2; color: #b07d12; }

.tracking-mini { font-size: 0.8rem; color: #5a5a5a; margin-top: 0.2rem; }
.tracking-mini strong { color: #2a2a2a; }

/* -------------------------------------------------------
   CONTACTS VIEW
------------------------------------------------------- */
.contacts-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.contacts-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5a5a5a;
  border-bottom: 2px solid #e8e8e8;
}
.contacts-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.contacts-table tr:last-child td { border-bottom: none; }
.contacts-table tr:hover td { background: #f8f9f8; }

.group-tag {
  display: inline-block;
  background: #e8f0e0;
  color: #4a6b35;
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  margin: 0.1rem 0.15rem 0.1rem 0;
}

.inactive-row td { opacity: 0.45; }

/* -------------------------------------------------------
   UTILITIES
------------------------------------------------------- */
.flex-row   { display: flex; align-items: center; gap: 0.75rem; }
.mt-1       { margin-top: 0.5rem; }
.mt-2       { margin-top: 1rem; }
.text-muted { color: #5a5a5a; font-size: 0.85rem; }
.text-right { text-align: right; }
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #aaa;
  font-size: 0.95rem;
}

/* Responsive — stack compose grid on narrow screens */
@media (max-width: 680px) {
  .compose-grid { grid-template-columns: 1fr; }
  .recipient-panel { position: static; }
}
