/*
 * Component styles — message list, message view, compose, search, settings.
 */

/* Inbox / message list */
.inbox-view {
  max-width: 900px;
}

.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.inbox-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.message-list {
  display: flex;
  flex-direction: column;
}

.message-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: background var(--transition-fast);
  cursor: pointer;
}
.message-row:last-child {
  border-bottom: none;
}
.message-row:hover {
  background: var(--bg-surface-hover);
  text-decoration: none;
}
.message-row.unread {
  color: var(--text-primary);
}
.message-row.unread .msg-from {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.message-row.unread .msg-subject {
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.msg-indicator {
  width: 1.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.unread-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
}

.msg-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.25rem 0;
}
.msg-top-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.msg-bottom-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.msg-from {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-subject {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}
.message-row.unread .msg-subject {
  color: var(--text-secondary);
  font-size: var(--text-xs);
}
.msg-date {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}
.msg-attachment,
.msg-flag {
  flex-shrink: 0;
  font-size: var(--text-xs);
  line-height: 1;
}
.msg-flag {
  color: var(--color-warning);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}
.empty-title {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}
.empty-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

/* Message view */
.message-view {
  max-width: 960px;
}

.message-back {
  margin-bottom: 0.75rem;
}
.message-back .btn {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}
.message-back .btn:hover {
  color: var(--text-primary);
}

.message-header {
  margin-bottom: 1.25rem;
}
.message-subject {
  font-size: var(--text-xl);
  margin-bottom: 0.75rem;
}

.message-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.meta-row {
  display: flex;
  gap: 0.5rem;
  font-size: var(--text-sm);
}
.meta-label {
  color: var(--text-tertiary);
  width: 3rem;
  flex-shrink: 0;
}
.meta-value {
  color: var(--text-secondary);
}

.message-actions {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.message-body {
  min-height: 200px;
}
.message-iframe {
  width: 100%;
  min-height: 300px;
  border: none;
  background: #ffffff;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: height 0.15s ease;
}
.message-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-primary);
}

.message-attachments {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}
.attachments-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  margin-right: 0.375rem;
  margin-bottom: 0.375rem;
}
.attachment-item:hover {
  background: var(--bg-surface-hover);
  text-decoration: none;
}
.attachment-size {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

/* Compose */
.compose-view {
  max-width: 700px;
}
.compose-header {
  margin-bottom: 1.25rem;
}
.compose-form .form-field {
  margin-bottom: 0.75rem;
}
.compose-editor textarea {
  min-height: 300px;
  resize: vertical;
  font-family: var(--font-sans);
}
.inline-fields {
  display: flex;
  gap: 0.75rem;
}
.field-half {
  flex: 1;
}

.compose-attachments {
  margin-top: 0.5rem;
}
.attachment-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border: 2px dashed var(--border-input);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}
.attachment-drop:hover,
.attachment-drop.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.attachment-drop input[type="file"] {
  display: none;
}
.attachment-list {
  list-style: none;
  margin-top: 0.5rem;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.attachment-list li {
  padding: 0.25rem 0;
}

.compose-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Search */
.search-view {
  max-width: 900px;
}
.search-header {
  margin-bottom: 1.25rem;
}
.search-form {
  display: flex;
  gap: 0.5rem;
}
.search-input {
  flex: 1;
}

/* Settings */
.settings-view {
  max-width: 600px;
}
.settings-header {
  margin-bottom: 1.5rem;
}
.settings-section {
  margin-bottom: 2rem;
}
.settings-section h3 {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: var(--text-sm);
}
.settings-label {
  color: var(--text-secondary);
}
.settings-value {
  color: var(--text-primary);
}
.settings-value select {
  width: auto;
  padding: 0.25rem 0.5rem;
  font-size: var(--text-sm);
}

/* Add account */
.add-account-view {
  max-width: 500px;
}
