/* ==========================================================================
   BELTORK MOTO CENTER - WEBMAIL CORPORATIVO (@beltork.com.br)
   Modern Clean Light Theme with Orange Highlights (#FF5500)
   ========================================================================== */

:root {
  --primary: #FF5500;
  --primary-hover: #E04B00;
  --primary-light: #FFF7ED;
  --primary-border: #FED7AA;
  --primary-glow: rgba(255, 85, 0, 0.2);

  --bg-page: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F1F5F9;
  --bg-sidebar: #0F172A;
  --border-color: #E2E8F0;
  --border-dark: #CBD5E1;

  --text-main: #0F172A;
  --text-body: #334155;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --success: #16A34A;
  --danger: #EF4444;
  --warning: #F59E0B;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body.webmail-body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-body);
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

.text-orange { color: var(--primary) !important; }

/* ==========================================================================
   1. PAREDE DE LOGIN
   ========================================================================== */
.email-login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10000;
}

.email-login-card {
  background: #FFFFFF;
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  text-align: center;
  animation: popIn 0.3s ease-out;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-brand .login-logo {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: 0 4px 10px rgba(255, 85, 0, 0.2);
}

.login-brand h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  margin: 6px 0 10px;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 22px;
}

.login-error-alert {
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  color: #DC2626;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: left;
}

.form-group-mail {
  text-align: left;
  margin-bottom: 16px;
}

.form-group-mail label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.input-with-addon input,
.input-with-icon input {
  width: 100%;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1.5px solid var(--border-dark);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  color: var(--text-main);
  transition: all 0.2s;
}

.input-with-addon input:focus,
.input-with-icon input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.btn-toggle-pass {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

.btn-login-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #FF5500 0%, #FF6E00 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 85, 0, 0.3);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.btn-login-submit:hover {
  background: linear-gradient(135deg, #E04B00 0%, #FF5500 100%);
  transform: translateY(-1px);
}

.login-footer-info {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ==========================================================================
   2. LAYOUT DO WEBMAIL
   ========================================================================== */
.email-app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* --- SIDEBAR --- */
.email-sidebar {
  width: 250px;
  background: #FFFFFF;
  border-right: 1.5px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.02);
}

.email-sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-wrap .app-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand-wrap h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
}

.brand-wrap .sub-domain {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  font-family: var(--font-mono);
}

.compose-btn-wrap {
  padding: 18px 16px 12px;
}

