/* =============================================
   RemindMail — Core Styles
   Dark luxury theme with red accents
   ============================================= */

:root {
  --bg-primary:    #0d0d14;
  --bg-secondary:  #13131f;
  --bg-card:       #1a1a2e;
  --bg-hover:      #1f1f35;
  --bg-input:      #111120;

  --accent:        #e94560;
  --accent-hover:  #ff2d55;
  --accent-soft:   rgba(233, 69, 96, 0.12);
  --accent-border: rgba(233, 69, 96, 0.3);

  --text-primary:  #f0f4ff;
  --text-secondary: #8892a4;
  --text-muted:    #4a5568;

  --border:        rgba(255,255,255,0.07);
  --border-hover:  rgba(255,255,255,0.14);

  --green:  #00d68f;
  --green-soft: rgba(0, 214, 143, 0.12);
  --blue:   #4d9ef5;
  --blue-soft: rgba(77, 158, 245, 0.12);
  --orange: #ff8c00;
  --orange-soft: rgba(255, 140, 0, 0.12);
  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, 0.12);
  --red:    #e94560;
  --red-soft: rgba(233, 69, 96, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.5);

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --transition: 0.2s ease;
  --sidebar-w: 240px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}
.btn::after {
  content:'';
  position:absolute;
  inset:0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.06); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(233,69,96,0.35);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(233,69,96,0.5);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  border-color: var(--border-hover);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--accent-border);
  color: var(--text-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 10px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-danger {
  background: var(--red-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}
.btn-danger:hover { background: var(--accent); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---- Forms ---- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.required { color: var(--accent); }

.form-group input,
.form-group textarea,
.form-group select {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }
.form-group textarea { resize: vertical; min-height: 100px; }
select { cursor: pointer; }
select option { background: var(--bg-card); }

.form-row { margin-bottom: 18px; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:540px) { .form-row.two-col { grid-template-columns: 1fr; } }

.field-error {
  font-size: 12px;
  color: var(--accent);
  min-height: 16px;
  display: block;
}

.form-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--blue-soft);
  border: 1px solid rgba(77,158,245,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--blue);
  font-size: 12.5px;
  margin-top: 4px;
}

/* ---- Alerts ---- */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: var(--green-soft); border-color: rgba(0,214,143,0.3); color: var(--green); }
.alert-error   { background: var(--red-soft); border-color: var(--accent-border); color: var(--accent); }
.alert.hidden  { display: none !important; }

/* ---- Card ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}
.card-action {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition);
}
.card-action:hover { color: var(--accent-hover); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 14px 20px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ---- Status badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-active  { background: var(--green-soft); color: var(--green); }
.badge-inactive{ background: var(--bg-hover); color: var(--text-muted); }
.badge-completed{ background: var(--purple-soft); color: var(--purple); }
.badge-sent    { background: var(--green-soft); color: var(--green); }
.badge-failed  { background: var(--red-soft); color: var(--accent); }
.badge-info    { background: var(--blue-soft); color: var(--blue); }
.badge-warning { background: var(--orange-soft); color: var(--orange); }
.badge-error   { background: var(--red-soft); color: var(--accent); }

/* ---- Loading / empty ---- */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  padding: 40px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 40px; opacity: 0.4; }
.empty-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text-secondary); }
.empty-text  { font-size: 14px; text-align: center; }

/* ---- Toast notifications ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  max-width: 340px;
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.toast.toast-out { animation: toastOut 0.25s ease forwards; }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg { font-size: 14px; color: var(--text-primary); }
.toast-success .toast-icon::before { content: '✓'; color: var(--green); }
.toast-error   .toast-icon::before { content: '✕'; color: var(--accent); }
.toast-info    .toast-icon::before { content: 'ℹ'; color: var(--blue); }
@keyframes toastIn   { from { opacity:0; transform: translateX(20px) scale(0.96); } to { opacity:1; transform: none; } }
@keyframes toastOut  { to   { opacity:0; transform: translateX(20px) scale(0.96); } }

/* ---- Toggle switch ---- */
.toggle-switch {
  position: relative;
  width: 38px;
  height: 22px;
  cursor: pointer;
  display: inline-block;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  transition: all var(--transition);
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition);
}
.toggle-switch input:checked + .toggle-track {
  background: var(--green-soft);
  border-color: rgba(0,214,143,0.4);
}
.toggle-switch input:checked + .toggle-track::after {
  left: calc(100% - 17px);
  background: var(--green);
}

/* ---- Input with icon ---- */
.input-wrapper {
  position: relative;
}
.input-wrapper .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-wrapper input { padding-left: 40px; }
.toggle-pwd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
}
.toggle-pwd:hover { color: var(--text-primary); }

/* ---- Loader in button ---- */
.btn-loader {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.btn-loader.hidden { display: none; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-backdrop.active { opacity: 1; pointer-events: all; }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.97);
  z-index: 900;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 92%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
.modal.active {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}
.modal-close {
  background: var(--bg-hover);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--accent-soft); color: var(--accent); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 28px 24px;
}

/* ---- Toolbar ---- */
.card-toolbar {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 180px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 14px;
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.filter-select {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 9px 14px;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }

/* ---- Action buttons in table ---- */
.actions { display: flex; gap: 6px; align-items: center; }
.action-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.action-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }
.action-btn.edit:hover  { color: var(--blue); border-color: rgba(77,158,245,0.3); }
.action-btn.delete:hover{ color: var(--accent); border-color: var(--accent-border); }

/* ---- Responsive scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Utility */
.hidden { display: none !important; }
.text-primary { color: var(--text-primary) !important; }
.text-success { color: var(--green) !important; }
.text-danger  { color: var(--accent) !important; }
.text-muted   { color: var(--text-muted) !important; }
