/* Gmail-Style Modern Webmail UI Styling */

.mailbox-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-surface);
}

/* Mailbox Top Header */
.mail-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 20px;
}

.mail-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 240px;
  flex-shrink: 0;
}

.mail-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
  text-decoration: none !important;
}

.mail-header-center {
  flex: 1;
  max-width: 720px;
}

.mail-search-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface-alt);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 8px 18px;
  gap: 12px;
  transition: var(--transition);
}

.mail-search-bar:focus-within {
  background-color: var(--bg-surface);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.mail-search-bar input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
}

.mail-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mail Main Container */
.mail-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Mailbox Sidebar / Folders */
.mail-sidebar {
  width: 240px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px 10px;
  gap: 4px;
  flex-shrink: 0;
  overflow-y: auto;
}

.compose-btn-wrapper {
  margin-bottom: 12px;
  padding: 0 6px;
}

.btn-compose {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--primary-subtle);
  color: var(--primary-text);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  width: 100%;
}

.btn-compose:hover {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

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

.folder-item.active {
  background-color: var(--primary-subtle);
  color: var(--primary-text);
  font-weight: 600;
}

.folder-item svg {
  width: 18px;
  height: 18px;
}

.folder-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Mail Content View */
.mail-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-app);
}

/* Mail Toolbar */
.mail-toolbar {
  height: 52px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

/* Message List */
.message-list {
  flex: 1;
  overflow-y: auto;
  background-color: var(--bg-surface);
}

.message-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background-color 0.15s ease;
  user-select: none;
  font-size: 0.9rem;
}

.message-item:hover {
  box-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  background-color: var(--bg-surface-alt);
  z-index: 1;
}

.message-item.unread {
  background-color: var(--bg-surface);
  font-weight: 700;
  color: var(--text-main);
}

.message-item.read {
  background-color: rgba(241, 245, 249, 0.4);
  font-weight: 400;
  color: var(--text-muted);
}

[data-theme="dark"] .message-item.read {
  background-color: rgba(17, 24, 39, 0.6);
}

.msg-checkbox {
  cursor: pointer;
  accent-color: var(--primary);
}

.msg-star {
  cursor: pointer;
  color: var(--text-subtle);
  transition: color 0.15s;
}

.msg-star.starred {
  color: #f59e0b;
}

.msg-sender {
  width: 190px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-subject-snippet {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  gap: 6px;
}

.msg-subject {
  color: var(--text-main);
}

.msg-snippet {
  color: var(--text-subtle);
}

.msg-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

/* Detail Message Pane */
.message-detail-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background-color: var(--bg-surface);
  display: none;
}

.message-detail-view.active {
  display: block;
}

.detail-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.detail-subject {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  line-height: 1.3;
}

.detail-sender-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.detail-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
}

.detail-sender-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

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

.detail-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.detail-body {
  line-height: 1.7;
  color: var(--text-main);
  font-size: 0.95rem;
  margin-bottom: 30px;
  word-break: break-word;
}

.detail-attachments {
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 24px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-right: 8px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .mail-header-left {
    width: auto;
  }
  .mail-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -240px;
    background-color: var(--bg-surface);
    z-index: 100;
    transition: left 0.25s ease;
  }
  .mail-sidebar.mobile-open {
    left: 0;
    box-shadow: var(--shadow-xl);
  }
  .msg-sender {
    width: 120px;
  }
  .msg-snippet {
    display: none;
  }
}