.btn-compose {
  width: 100%;
  padding: 12px 18px;
  background: linear-gradient(135deg, #FF5500 0%, #FF6E00 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(255, 85, 0, 0.3);
  transition: all 0.2s;
}

.btn-compose:hover {
  background: linear-gradient(135deg, #E04B00 0%, #FF5500 100%);
  transform: translateY(-1px);
}

.email-folders-nav {
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.folder-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.folder-icon {
  font-size: 1rem;
  width: 18px;
  color: var(--text-muted);
}

.folder-item:hover {
  background: var(--bg-surface-alt);
  color: var(--text-main);
}

.folder-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
}

.folder-item.active .folder-icon {
  color: var(--primary);
}

.folder-badge {
  background: var(--primary);
  color: #FFFFFF;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 800;
}

.sidebar-shortcuts {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-link {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.15s;
}

.shortcut-link:hover {
  color: var(--primary);
}

.email-sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-info strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.btn-logout-mail {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.15s;
}

.btn-logout-mail:hover {
  color: var(--danger);
  background: #FEE2E2;
}

/* --- LISTA DE MENSAGENS --- */
.email-list-panel {
  width: 360px;
  background: #FFFFFF;
  border-right: 1.5px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.email-list-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  background: #FFFFFF;
}

.list-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.list-title-row h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-action {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon-action:hover {
  color: var(--primary);
  border-color: var(--primary-border);
}

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

.search-mail-wrap i.fa-magnifying-glass {
  position: absolute;
  left: 12px;
  color: var(--text-light);
  font-size: 0.85rem;
}

.search-mail-wrap input {
  width: 100%;
  padding: 9px 32px 9px 34px;
  background: var(--bg-surface-alt);
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: var(--font-body);
  color: var(--text-main);
  transition: all 0.2s;
}

.search-mail-wrap input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-clean-search {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  display: none;
}

.email-messages-scroll {
  flex: 1;
  overflow-y: auto;
}

.loading-state,
.empty-folder-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.loading-state p,
.empty-folder-state p {
  margin-top: 10px;
  font-size: 0.88rem;
}

/* Card de Mensagem na Lista */
.email-card-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.email-card-item:hover {
  background: #F8FAFC;
}

.email-card-item.active {
  background: var(--primary-light) !important;
  border-left: 4px solid var(--primary);
}

.email-card-item.unread {
  background: #FFFFFF;
}

.email-card-item.unread .card-sender {
  font-weight: 800;
  color: var(--text-main);
}

.email-card-item.unread .card-subject {
  font-weight: 800;
  color: var(--text-main);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.card-sender {
  font-size: 0.88rem;
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.card-date {
  font-size: 0.72rem;
  color: var(--text-light);
  font-weight: 500;
}

.card-subject {
  font-size: 0.85rem;
  color: var(--text-body);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

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

.card-preview {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 270px;
}

.card-star-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px;
}

.card-star-btn.starred {
  color: #F59E0B;
}

/* --- LEITOR DE E-MAIL --- */
.email-reader-panel {
  flex: 1;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.reader-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.empty-icon-wrap {
  width: 72px;
  height: 72px;
  background: var(--bg-surface-alt);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.reader-empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.reader-empty-state p {
  font-size: 0.9rem;
  max-width: 320px;
}

.reader-content-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.reader-header {
  padding: 24px 30px 20px;
  border-bottom: 1.5px solid var(--border-color);
  background: #FFFFFF;
}

.reader-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.reader-header-top h1 {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  line-height: 1.25;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-action-mail {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-action-mail:hover {
  background: #FFFFFF;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger-action:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #FEE2E2;
}

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

.sender-pill {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sender-avatar {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #FF5500 0%, #FF8800 100%);
  color: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  flex-shrink: 0;
}

.sender-name-wrap strong {
  font-size: 1rem;
  color: var(--text-main);
  margin-right: 6px;
}

.meta-email-tag {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.recipient-line {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 2px;
}

.date-badge {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-surface-alt);
  padding: 4px 10px;
  border-radius: 8px;
}

.reader-body {
  padding: 30px;
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-main);
  background: #FFFFFF;
  word-break: break-word;
}

.reader-quick-reply {
  padding: 20px 30px 30px;
  background: #FFFFFF;
}

.btn-quick-reply {
  width: 100%;
  padding: 14px 20px;
  background: var(--bg-surface-alt);
  border: 1.5px dashed var(--border-dark);
  border-radius: 12px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
}

.btn-quick-reply:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   3. MODAL DE COMPOR NOVO E-MAIL
   ========================================================================== */
.compose-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.compose-modal-dialog {
  background: #FFFFFF;
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: popIn 0.2s ease-out;
  overflow: hidden;
}

.compose-modal-header {
  padding: 16px 22px;
  border-bottom: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-alt);
}

.compose-modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.compose-modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compose-field {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.compose-field label {
  width: 75px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.compose-field input {
  flex: 1;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-main);
  padding: 4px 0;
}

.compose-field input:focus {
  outline: none;
}

.input-readonly {
  background: transparent;
  color: var(--text-muted) !important;
  font-weight: 600;
}

.compose-editor-wrap textarea {
  width: 100%;
  border: none;
  resize: vertical;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
  padding: 8px 0;
}

.compose-editor-wrap textarea:focus {
  outline: none;
}

.compose-modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
}

.btn-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-send {
  padding: 10px 22px;
  background: linear-gradient(135deg, #FF5500 0%, #FF6E00 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(255, 85, 0, 0.3);
  transition: all 0.2s;
}

.btn-send:hover {
  background: linear-gradient(135deg, #E04B00 0%, #FF5500 100%);
  transform: translateY(-1px);
}

/* ==========================================================================
   4. TOASTS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #0F172A;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease-out;
}

.toast-success { border-left: 4px solid #10B981; }
.toast-error { border-left: 4px solid #EF4444; }

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