/* ─────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  height: 100vh;
  overflow: hidden;
}

/* ─────────────────────────────────────────
   AUTH PAGES
───────────────────────────────────────── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: auto;
  background: #0a0d14;
}

.auth-container {
  background: #161b27;
  border: 1px solid #1e2535;
  border-radius: 16px;
  padding: 40px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.auth-logo {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.auth-logo-text {
  font-size: 24px;
  font-weight: 700;
  color: #e2e8f0;
}

.auth-logo-sub {
  font-size: 13px;
  color: #4a5568;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid #1e2535;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  color: #4a5568;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.auth-tab:hover {
  color: #a0aec0;
}

.auth-tab.active {
  color: #63b3ed;
  border-bottom-color: #63b3ed;
}

.auth-error {
  background: #742a2a;
  color: #fc8181;
  border: 1px solid #9b2c2c;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: #2d3748;
  line-height: 1.8;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
}

/* ─────────────────────────────────────────
   APP LAYOUT
───────────────────────────────────────── */
.app-container {
  display: flex;
  height: 100vh;
}

/* ─────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: #0a0d14;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1e2535;
}

.sidebar-header {
  padding: 20px 20px 20px 20px;
  border-bottom: 1px solid #1e2535;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 28px;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1.2;
}

.logo-sub {
  font-size: 10px;
  color: #718096;
  margin-top: 2px;
}

.nav-menu {
  list-style: none;
  padding: 10px 0;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  cursor: pointer;
  transition: background 0.2s;
  color: #718096;
  font-size: 14px;
}

.nav-item:hover {
  background: #1e2535;
  color: #e2e8f0;
}

.nav-item.active {
  background: #1e2535;
  color: #63b3ed;
  border-left: 3px solid #63b3ed;
}

.nav-icon {
  font-size: 17px;
  width: 22px;
  text-align: center;
}

.nav-label {
  font-weight: 500;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #1e2535;
}

.church-name {
  font-size: 12px;
  color: #4a5568;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: none;
  border: 1px solid #1e2535;
  color: #4a5568;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: #1e2535;
  color: #a0aec0;
}

/* ─────────────────────────────────────────
   MAIN CONTENT
───────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
  background: #0f1117;
}

.main-content::-webkit-scrollbar {
  width: 6px;
}

.main-content::-webkit-scrollbar-track {
  background: #0f1117;
}

.main-content::-webkit-scrollbar-thumb {
  background: #2d3748;
  border-radius: 3px;
}

/* ─────────────────────────────────────────
   PAGE HEADER
───────────────────────────────────────── */
.page-header {
  margin-bottom: 25px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: #e2e8f0;
}

.page-header p {
  color: #4a5568;
  margin-top: 4px;
  font-size: 14px;
}

/* ─────────────────────────────────────────
   CARDS
───────────────────────────────────────── */
.card {
  background: #161b27;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  margin-bottom: 20px;
  border: 1px solid #1e2535;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 15px;
}

/* ─────────────────────────────────────────
   STATS GRID
───────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #161b27;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  border: 1px solid #1e2535;
}

.stat-icon {
  font-size: 30px;
  margin-bottom: 8px;
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: #63b3ed;
}

.stat-label {
  font-size: 12px;
  color: #4a5568;
  margin-top: 4px;
}

/* ─────────────────────────────────────────
   BUTTONS
───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #2b6cb0;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #3182ce;
}

.btn-success {
  background: #276749;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #38a169;
}

.btn-danger {
  background: #9b2c2c;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #e53e3e;
}

.btn-secondary {
  background: #1e2535;
  color: #a0aec0;
  border: 1px solid #2d3748;
}

.btn-secondary:hover:not(:disabled) {
  background: #2d3748;
  color: #e2e8f0;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ─────────────────────────────────────────
   FORMS
───────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #a0aec0;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #2d3748;
  border-radius: 8px;
  font-size: 14px;
  color: #e2e8f0;
  background: #0f1117;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49,130,206,0.15);
}

.form-control::placeholder {
  color: #2d3748;
}

select.form-control {
  cursor: pointer;
}

select.form-control option {
  background: #161b27;
  color: #e2e8f0;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 12px;
  color: #4a5568;
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─────────────────────────────────────────
   TABLES
───────────────────────────────────────── */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #1e2535;
}

tbody tr {
  border-bottom: 1px solid #1a1f2e;
  transition: background 0.15s;
}

tbody tr:hover {
  background: #1a1f2e;
}

