/* Gmail-style layout: left sidebar + list + detail */

.contact-gmail-layout {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 72px);
  margin: -8px -12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}

.contact-sidebar {
  width: 272px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 8px 16px;
  background: #12141a;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.contact-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 16px;
  color: var(--text);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.contact-sidebar-brand .material-symbols-outlined {
  font-size: 28px;
  color: var(--accent);
}

.contact-compose-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;
  min-width: 128px;
  margin: 0 8px 12px;
  padding: 14px 24px;
  border: none;
  border-radius: 24px;
  background: #2d3848;
  color: #e8eaed;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: background 0.15s, box-shadow 0.15s;
}
.contact-compose-btn:hover {
  background: #3a4759;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.contact-compose-btn .material-symbols-outlined { font-size: 20px; }

.contact-sidebar-mailbox {
  padding: 0 8px 12px;
}
.contact-sidebar-mailbox select {
  width: 100%;
  font-size: 12px;
}

.contact-side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 4px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.contact-side-nav-secondary {
  flex: 0;
  padding-top: 4px;
}

.contact-side-divider {
  height: 1px;
  margin: 8px 12px;
  background: var(--border);
}

.contact-side-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 0 20px 20px 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.contact-side-item .material-symbols-outlined {
  font-size: 20px;
  width: 20px;
  flex-shrink: 0;
}
.contact-side-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-side-item:hover,
a.contact-side-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
}
.contact-side-item.active {
  background: rgba(var(--accent-rgb), 0.22);
  color: #fff;
  font-weight: 600;
}

.contact-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}

.contact-main-single {
  flex: 1;
  padding: 24px;
  overflow: auto;
}

.contact-inbox-columns {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.contact-list-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-height: 0;
  overflow: hidden;
}

.contact-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.contact-list-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.contact-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.contact-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.contact-mail-list {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.contact-mail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.contact-mail-row:hover { background: rgba(255, 255, 255, 0.04); }
.contact-mail-row.active {
  background: rgba(var(--accent-rgb), 0.12);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}
.contact-mail-row.unread .contact-mail-subject { font-weight: 700; }
.contact-mail-row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.contact-mail-from {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.contact-mail-row.unread .contact-mail-from { font-weight: 600; }
.contact-mail-subject {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-mail-snippet {
  font-size: 12px;
  color: var(--muted-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-mail-date {
  font-size: 11px;
  color: var(--muted-dim);
  flex-shrink: 0;
}

.contact-detail-panel {
  padding: 20px 24px;
  overflow: auto;
  min-height: 0;
}
.contact-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  margin: 0;
}

.contact-detail-head h2 { margin: 0 0 8px; font-size: 1.2rem; }
.contact-detail-actions { display: flex; gap: 8px; margin: 14px 0; }
.contact-mail-text {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.65;
  margin: 0;
}
.contact-mail-html { font-size: 14px; line-height: 1.65; }

.contact-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.contact-modal.hidden { display: none; }
.contact-modal-card {
  width: min(560px, 100%);
  padding: 20px;
}

.contact-settings-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.contact-settings-list { display: grid; gap: 10px; }
.contact-settings-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px;
}
.contact-settings-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-editor { margin-top: 16px; padding: 18px; }
.contact-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.contact-loading { padding: 40px; text-align: center; color: var(--muted); }
.contact-empty { padding: 28px; }
.danger-text { color: var(--danger); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 1100px) {
  .contact-inbox-columns {
    grid-template-columns: 1fr;
  }
  .contact-detail-panel {
    display: none;
  }
  .contact-inbox-columns.contact-show-detail .contact-list-panel {
    display: none;
  }
  .contact-inbox-columns.contact-show-detail .contact-detail-panel {
    display: block;
  }
}

@media (max-width: 768px) {
  .contact-gmail-layout {
    flex-direction: column;
    min-height: auto;
  }
  .contact-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 280px;
  }
  .contact-side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 0;
  }
  .contact-side-item {
    width: auto;
    border-radius: 20px;
    padding: 8px 12px;
  }
}
