/* ============================================================
   PAYSLIP SENDER — Main Stylesheet
   ============================================================ */

/* ── Tokens — APPSN Green Brand ──────────────────────────── */
:root {
  --sidebar-w: 268px;
  --sidebar-w-collapsed: 0px;
  --topnav-h: 64px;

  /* APPSN green palette */
  --color-primary:   #006b3c;   /* APPSN dark green */
  --color-primary-d: #004d2b;   /* darker green */
  --color-primary-l: #e8f5ee;   /* light green tint */
  --color-accent:    #1e8f50;   /* medium green */
  --color-success:   #16a34a;
  --color-danger:    #dc2626;
  --color-warning:   #d97706;
  --color-info:      #0891b2;

  --bg-sidebar:  #003d23;       /* very dark APPSN green */
  --bg-main:     #f0f4f2;       /* slight green tint on background */
  --bg-card:     #ffffff;

  --text-primary:   #0d2b1a;
  --text-secondary: #5a7a64;
  --text-light:     #94a3b8;

  --border:        #d8e8df;
  --border-radius: 12px;
  --shadow-sm:     0 1px 3px rgba(0,60,30,.08), 0 1px 2px rgba(0,60,30,.06);
  --shadow-md:     0 4px 16px rgba(0,60,30,.10);
  --shadow-lg:     0 10px 40px rgba(0,60,30,.14);

  --transition: 220ms cubic-bezier(.4,0,.2,1);
}

/* ── Reset / Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ── LAYOUT ──────────────────────────────────────────────── */

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}
.sidebar.sidebar-collapsed { width: 0; }

/* Main wrapper */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}
.main-wrapper.sidebar-collapsed { margin-left: 0; }

/* ── Sidebar Brand ───────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.brand-icon {
  width: 44px; height: 44px;
  background: #ffffff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  border: 2px solid rgba(255,255,255,.3);
}
.brand-icon img { width: 40px; height: 40px; object-fit: contain; border-radius: 50%; }
.brand-name {
  display: block;
  font-size: .95rem; font-weight: 700;
  color: #fff; line-height: 1.2;
  white-space: nowrap;
}
.brand-sub {
  display: block;
  font-size: .7rem; color: rgba(255,255,255,.45);
  white-space: nowrap;
}

/* ── Sidebar Nav ─────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-section-label {
  font-size: .65rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 8px 10px 4px;
  white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .88rem; font-weight: 500;
  margin-bottom: 2px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, var(--color-primary), rgba(37,99,235,.6));
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.4);
}
.nav-item.nav-item-danger:hover { background: rgba(220,38,38,.2); color: #fca5a5; }
.nav-icon { width: 18px; text-align: center; flex-shrink: 0; }

/* ── Sidebar User ────────────────────────────────────────── */
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--color-primary), #7c3aed);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.user-name { display: block; color: #fff; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.user-role { display: block; color: rgba(255,255,255,.4); font-size: .72rem; white-space: nowrap; }

