/* --- GMAIL MODULE STYLES FOR SUPERADMIN --- */
.gmail-container {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: calc(100vh - 140px);
  background: #0f172a;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #1e293b;
  color: #f8fafc;
  box-sizing: border-box;
  overflow: hidden;
}

.gmail-sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid #1e293b;
  padding-right: 16px;
  max-height: calc(100vh - 172px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.gmail-btn-compose {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  border-radius: 28px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

.gmail-btn-compose:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.gmail-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gmail-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  transition: background 0.15s ease, color 0.15s ease;
}

.gmail-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
}

.gmail-nav-item.active {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  font-weight: 700;
}

.gmail-nav-label {
  flex: 1;
}

.gmail-badge {
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.gmail-main {
  flex: 1;
  width: 0;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  container-type: inline-size;
}

.gmail-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #1e293b;
  min-width: 0;
  gap: 12px;
}

.gmail-toolbar #gmailRefreshBtn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.gmail-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  padding: 8px 14px;
  border-radius: 24px;
  width: min(360px, 100%);
  min-width: 0;
  box-sizing: border-box;
}

.gmail-search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  width: 100%;
  font-size: 13px;
}

.gmail-email-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 220px);
  background: #0f172a;
  border: 1px solid #26354a;
  border-radius: 6px;
}

.gmail-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.gmail-item {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 24px 9px 36px minmax(0, 1fr) minmax(104px, 132px);
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 76px;
  padding: 10px 14px;
  background: #0f172a;
  border: 0;
  border-bottom: 1px solid #26354a;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
  overflow: hidden;
}

.gmail-item:last-child {
  border-bottom: 0;
}

.gmail-item:hover {
  background: #192438;
  box-shadow: inset 3px 0 #3b82f6;
}

.gmail-item.active {
  background: #1c2940;
  box-shadow: inset 3px 0 #60a5fa;
}

.gmail-item.unread {
  font-weight: 700;
  background: #172033;
}

.gmail-item.read {
  background: #0f172a;
}

.gmail-item.read .gmail-item-sender,
.gmail-item.read .gmail-item-recipient,
.gmail-item.read .gmail-item-subject strong {
  color: #94a3b8;
  font-weight: 500;
}

.gmail-read-indicator {
  width: 9px;
  height: 9px;
  border: 1px solid #475569;
  border-radius: 50%;
  flex: 0 0 9px;
}

.gmail-item.unread .gmail-read-indicator {
  border-color: #22c55e;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.gmail-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3b82f6;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.gmail-item-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.gmail-item-addresses {
  display: flex;
  align-items: baseline;
  gap: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.gmail-item-sender,
.gmail-item-recipient {
  flex: 1 1 50%;
  width: 0;
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f8fafc;
}

.gmail-item-recipient {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
}

.gmail-address-label {
  color: #60a5fa;
  font-weight: 700;
}

.gmail-item-subject {
  display: flex;
  align-items: baseline;
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #cbd5e1;
}

.gmail-item-subject strong {
  flex: 0 1 auto;
  min-width: 72px;
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gmail-item-snippet {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  color: #64748b;
  font-weight: 400;
  margin-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gmail-item-time {
  display: block;
  min-width: 0;
  max-width: 100%;
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.gmail-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.gmail-star {
  cursor: pointer;
  font-size: 16px;
  color: #475569;
  transition: color 0.15s ease;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
}

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

.gmail-category {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  color: #dbeafe;
  background: #1e3a5f;
  border: 1px solid #315b87;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gmail-category-social {
  color: #d1fae5;
  background: #134e4a;
  border-color: #0f766e;
}

.gmail-category-promotions {
  color: #fce7f3;
  background: #831843;
  border-color: #be185d;
}

.gmail-category-updates {
  color: #fef3c7;
  background: #78350f;
  border-color: #b45309;
}

.gmail-category-forums {
  color: #ede9fe;
  background: #4c1d95;
  border-color: #6d28d9;
}

.gmail-category-spam {
  color: #fee2e2;
  background: #7f1d1d;
  border-color: #b91c1c;
}

@container (max-width: 900px) {
  .gmail-item {
    grid-template-columns: 24px 9px 36px minmax(0, 1fr) minmax(78px, 104px);
    padding-block: 10px;
  }

  .gmail-item-addresses {
    align-items: stretch;
    flex-direction: column;
    gap: 3px;
  }

  .gmail-item-sender,
  .gmail-item-recipient {
    flex: 0 1 auto;
    width: 100%;
  }

  .gmail-item-subject strong {
    max-width: 52%;
  }
}

@container (max-width: 680px) {
  .gmail-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .gmail-search-bar {
    width: 100%;
  }

  .gmail-toolbar #gmailRefreshBtn {
    align-self: flex-end;
  }
}

.gmail-thread-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* Gmail Thread Reader */
.gmail-thread-reader {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: #0f172a;
  border: 1px solid #26354a;
  border-radius: 6px;
  max-height: calc(100vh - 150px);
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: auto;
}

.gmail-thread-header {
  border-bottom: 1px solid #1e293b;
  padding-bottom: 12px;
}

.gmail-thread-subject {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 8px;
}

.gmail-thread-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
}

.gmail-thread-body {
  font-size: 14px;
  line-height: 1.6;
  color: #e2e8f0;
  background: #111c30;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #334155;
  overflow: hidden;
  scroll-margin-top: 12px;
}

.gmail-thread-body.gmail-thread-latest {
  border-color: #3b82f6;
  box-shadow: inset 3px 0 #3b82f6;
}

.gmail-thread-message-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  background: #172338;
  border-bottom: 1px solid #2a3950;
}

.gmail-thread-message-identity {
  min-width: 0;
}

.gmail-thread-message-from,
.gmail-thread-message-to {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gmail-thread-message-from {
  color: #f8fafc;
  font-size: 13px;
  font-weight: 700;
}

.gmail-thread-message-to {
  color: #94a3b8;
  font-size: 12px;
  margin-top: 3px;
}

.gmail-thread-message-from span,
.gmail-thread-message-to span {
  color: #60a5fa;
  font-weight: 700;
}

.gmail-thread-message-side {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
}

.gmail-latest-label {
  color: #bfdbfe;
  background: #1e3a5f;
  border: 1px solid #315b87;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

.gmail-thread-message-content {
  color: #e2e8f0;
  line-height: 1.65;
  padding: 18px 16px;
  font-size: 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.gmail-thread-attachments {
  padding: 12px 16px;
  border-top: 1px solid #2a3950;
}

/* --- DOCKED GMAIL COMPOSE DIALOG (BOTTOM-RIGHT FLOATING BOX) --- */
.gmail-compose-dock {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 540px;
  height: min(680px, 90vh);
  background: #0f172a;
  border: 1px solid #334155;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  transition: height 0.2s ease, width 0.2s ease;
}

.gmail-compose-dock.minimized {
  height: 44px;
  overflow: hidden;
}

.gmail-compose-dock.maximized {
  width: 80vw;
  height: 80vh;
  right: 10vw;
}

.gmail-compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b;
  padding: 10px 16px;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid #334155;
  cursor: pointer;
}

.gmail-compose-title {
  font-weight: 700;
  font-size: 13px;
  color: #f8fafc;
}

.gmail-compose-window-actions {
  display: flex;
  gap: 8px;
}

.win-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.win-btn svg,
#gmailDiscardBtn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

#gmailDiscardBtn {
  width: 38px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.win-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.win-btn.close:hover {
  background: #ef4444;
  color: #fff;
}

.gmail-compose-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 12px 16px;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.gmail-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 4px;
}

.gmail-field-row label {
  font-size: 12px;
  color: #94a3b8;
  width: 60px;
}

.gmail-field-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-size: 13px;
}

.gmail-signature-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.gmail-signature-controls label {
  width: 60px;
  flex: 0 0 60px;
  color: #94a3b8;
  font-size: 12px;
}

.gmail-signature-controls select {
  min-width: 190px;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #111c30;
  color: #f8fafc;
  padding: 6px 8px;
  font-size: 12px;
}

.gmail-custom-signature {
  min-height: 76px;
  max-height: 140px;
  resize: vertical;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #111c30;
  color: #f8fafc;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
}

.gmail-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
  padding: 12px 16px;
  border-top: 1px solid #2a3950;
  background: #0f192a;
}

