/**
 * Envelark Webmail Client CSS
 * Desktop 3-to-4 column layout, calm typography, and responsive microinteractions.
 */

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--brand-background);
}

/* 1. Left Navigation Rail */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: #F8F3EC;
  border-right: 1px solid var(--brand-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  user-select: none;
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--brand-border);
}

.sidebar-brand-img {
  height: 32px;
}

.workspace-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--brand-accent);
  background: var(--brand-accent-light);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-muted);
  padding: 0 0.5rem;
  margin-bottom: 0.4rem;
}

.nav-item-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--brand-text);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.nav-item-link:hover {
  background-color: rgba(31, 61, 46, 0.06);
  color: var(--brand-primary);
}

.nav-item-link.active {
  background-color: var(--brand-primary);
  color: #FFFFFF !important;
}

.nav-item-link.active .chip {
  background-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

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

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

/* 2. Message List Column */
.app-message-list {
  width: var(--list-width);
  background-color: #FFFFFF;
  border-right: 1px solid var(--brand-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.list-header {
  height: var(--topbar-height);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--brand-border);
  gap: 0.5rem;
}

.search-input-box {
  position: relative;
  flex: 1;
}

.search-input-box input {
  width: 100%;
  padding: 0.45rem 0.6rem 0.45rem 2rem;
  font-size: 0.85rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  background-color: #FAF7F2;
  outline: none;
}

.search-icon-pos {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand-muted);
}

.list-scroll-area {
  flex: 1;
  overflow-y: auto;
}

.message-row {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--brand-border-subtle);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  text-decoration: none;
  display: block;
  color: inherit;
}

.message-row:hover {
  background-color: #FDFBF8;
}

.message-row.active {
  background-color: #F7F1E8;
  border-left: 3px solid var(--brand-primary);
}

.row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.row-sender {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--brand-primary);
}

.row-time {
  font-size: 0.75rem;
  color: var(--brand-muted);
}

.row-subject {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-text);
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.row-tags {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* 3. Center Reading Pane */
.app-reading-pane {
  flex: 1;
  background-color: #FFFFFF;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane-topbar {
  height: var(--topbar-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--brand-border);
  background-color: #FAF7F2;
}

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

.pane-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
}

.thread-subject-title {
  font-size: 1.75rem;
  font-family: var(--font-heading);
  color: var(--brand-primary);
  margin-bottom: 1.25rem;
  line-height: 1.3;
}

.thread-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--brand-border-subtle);
  margin-bottom: 1.75rem;
}

.sender-badge-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.sender-avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.sender-names {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--brand-primary);
}

.sender-email-date {
  font-size: 0.8rem;
  color: var(--brand-muted);
}

.thread-message-body {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--brand-text);
}

/* Attachments Drawer */
.attachments-tray {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--brand-border-subtle);
}

.tray-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-muted);
  margin-bottom: 0.75rem;
}

.attachment-chip-card {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.9rem;
  background: #FAF7F2;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  margin-right: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

/* 4. Right Intelligence Rail */
.app-intel-rail {
  width: var(--intel-width);
  background-color: #FAF7F2;
  border-left: 1px solid var(--brand-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 1.5rem 1.25rem;
  gap: 1.5rem;
}

.intel-card {
  background: #FFFFFF;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.intel-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.intel-summary-text {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--brand-text);
  margin-bottom: 0.75rem;
}

.intel-action-item {
  font-size: 0.82rem;
  padding: 0.5rem 0.65rem;
  background: var(--brand-background);
  border-radius: var(--radius-xs);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Docked Composer Modal / Drawer */
.composer-dock {
  position: fixed;
  bottom: 0;
  right: 2rem;
  width: 620px;
  background: #FFFFFF;
  border: 1px solid var(--brand-border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-modal);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.composer-dock.open {
  display: flex;
}

.composer-bar {
  background: var(--brand-primary);
  color: #FFFFFF;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
}

.composer-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.composer-field-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--brand-border-subtle);
  padding-bottom: 0.4rem;
}

.composer-field-label {
  width: 70px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand-muted);
}

.composer-field-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.9rem;
  font-family: var(--font-body);
}

.composer-textarea {
  min-height: 180px;
  border: none;
  outline: none;
  font-size: 0.92rem;
  font-family: var(--font-body);
  line-height: 1.6;
  resize: vertical;
}

.elept-suggestion-box {
  background: #FAF6F0;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--brand-border);
  background: #FAF7F2;
}

/* Keyboard Shortcuts Modal */
.shortcuts-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 61, 46, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.shortcuts-modal-overlay.open {
  display: flex;
}

.shortcuts-card {
  width: 520px;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--brand-border);
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--brand-border-subtle);
  font-size: 0.88rem;
}

.key-kbd {
  background: #F4ECE1;
  border: 1px solid #D7C3A5;
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-earth);
}
