/* ============================================
   AW Admin Dashboard Styles
   ============================================ */

:root {
  --navy: #0d1b2e;
  --navy-mid: #1a2f4a;
  --navy-light: #243d5c;
  --accent: #f5a623;
  --accent-dark: #d4891a;
  --white: #ffffff;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --sidebar-bg: #0d1b2e;
  --light-grey: #e8ecf0;
  --mid-grey: #8a96a3;
  --dark-grey: #4a5568;
  --text: #2d3748;
  --green: #38a169;
  --amber: #d69e2e;
  --red: #e53e3e;
  --blue: #3182ce;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: inherit; text-decoration: none; }

/* ---- LOGIN OVERLAY ---- */
.login-overlay {
  position: fixed; inset: 0;
  background: rgba(13,27,46,0.97);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.login-logo {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
}
.login-logo .logo-mark {
  width: 48px; height: 48px;
  background: var(--accent);
  color: var(--navy);
  font-weight: 900; font-size: 1rem;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo .logo-title { font-weight: 800; font-size: 1rem; color: var(--navy); }
.login-logo .logo-sub { font-size: 0.78rem; color: var(--mid-grey); }
.login-card h2 { font-size: 1.5rem; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.login-card p { color: var(--mid-grey); font-size: 0.9rem; margin-bottom: 24px; }

/* ---- LAYOUT ---- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 240px;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 50;
  transition: var(--transition);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 0;
  margin-bottom: 24px;
}
.logo-mark {
  width: 40px; height: 40px;
  background: var(--accent); color: var(--navy);
  font-weight: 900; font-size: 0.9rem;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark.sm { width: 36px; height: 36px; font-size: 0.8rem; }
.logo-title { color: var(--white); font-size: 0.85rem; font-weight: 700; line-height: 1.2; }
.logo-sub { color: rgba(255,255,255,0.45); font-size: 0.72rem; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.nav-item i { width: 18px; text-align: center; font-size: 0.9rem; }
.nav-item:hover { color: var(--white); background: rgba(255,255,255,0.07); }
.nav-item.active { color: var(--navy); background: var(--accent); font-weight: 600; }
.nav-item.active i { color: var(--navy); }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 8px;
  color: rgba(255,255,255,0.5); font-size: 0.85rem;
  background: none; border: none; cursor: pointer; font-family: inherit;
  transition: var(--transition);
}
.sidebar-link:hover { color: var(--white); background: rgba(255,255,255,0.07); }
.logout-btn { color: rgba(229,62,62,0.7); }
.logout-btn:hover { color: #fc8181; background: rgba(229,62,62,0.1); }

.admin-main { margin-left: 240px; min-height: 100vh; }
.admin-header {
  background: var(--white);
  border-bottom: 1px solid var(--light-grey);
  padding: 0 28px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
  box-shadow: var(--shadow);
}
.admin-header-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--dark-grey); padding: 6px; display: none; }
.page-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.admin-user { display: flex; align-items: center; gap: 8px; color: var(--mid-grey); font-size: 0.88rem; }
.admin-user i { color: var(--accent); font-size: 1.1rem; }

/* ---- PANELS ---- */
.panel { display: none; padding: 32px 28px; }
.panel.active { display: block; }
.panel-header { margin-bottom: 28px; }
.panel-header h1 { font-size: 1.6rem; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.panel-header p { color: var(--mid-grey); font-size: 0.9rem; }

/* ---- STATS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-icon {
  width: 48px; height: 48px;
  background: rgba(13,27,46,0.08);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: var(--navy);
  margin: 0 auto 12px;
}
.stat-icon.green { background: rgba(56,161,105,0.12); color: var(--green); }
.stat-icon.amber { background: rgba(214,158,46,0.12); color: var(--amber); }
.stat-icon.red { background: rgba(229,62,62,0.1); color: var(--red); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--navy); }
.stat-label { font-size: 0.82rem; color: var(--mid-grey); font-weight: 500; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.dash-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--navy); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.dash-card h3 i { color: var(--accent); }
.recent-list { display: flex; flex-direction: column; gap: 10px; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--light-grey); }
.recent-item:last-child { border-bottom: none; }
.recent-avatar {
  width: 36px; height: 36px;
  background: var(--navy-mid);
  color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}
.recent-name { font-weight: 600; font-size: 0.88rem; color: var(--navy); }
.recent-sub { font-size: 0.78rem; color: var(--mid-grey); }
.tags-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip { background: rgba(13,27,46,0.07); color: var(--navy); padding: 4px 12px; border-radius: 50px; font-size: 0.78rem; font-weight: 600; }

/* ---- TABLE ---- */
.table-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-box {
  flex: 1; min-width: 200px;
  display: flex; align-items: center; gap: 10px;
  background: var(--white); border: 2px solid var(--light-grey);
  border-radius: var(--radius); padding: 8px 14px;
}
.search-box i { color: var(--mid-grey); }
.search-box input { border: none; outline: none; font-family: inherit; font-size: 0.88rem; flex: 1; background: transparent; }
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-group select {
  border: 2px solid var(--light-grey); border-radius: 8px;
  padding: 8px 12px; font-family: inherit; font-size: 0.85rem;
  background: var(--white); cursor: pointer; outline: none;
  color: var(--text);
}
.table-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table thead { background: var(--navy); color: var(--white); }
.data-table th { padding: 14px 16px; text-align: left; font-weight: 600; font-size: 0.8rem; letter-spacing: 0.04em; white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--light-grey); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(245,166,35,0.04); }
.table-loading { text-align: center; color: var(--mid-grey); padding: 32px !important; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 50px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge-green { background: rgba(56,161,105,0.12); color: #276749; }
.badge-red { background: rgba(229,62,62,0.1); color: #c53030; }
.badge-grey { background: rgba(138,150,163,0.15); color: #4a5568; }
.badge-amber { background: rgba(214,158,46,0.12); color: #975a16; }
.badge-blue { background: rgba(49,130,206,0.1); color: #2c5282; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-sm { background: rgba(13,27,46,0.07); color: var(--navy); padding: 2px 8px; border-radius: 50px; font-size: 0.7rem; font-weight: 600; }
.pagination { display: flex; gap: 6px; padding: 16px; justify-content: center; }
.page-btn { padding: 6px 12px; border-radius: 6px; border: 2px solid var(--light-grey); background: var(--white); cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--navy); transition: var(--transition); }
.page-btn.active, .page-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--navy); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 22px; border-radius: 50px;
  font-weight: 600; font-size: 0.88rem;
  cursor: pointer; transition: var(--transition);
  border: 2px solid transparent; font-family: inherit;
}
.btn-primary { background: var(--accent); color: var(--navy); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-outline { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: var(--white); }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.mt-8 { margin-top: 8px; }

/* ---- ADMIN FORMS ---- */
.admin-form { max-width: 700px; display: flex; flex-direction: column; gap: 0; }
.form-section {
  background: var(--white); border-radius: var(--radius);
  padding: 28px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.form-section h3 { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.form-section h3 i { color: var(--accent); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 0.83rem; font-weight: 600; color: var(--navy); }
.form-group input,
.form-group textarea,
.form-group select {
  border: 2px solid var(--light-grey); border-radius: 8px;
  padding: 10px 14px; font-family: inherit; font-size: 0.9rem;
  color: var(--text); transition: var(--transition); background: var(--bg);
  outline: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent); background: var(--white);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.15);
}
.form-group textarea { resize: vertical; }
.consent-boxes { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.consent-label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.consent-label input[type=checkbox] { margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.consent-label strong { display: block; font-size: 0.88rem; color: var(--navy); margin-bottom: 2px; }
.consent-label span { font-size: 0.82rem; color: var(--dark-grey); line-height: 1.5; }
.consent-note { font-size: 0.78rem; color: var(--mid-grey); display: flex; align-items: flex-start; gap: 6px; }
.consent-note i { color: var(--blue); margin-top: 2px; }

.form-result {
  padding: 10px 16px; border-radius: 8px; font-size: 0.88rem; font-weight: 500; display: none; margin-top: 12px;
}
.form-result.success { background: rgba(56,161,105,0.1); color: #276749; border: 1px solid rgba(56,161,105,0.2); display: block; }
.form-result.error { background: rgba(229,62,62,0.1); color: #c53030; border: 1px solid rgba(229,62,62,0.2); display: block; }

/* ---- SMS ---- */
.sms-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: start; }
.admin-form-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.admin-form-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--navy); margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.admin-form-card h3 i { color: var(--accent); }
.char-count { float: right; font-size: 0.78rem; color: var(--mid-grey); font-weight: 400; }
.sms-hint { font-size: 0.78rem; color: var(--mid-grey); margin-top: 6px; display: flex; align-items: flex-start; gap: 6px; }
.sms-hint i { color: var(--blue); margin-top: 1px; }
.sms-hint code { background: rgba(13,27,46,0.07); padding: 1px 6px; border-radius: 4px; font-size: 0.78rem; }
.sms-preview-area { margin: 16px 0; }
.preview-phone {
  background: #1c1c1e; border-radius: 16px; padding: 20px 16px;
  min-height: 80px; display: flex; align-items: flex-end;
}
.preview-bubble {
  background: #3a3a3c; color: var(--white);
  border-radius: 14px 14px 14px 2px;
  padding: 12px 16px; font-size: 0.85rem; line-height: 1.55;
  max-width: 80%; white-space: pre-wrap;
}
.sms-actions { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.compliance-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.compliance-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.83rem; color: var(--dark-grey); line-height: 1.5; }
.compliance-list i { margin-top: 2px; flex-shrink: 0; }
.compliance-list .fa-check-circle { color: var(--green); }
.compliance-list .amber { color: var(--amber); }
.text-muted { color: var(--mid-grey); font-size: 0.85rem; }
.input-sm { width: 100%; border: 2px solid var(--light-grey); border-radius: 8px; padding: 8px 12px; font-family: inherit; font-size: 0.88rem; outline: none; }
.input-sm:focus { border-color: var(--accent); }
.recipient-count-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(56,161,105,0.1); color: var(--green); font-weight: 700; font-size: 1.4rem; padding: 12px 20px; border-radius: var(--radius); margin-bottom: 12px; }
.optout-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--light-grey); font-size: 0.85rem; }
.optout-item:last-child { border-bottom: none; }
.optout-num { font-weight: 600; color: var(--navy); }
.campaigns-list { display: flex; flex-direction: column; gap: 16px; }
.campaign-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.campaign-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.campaign-name { font-weight: 700; font-size: 1rem; color: var(--navy); }
.campaign-meta { display: flex; gap: 16px; font-size: 0.82rem; color: var(--mid-grey); margin-bottom: 10px; }
.campaign-body { background: var(--bg); border-radius: 8px; padding: 12px 16px; font-size: 0.88rem; color: var(--dark-grey); white-space: pre-wrap; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--mid-grey); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(13,27,46,0.6);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white); border-radius: 20px;
  max-width: 600px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(20px); transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--light-grey);
  position: sticky; top: 0; background: var(--white); z-index: 1;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--mid-grey); padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--light-grey); }
.modal-body { padding: 24px; }
.modal-field { margin-bottom: 14px; }
.modal-field-label { font-size: 0.78rem; font-weight: 700; color: var(--mid-grey); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.modal-field-value { font-size: 0.93rem; color: var(--text); }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--light-grey); }
.modal-edit-area { margin-top: 16px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .sms-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-240px); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .form-row-2 { grid-template-columns: 1fr; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .search-box { min-width: unset; }
}
