/* BKMVPS Webmail Portal Styling — Gmail/Titan aesthetic in high-performance dark mode */
:root {
  --bg-base: #060913;
  --bg-surface: #0a0f1d;
  --bg-card: #0f172a;
  --bg-hover: #1e293b;
  --border: #1e293b;
  --border-light: #334155;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.35);
  --accent-hover: #2563eb;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --danger: #ef4444;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

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

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-main);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ----------------- Login Screen ----------------- */
.webmail-auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% 20%, rgba(37, 99, 235, 0.12) 0%, transparent 60%),
              radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
              var(--bg-base);
}

.webmail-auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 20px;
  padding: 2.4rem;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7),
              0 0 35px -5px rgba(59, 130, 246, 0.2);
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #93c5fd;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  margin-bottom: 0.4rem;
}

.auth-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.2rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input {
  width: 100%;
  background: rgba(6, 10, 20, 0.8);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  color: #fff;
  transition: all 0.2s ease;
  font-family: inherit;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(10, 15, 29, 0.95);
}

.input-toggle-btn {
  position: absolute;
  right: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  font-size: 0.9rem;
}

.btn-primary {
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 8px 25px -5px rgba(37, 99, 235, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px -5px rgba(37, 99, 235, 0.7);
}

.auth-footer {
  margin-top: 1.6rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.alert-box {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.84rem;
  margin-bottom: 1.2rem;
  display: none;
}
.alert-box.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

/* ----------------- Webmail App Layout ----------------- */
.webmail-app {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: var(--bg-base);
}

/* Sidebar */
.webmail-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.2rem 1.2rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.mailbox-chip {
  margin-top: 0.9rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mailbox-address-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #93c5fd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.chip-copy-btn {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  padding: 0.2rem 0.45rem;
  border-radius: 5px;
  font-size: 0.72rem;
  cursor: pointer;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.8rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: #fff;
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  font-weight: 700;
}

.nav-item-icon {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-badge {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.nav-badge.otp {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.sidebar-footer {
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: 7px;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Mail List Column */
.webmail-list-pane {
  width: 380px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.list-topbar {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(6, 10, 20, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  gap: 0.5rem;
}

.search-input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.85rem;
  width: 100%;
}

.list-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.live-pulse {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #34d399;
  font-weight: 600;
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.mail-items-container {
  flex: 1;
  overflow-y: auto;
}

.mail-card {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
}

.mail-card:hover {
  background: var(--bg-hover);
}

.mail-card.active {
  background: rgba(59, 130, 246, 0.14);
  border-left: 3px solid var(--accent);
}

.mail-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.sender-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.mail-time {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.mail-subject {
  font-size: 0.84rem;
  font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.35rem;
}

.mail-snippet {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.otp-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #34d399;
  margin-top: 0.45rem;
}

/* Reading Pane */
.webmail-view-pane {
  flex: 1;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-pane-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  text-align: center;
  padding: 2rem;
}

.view-header {
  padding: 1.4rem 1.8rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.view-subject {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.8rem;
  line-height: 1.3;
}

.view-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sender-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sender-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.sender-details {
  display: flex;
  flex-direction: column;
}

.sender-email-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f8fafc;
}

.recipient-line {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-icon-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.action-icon-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
  border-color: var(--accent);
}

.action-icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: var(--danger);
}

/* OTP Hero Banner */
.otp-hero-banner {
  margin: 1.2rem 1.8rem 0;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 78, 59, 0.2) 100%);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 12px;
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 25px -10px rgba(16, 185, 129, 0.3);
}

.otp-hero-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.otp-hero-code {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #34d399;
}

.otp-hero-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #a7f3d0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.view-body-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.8rem;
}

.mail-iframe-wrap {
  width: 100%;
  height: 100%;
  min-height: 500px;
  border: none;
  background: #ffffff;
  border-radius: 10px;
}

.view-plaintext {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Responsive */
@media (max-width: 900px) {
  .webmail-sidebar {
    width: 70px;
  }
  .webmail-sidebar .nav-text,
  .webmail-sidebar .mailbox-chip,
  .webmail-sidebar .sidebar-footer {
    display: none;
  }
  .webmail-list-pane {
    width: 300px;
  }
}