.gmail-cc-toggle {
  font-size: 11px;
  color: #60a5fa;
  cursor: pointer;
}

.gmail-editor-area {
  flex: 1;
  display: flex;
}

.gmail-editor-area textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-size: 13px;
  resize: none;
  font-family: inherit;
}

.gmail-compose-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #1e293b;
}

@media (max-width: 900px) {
  .gmail-container {
    flex-direction: column;
    min-height: auto;
  }

  .gmail-sidebar {
    width: 100%;
    max-height: none;
    padding: 0 0 12px;
    border-right: 0;
    border-bottom: 1px solid #1e293b;
  }

  .gmail-main {
    flex: 1 1 auto;
    width: 100%;
  }

  .gmail-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .gmail-nav-item {
    flex: 0 0 auto;
  }

  .gmail-search-bar {
    width: min(100%, 360px);
  }

  .gmail-item {
    grid-template-columns: 24px 9px 32px minmax(0, 1fr) minmax(74px, max-content);
    gap: 8px;
    row-gap: 5px;
    padding: 10px 8px;
  }

  .gmail-avatar {
    width: 32px;
    height: 32px;
  }

  .gmail-item-time {
    max-width: 126px;
  }

  .gmail-compose-dock,
  .gmail-compose-dock.maximized {
    right: 0;
    width: 100vw;
    height: min(760px, 92vh);
    border-radius: 8px 8px 0 0;
  }
}

@media (max-width: 620px) {
  .gmail-container {
    padding: 10px;
    gap: 10px;
  }

  .gmail-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .gmail-search-bar {
    width: 100%;
  }

  .gmail-item {
    grid-template-columns: 24px 9px 32px minmax(0, 1fr) 70px;
    gap: 7px;
    min-height: 84px;
  }

  .gmail-item .gmail-category {
    display: none;
  }

  .gmail-item-time {
    width: 100%;
    max-width: 100%;
    justify-self: stretch;
  }

  .gmail-item-subject strong {
    max-width: 100%;
  }

  .gmail-item-snippet {
    display: none;
  }

  .gmail-item-side {
    gap: 6px;
  }

  .gmail-thread-reader {
    max-height: calc(100vh - 92px);
    padding: 10px;
  }

  .gmail-thread-message-header {
    gap: 10px;
    padding: 12px;
  }

  .gmail-thread-message-content {
    padding: 16px 12px;
  }

  .gmail-message-actions {
    padding: 10px 12px;
  }

  .gmail-thread-message-side time {
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