/* ── Top Nav ─────────────────────────────────────────────── */
.topnav {
  height: var(--topnav-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.btn-toggle-sidebar {
  background: none; border: none; cursor: pointer;
  padding: 8px; border-radius: 8px;
  color: var(--text-secondary); font-size: 1rem;
  transition: background var(--transition);
}
.btn-toggle-sidebar:hover { background: var(--bg-main); color: var(--text-primary); }
.topnav-title { font-weight: 700; font-size: 1.1rem; flex: 1; }
.badge-env {
  font-size: .75rem; color: var(--text-secondary);
  background: var(--bg-main);
  padding: 4px 10px; border-radius: 20px;
  border: 1px solid var(--border);
}

/* ── Page Content ────────────────────────────────────────── */
.page-content { padding: 28px 28px 80px; flex: 1; }

/* ── Cards ───────────────────────────────────────────────── */
.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 0;
  overflow: hidden;
}
.card-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-panel-title { font-size: 1rem; font-weight: 700; margin: 0; }
.card-panel > .table-responsive,
.card-panel > .d-grid { padding: 0; }
.card-panel > .d-grid { padding: 20px; }
.card-panel > .alert,
.card-panel > .row,
.card-panel > form,
.card-panel > div:not(.card-panel-header):not(.table-responsive) { padding: 20px 24px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card {
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex; align-items: center; gap: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }

.stat-card-blue  { background: var(--color-primary-l); border-color: #a3d4b8; }
.stat-card-blue .stat-icon  { background: #c8e8d4; color: var(--color-primary); }
.stat-card-blue .stat-value { color: var(--color-primary); }

.stat-card-green { background: #f0fdf4; border-color: #bbf7d0; }
.stat-card-green .stat-icon  { background: #dcfce7; color: var(--color-success); }
.stat-card-green .stat-value { color: var(--color-success); }

.stat-card-red   { background: #fef2f2; border-color: #fecaca; }
.stat-card-red .stat-icon  { background: #fee2e2; color: var(--color-danger); }
.stat-card-red .stat-value { color: var(--color-danger); }

.stat-card-yellow { background: #fffbeb; border-color: #fde68a; }
.stat-card-yellow .stat-icon  { background: #fef3c7; color: var(--color-warning); }
.stat-card-yellow .stat-value { color: var(--color-warning); }

/* ── Mini Stats (history) ────────────────────────────────── */
.mini-stat {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 20px; text-align: center;
}
.mini-val { font-size: 1.8rem; font-weight: 800; }
.mini-lbl { font-size: .75rem; color: var(--text-secondary); font-weight: 500; }
.mini-green { background: #f0fdf4; border-color: #bbf7d0; }
.mini-green .mini-val { color: var(--color-success); }
.mini-red   { background: #fef2f2; border-color: #fecaca; }
.mini-red .mini-val { color: var(--color-danger); }
.mini-yellow { background: #fffbeb; border-color: #fde68a; }
.mini-yellow .mini-val { color: var(--color-warning); }

/* ── Step Indicator ──────────────────────────────────────── */
.step-indicator {
  display: flex; align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.step {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.step-circle {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  background: var(--border); color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.step.active .step-circle  { background: var(--color-primary); color: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,.2); }
.step.completed .step-circle { background: var(--color-success); color: #fff; }
.step-label { font-size: .85rem; font-weight: 600; color: var(--text-secondary); }
.step.active .step-label, .step.completed .step-label { color: var(--text-primary); }
.step-line {
  flex: 1; height: 2px;
  background: var(--border);
  margin: 0 12px;
}
.step-line.active { background: var(--color-success); }

/* ── Drop Zone ───────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--border-radius);
  background: #f8fafc;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  padding: 60px 20px;
  text-align: center;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--color-primary);
  background: #eff6ff;
}
.drop-zone.drag-over { transform: scale(1.01); }
.drop-icon {
  width: 72px; height: 72px;
  background: #e0e7ff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 2rem; color: var(--color-primary);
}
.drop-zone h4 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }

/* ── File List ───────────────────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px;
  transition: background var(--transition);
}
.file-item.file-error { background: #fef2f2; border-color: #fecaca; }
.file-item-icon { color: #ef4444; font-size: 1.2rem; flex-shrink: 0; }
.file-item-name { flex: 1; font-size: .875rem; font-weight: 500; min-width: 0; }
.file-item-name small { display: block; color: var(--text-secondary); font-size: .75rem; }
.file-item-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); padding: 4px; border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}
.file-item-remove:hover { color: var(--color-danger); background: #fee2e2; }

/* ── Tables ──────────────────────────────────────────────── */
.table thead th {
  background: #f8fafc;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  padding: 12px 16px;
}
.table tbody td { padding: 12px 16px; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }
.row-warning { background: #fffbeb !important; }
.row-warning:hover { background: #fef3c7 !important; }

/* ── Input icon wrappers ─────────────────────────────────── */
.input-icon-wrap { position: relative; }
.input-icon {
  position: absolute; left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light); pointer-events: none;
}
.btn-show-password {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-light); padding: 4px;
}
.btn-show-password:hover { color: var(--text-primary); }

/* ── Action bar (sticky bottom) ──────────────────────────── */
.action-bar-sticky {
  position: fixed; bottom: 0; right: 0;
  left: var(--sidebar-w);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 16px 28px;
  z-index: 40;
  transition: left var(--transition);
  box-shadow: 0 -4px 24px rgba(0,0,0,.07);
}
.sidebar-collapsed ~ .main-wrapper .action-bar-sticky,
.main-wrapper.sidebar-collapsed .action-bar-sticky { left: 0; }

/* ── Send log ────────────────────────────────────────────── */
.send-log {
  max-height: 180px; overflow-y: auto;
  background: #0f172a; border-radius: 8px;
  padding: 12px; font-family: monospace; font-size: .78rem;
}
.send-log .log-sent   { color: #4ade80; }
.send-log .log-failed { color: #f87171; }
.send-log .log-skip   { color: #94a3b8; }

/* ── Email template editor ───────────────────────────────── */
.email-template-preview { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.template-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc; border-bottom: 1px solid var(--border);
}
.font-mono { font-family: 'Courier New', monospace !important; font-size: .8rem !important; }

/* ── Summary grid (send page) ────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.summary-item {
  display: flex; align-items: center; gap: 12px;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
}
.summary-icon { font-size: 1.5rem; flex-shrink: 0; }
.summary-val  { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.summary-lbl  { font-size: .72rem; color: var(--text-secondary); font-weight: 500; }

/* ── SMTP status list ────────────────────────────────────── */
.smtp-status-list { padding: 8px 0; }
.smtp-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.smtp-row:last-child { border-bottom: none; }

/* ── Tips ────────────────────────────────────────────────── */
.tips-list { padding: 8px 0; }
.tip-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.tip-item:last-child { border-bottom: none; }
.tip-item strong { display: block; color: var(--text-primary); margin-bottom: 2px; }
.tip-item span { color: var(--text-secondary); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  padding: 60px 20px; text-align: center;
  color: var(--text-secondary);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; opacity: .3; }
.empty-state p { font-size: .95rem; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 600; }
.btn-lg { padding: 12px 24px; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-d); border-color: var(--color-primary-d); }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
body.login-body { background: #0f172a; min-height: 100vh; }
.login-page {
  display: flex; min-height: 100vh;
}
.login-left {
  flex: 1; background: linear-gradient(160deg, #002a17 0%, #005229 55%, #006b3c 100%);
  display: flex; flex-direction: column; justify-content: center;
  padding: 60px 64px;
}
.login-right {
  width: 480px; flex-shrink: 0;
  background: #f8fafc;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 48px;
}
.login-brand { text-align: center; margin-bottom: 60px; }
.login-brand-icon {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 20px;
  background: #ffffff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.login-brand-icon img { width: 90px; height: 90px; object-fit: contain; }
.login-brand h1 { font-size: 2.2rem; font-weight: 800; color: #fff; }
.login-brand p  { color: rgba(255,255,255,.6); margin: 0; }
.login-features { display: flex; flex-direction: column; gap: 24px; }
.feature-item { display: flex; align-items: flex-start; gap: 16px; }
.feature-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #60a5fa; flex-shrink: 0;
}
.feature-item strong { display: block; color: #fff; font-size: .95rem; margin-bottom: 4px; }
.feature-item span   { color: rgba(255,255,255,.55); font-size: .85rem; }
.login-card { width: 100%; max-width: 380px; }
.login-card-header { margin-bottom: 28px; }
.login-card-header h2 { font-size: 1.8rem; font-weight: 800; color: var(--text-primary); }
.login-card-header p  { color: var(--text-secondary); margin: 0; }
.btn-login {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border: none;
  box-shadow: 0 4px 16px rgba(0,107,60,.35);
  transition: all var(--transition);
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,107,60,.48); }
.login-footer-note {
  margin-top: 20px; font-size: .8rem; color: var(--text-secondary);
  text-align: center; background: #f0f9ff; padding: 12px; border-radius: 8px;
  border: 1px solid #bae6fd;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar { width: 0; }
  .sidebar.mobile-open { width: var(--sidebar-w); }
  .main-wrapper { margin-left: 0 !important; }
  .action-bar-sticky { left: 0 !important; }
  .login-left { display: none; }
  .login-right { width: 100%; }
  .page-content { padding: 16px 16px 80px; }
}

@media (max-width: 576px) {
  .step-label { display: none; }
  .summary-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.5rem; }
}