tbody td {
  padding: 12px 14px;
  color: #cbd5e0;
}

/* ─────────────────────────────────────────
   BADGES
───────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: #1c4532;
  color: #68d391;
}

.badge-danger {
  background: #742a2a;
  color: #fc8181;
}

.badge-warning {
  background: #744210;
  color: #f6e05e;
}

.badge-info {
  background: #1a365d;
  color: #90cdf4;
}

/* ─────────────────────────────────────────
   TOOLBAR
───────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  padding: 8px 12px;
  border: 1px solid #2d3748;
  border-radius: 8px;
  font-size: 14px;
  width: 220px;
  background: #0f1117;
  color: #e2e8f0;
}

.search-input::placeholder {
  color: #2d3748;
}

.search-input:focus {
  outline: none;
  border-color: #3182ce;
}

/* ─────────────────────────────────────────
   MODAL
───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: #161b27;
  border-radius: 12px;
  padding: 28px;
  width: 480px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  border: 1px solid #1e2535;
}

.modal::-webkit-scrollbar {
  width: 6px;
}

.modal::-webkit-scrollbar-thumb {
  background: #2d3748;
  border-radius: 3px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #e2e8f0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #4a5568;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: #e2e8f0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ─────────────────────────────────────────
   ALERTS
───────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.alert-success {
  background: #1c4532;
  color: #68d391;
  border: 1px solid #276749;
}

.alert-error {
  background: #742a2a;
  color: #fc8181;
  border: 1px solid #9b2c2c;
}

.alert-warning {
  background: #744210;
  color: #f6e05e;
  border: 1px solid #975a16;
}

.alert-info {
  background: #1a365d;
  color: #90cdf4;
  border: 1px solid #2c5282;
}

/* ─────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
  color: #2d3748;
}

/* ─────────────────────────────────────────
   LOADING
───────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: #4a5568;
  font-size: 14px;
  gap: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #1e2535;
  border-top-color: #3182ce;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────
   CHAR COUNTER
───────────────────────────────────────── */
.char-counter {
  text-align: right;
  font-size: 12px;
  color: #4a5568;
  margin-top: 4px;
}

.char-counter.warning { color: #d69e2e; }
.char-counter.danger  { color: #e53e3e; }

/* ─────────────────────────────────────────
   SEND PREVIEW
───────────────────────────────────────── */
.send-preview {
  background: #0f1117;
  border: 1px solid #1e2535;
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}

.send-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 10px;
}

.send-preview-stat {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
  color: #718096;
}

.send-preview-stat strong {
  color: #63b3ed;
}

/* ─────────────────────────────────────────
   SETTINGS
───────────────────────────────────────── */
.settings-section {
  margin-bottom: 30px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4a5568;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1e2535;
}

/* ─────────────────────────────────────────
   TEMPLATES
───────────────────────────────────────── */
.template-card {
  background: #0f1117;
  border: 1px solid #1e2535;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.template-card:hover {
  border-color: #3182ce;
}

.template-name {
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 6px;
  font-size: 14px;
}

.template-preview {
  font-size: 13px;
  color: #4a5568;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─────────────────────────────────────────
   CALCULATOR
───────────────────────────────────────── */
.calc-total {
  font-size: 36px;
  font-weight: 700;
  color: #63b3ed;
}

.calc-breakdown {
  margin-top: 16px;
  font-size: 13px;
  color: #a0aec0;
}

.calc-breakdown div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #1e2535;
}

.savings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #1e2535;
  font-size: 14px;
}

.savings-amount {
  color: #68d391;
  font-weight: 700;
}

/* ─────────────────────────────────────────
   TOAST
───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a365d;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  border: 1px solid #2c5282;
  max-width: 320px;
}

/* ─────────────────────────────────────────
   GROUPS GRID
───────────────────────────────────────── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ─────────────────────────────────────────
   OPT-OUT LANGUAGE CARD
───────────────────────────────────────── */
.optout-language-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f1117;
  border: 1px solid #1e2535;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.optout-language-text {
  font-size: 14px;
  color: #e2e8f0;
}

/* ─────────────────────────────────────────
   GROUP MEMBER ROWS
───────────────────────────────────────── */
.group-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.group-member-row:hover {
  background: #1a1f2e;
}

.group-member-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  cursor: pointer;
  accent-color: #3182ce;
}

.group-member-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.group-member-name {
  font-size: 14px;
  color: #e2e8f0;
  font-weight: 500;
}

.group-member-detail {
  font-size: 12px;
  color: #4a5568;
}
