/* cazz_mail - dark UI */

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

:root {
  --bg:        #0d0d0f;
  --surface:   #18181b;
  --surface-2: #111827;
  --border:    #2a2a30;
  --accent:    #4f8ef7;
  --accent-h:  #3a78e0;
  --accent-soft: rgba(79, 142, 247, 0.16);
  --danger:    #e05252;
  --danger-h:  #c93c3c;
  --success:   #52c97a;
  --text:      #e4e4e7;
  --muted:     #71717a;
  --radius:    8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 24px;
}

.navbar .brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  padding: 4px;
  max-width: max-content;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-tab {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  transform: translateY(-1px);
}

.nav-tab.active {
  background: linear-gradient(180deg, rgba(79, 142, 247, 0.3), rgba(79, 142, 247, 0.16));
  color: #dbeafe;
  border-color: rgba(79, 142, 247, 0.28);
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 8px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff2d2d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px rgba(255, 45, 45, 0.12), 0 8px 16px rgba(255, 45, 45, 0.18);
}

.navbar .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.navbar .user-pill {
  background: var(--border);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 13px;
  color: var(--muted);
}

/* ── Page wrapper ── */
.page {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.card h1, .card h2 {
  margin-bottom: 24px;
  font-weight: 600;
}

/* ── Login ── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  text-align: center;
}

.login-card .logo {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-card .subtitle {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 14px;
}

.login-card .form-group,
.login-card .remember-row {
  text-align: left;
}

/* ── Forms ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  width: 100%;
}

input:focus {
  border-color: rgba(79, 142, 247, 0.9);
  box-shadow: 0 0 0 4px rgba(79, 142, 247, 0.12);
  background: #111217;
}

/* ── Remember me ── */
.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.remember-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.remember-row label {
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  margin: 0;
}

/* ── Password input with eye icon ── */
.pw-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-input-wrap input {
  padding-right: 56px;
}

.eye-btn {
  position: absolute;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.eye-btn:hover {
  color: #dbeafe;
  background: linear-gradient(180deg, rgba(79, 142, 247, 0.18), rgba(79, 142, 247, 0.08));
  border-color: rgba(79, 142, 247, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(79, 142, 247, 0.12);
}

.eye-btn:focus-visible {
  outline: none;
  border-color: rgba(79, 142, 247, 0.42);
  box-shadow: 0 0 0 4px rgba(79, 142, 247, 0.16);
}

.eye-btn:active {
  transform: translateY(0);
}

.eye-icon {
  width: 18px;
  height: 18px;
}

/* ── Password field in table (with eye) ── */
.pw-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pw-field .eye-btn {
  position: static;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.pw-field .pw-mask,
.pw-field .pw-plain {
  min-width: 88px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s, opacity 0.15s, transform 0.18s, box-shadow 0.18s;
}

.btn-primary {
  background: linear-gradient(180deg, #5ea0ff, #3d7ff0);
  color: #fff;
  width: 100%;
  box-shadow: 0 12px 26px rgba(61, 127, 240, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #6aabff, #4787f1);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(180deg, #ec6767, #d14848);
  color: #fff;
  box-shadow: 0 10px 22px rgba(224, 82, 82, 0.18);
}

.btn-danger:hover {
  background: linear-gradient(180deg, #f17373, #db5252);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(79, 142, 247, 0.2);
  transform: translateY(-1px);
}

.btn-mail {
  background: linear-gradient(180deg, rgba(79, 142, 247, 0.18), rgba(79, 142, 247, 0.08));
  border-color: rgba(79, 142, 247, 0.2);
  color: #dbeafe;
}

.btn-mail:hover {
  background: linear-gradient(180deg, rgba(79, 142, 247, 0.26), rgba(79, 142, 247, 0.14));
}

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

/* ── Alerts ── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(224, 82, 82, 0.15);
  border: 1px solid var(--danger);
  color: #f87171;
}

.alert-success {
  background: rgba(82, 201, 122, 0.12);
  border: 1px solid var(--success);
  color: #6ee7a0;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child td { border-bottom: none; }

.msg-row {
  cursor: pointer;
  transition: background 0.1s;
}

.msg-row:hover { background: rgba(255,255,255,0.04); }

.msg-row td:nth-child(2) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-row-unread td {
  font-weight: 600;
}

.mail-unread-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ff2d2d;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 10px 18px rgba(255, 45, 45, 0.22);
}

/* ── Section header row ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 { margin-bottom: 0; }

/* ── Create account form inline ── */
.create-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.create-form .form-group { margin-bottom: 0; }

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* ── Email compose (username + @domain) ── */
.email-compose {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.email-compose input {
  border: none;
  border-radius: 0;
  flex: 1;
  background: transparent;
  min-width: 0;
}

.email-compose input:focus {
  border: none;
  outline: none;
}

.email-domain {
  color: var(--muted);
  font-size: 13px;
  padding: 0 10px;
  white-space: nowrap;
  border-left: 1px solid var(--border);
  height: 40px;
  display: flex;
  align-items: center;
}

/* ── Message view ── */
.msg-meta {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px 12px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--muted);
}

.msg-meta span { color: var(--text); }

.msg-body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-body a {
  color: #7cc4ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.msg-body a:hover {
  color: #a8d8ff;
}

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(79, 142, 247, 0.2);
  color: var(--accent);
}

/* ── Divider ── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
