@import url("/fontawesome/css/all.min.css");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
}

body {
  background-color: #ffffff;
  color: #1a1a1a;
}

.dashboard {
  display: flex;
  height: 100vh;
}

/* Sidebar - stays black */
.sidebar {
  width: 240px;
  background-color: #121212;
  border-right: 1px solid #232323;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 0;
}

.sidebar-header {
  padding: 0 20px 20px 20px;
  border-bottom: 1px solid #232323;
}

.sidebar-header h2 {
  color: #ffffff;
  font-size: 20px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 20px;
}

.nav-item {
  color: #b3b3b3;
  text-decoration: none;
  padding: 12px 20px;
  font-size: 15px;
  transition: 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background-color: #1a1a1a;
  color: #ffffff;
}

.nav-item.active {
  background-color: #1a1a1a;
  color: #ffffff;
  border-left: 3px solid #4d9dff;
}

.sidebar-footer {
  padding: 0 20px;
}

.logout-btn {
  display: block;
  text-align: center;
  background-color: #b02a2a;
  color: #fff;
  text-decoration: none;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  transition: 0.2s ease;
}

.logout-btn:hover {
  background-color: #d13a3a;
}

/* Main content - white theme, fills remaining space */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  height: 100vh; 
  overflow: hidden;
}

.topbar {
  padding: 20px 30px;
  border-bottom: 1px solid #e0e0e0;
  background-color: #ffffff;
}

.topbar h1 {
  font-size: 22px;
  color: #1a1a1a;
}

.content-area {
  flex: 1;
  padding: 30px;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  min-height: 0;          /* ye key fix hai */
  overflow-y: auto; 
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 15px;
}

.tab-content.active {
  min-height: 0;    
  display: flex;
}

.card {
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 18px;
  font-size: 15px;
  color: #1a1a1a;
}

/* Page actions */
.page-actions {
  margin-bottom: 20px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-primary {
  background-color: #4d9dff;
  color: #fff;
}

.btn-primary:hover {
  background-color: #3a8ae6;
}

.btn-secondary {
  background-color: #e0e0e0;
  color: #1a1a1a;
}

.btn-secondary:hover {
  background-color: #cfcfcf;
}

.btn-edit {
  background-color: #ffb84d;
  color: #1a1a1a;
  margin-right: 6px;
}

.btn-edit:hover {
  background-color: #ffa733;
}

.btn-delete {
  background-color: #e05252;
  color: #fff;
}

.btn-delete:hover {
  background-color: #cc3f3f;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 18px;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background-color: #fafafa;
  color: #888;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid #eee;
}

.data-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: 0.15s ease;
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: #fafbff;
}

.data-table td {
  color: #333;
}

/* Badge (for status/role labels) */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background-color: #eef2ff;
  color: #4d5df0;
  text-transform: capitalize;
}

.badge-admin {
  background-color: #fff1e6;
  color: #d17a22;
}

.badge-active {
  background-color: #e6f8ee;
  color: #1fa35a;
}

.badge-inactive {
  background-color: #f2f2f2;
  color: #888;
}

.action-cell {
  white-space: nowrap;
}

/* Form Card */
.form-card {
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 40px 50px;
  width: 100%;
  margin: 30px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
  padding: 12px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  background-color: #fff;
  color: #1a1a1a;
  transition: 0.15s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #4d9dff;
  box-shadow: 0 0 0 3px rgba(77, 157, 255, 0.1);
}

.form-card input[type="submit"] {
  margin-top: 10px;
  padding: 12px 30px;
  font-size: 15px;
  font-weight: 600;
  width: fit-content;
  align-self: flex-start;
  cursor: pointer;
}

/* Login Page */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-color: #0d0d0d;
}

.login-card {
  background: #f5f5f5;
  padding: 40px 45px;
  border-radius: 12px;
  width: 360px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.login-title {
  font-size: 24px;
  margin-bottom: 4px;
  color: #1a1a1a;
}

.login-subtitle {
  font-size: 14px;
  color: #777;
  margin-bottom: 24px;
}

.login-error {
  background-color: #fdecea;
  color: #c0392b;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 18px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  font-size: 15px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.welcome-text {
  font-size: 14px;
  color: #555;
}

.btn-logout {
  background-color: #e05252;
  color: #fff;
  padding: 8px 18px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: 0.2s ease;
}

.btn-logout:hover {
  background-color: #cc3f3f;
}
/* Conversations list */
.conversation-card {
  display: block;
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
  text-decoration: none;
  color: #1a1a1a;
  transition: 0.15s ease;
}

.conversation-card:hover {
  border-color: #4d9dff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.conversation-card .contact-name {
  font-weight: 600;
  font-size: 15px;
}

.conversation-card .contact-email {
  font-size: 13px;
  color: #888;
}

.conversation-card .subject {
  font-size: 14px;
  color: #444;
  margin-top: 4px;
}

/* Chat view */
.chat-window {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 0;
}

.email-thread {
  display: flex;
  flex-direction: column;
}

/* ---- Message row (Gmail-style thread — left aligned, full width) ---- */
.email-message {
  padding: 16px 20px;
  border-bottom: 1px solid #dcdcdc;
  transition: 0.15s ease;
}

.email-message:last-child {
  border-bottom: none;
}

.email-message-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.email-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4d9dff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}



.email-message-meta {
  flex: 1;
  min-width: 0;
}

.email-message-sender {
  font-weight: 600;
  font-size: 14px;
}

.email-message-time {
  font-size: 12px;
  color: #888;
}

.email-message-body-wrapper {
    margin-left: 0;
}

/* Minimal Gmail-style body: plain text, no card/box, just clean spacing */
.email-message-body {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    padding: 2px 0 0;
    max-height: 120px;
    overflow: hidden;
    position: relative;
}

.email-message-body-wrapper.expanded .email-message-body {
  max-height: none;
  overflow: visible;
}

/* Collapsed message: fade the last visible line into white instead of
   hard-cutting it mid-line — only applied when JS has confirmed the
   message actually overflows (see .truncatable in index.ejs) */
.email-message-body-wrapper.truncatable:not(.expanded) .email-message-body::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff);
  pointer-events: none;
}

.message-toggle-btn {
  margin-top: 6px;
  padding: 0;
  border: none;
  background: none;
  color: #4d9dff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.message-toggle-btn:hover {
  text-decoration: none;
  color: #3a8ae6;
}

/* Conversations split-view layout */
.conversations-layout {
  min-height: 0;  
  display: flex;
  height: 100%;
  overflow: hidden;
}

.conv-list-panel {
    min-height: 0; 
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conv-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.conv-list-header h2 {
  font-size: 16px;
  margin: 0;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

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

.conv-list-empty {
  padding: 16px;
  color: #888;
  font-size: 14px;
}

.conv-list-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f2f2f2;
  border-left: 3px solid transparent;
  transition: 0.15s ease;
}

.conv-list-item:hover {
  background: #f9f9f9;
}

.conv-list-item.active {
  background: #eef4ff;
}

.conv-list-item.unread {
  background: #f7f9ff;
  border-left: 3px solid #4d9dff;
}

.conv-list-item.unread .conv-item-name,
.conv-list-item.unread .conv-item-subject {
  font-weight: 700;
  color: #111;
}

.conv-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4d9dff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.conv-item-text {
  min-width: 0;
  flex: 1;
}

.conv-item-name {
  font-weight: 600;
  font-size: 14px;
}

.conv-item-subject {
  font-size: 13px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item-preview {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-chat-panel {
   min-height: 0; 
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conv-chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.conv-chat-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.conv-chat-header h3 {
  margin: 0;
  font-size: 17px;
}

.conv-chat-subtext {
  color: #888;
  font-size: 13px;
  margin: 4px 0 0;
}

.conv-chat-actions {
  display: flex;
  gap: 10px;
}

.conv-chat-panel .email-thread {
  padding: 16px 20px;
}

.conv-chat-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.btn-reply-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  margin: 16px 20px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  background: #fff;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  transition: 0.15s ease;
  text-decoration: none;
}

.btn-reply-icon:hover {
  background: #f5f5f5;
  border-color: #4d9dff;
  color: #4d9dff;
}

.conv-list-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
}

.conv-list-tabs {
  display: flex;
  gap: 4px;
}

.conv-tab {
  padding: 6px 12px;
  font-size: 13px;
  color: #888;
  text-decoration: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.conv-tab.active {
  background: #eef4ff;
  color: #4d9dff;
  font-weight: 600;
}

.conv-tab-badge {
  background: #e05252;
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
}

.conv-search-form input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
}

.btn-action {
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  background: #fff;
  color: #333;
  cursor: pointer;
  text-decoration: none;
}

.btn-action:hover {
  background: #f5f5f5;
  border-color: #4d9dff;
}

.btn-action-danger {
  color: #e05252;
  border-color: #f2c6c6;
}

.btn-action-danger:hover {
  background: #fdecea;
  border-color: #e05252;
}

.editor-body:empty:before {
  content: attr(data-placeholder);
  color: #999;
}

.btn-icon:hover {
  background: #f0f0f0;
}

.reply-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #dcdcdc;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  margin: 12px 20px 16px;
  background: #fff;
  overflow: visible;
}

.editor-body {
  min-height: 90px;
  max-height: 220px;
  overflow-y: auto;
  padding: 16px 18px 8px;
  font-size: 14px;
  outline: none;
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px;
}

.attachment-chip {
  background: #f0f0f0;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: #444;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.attachment-chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #888;
  font-size: 11px;
  padding: 0;
}

.attachment-chip button:hover {
  color: #e05252;
}

.reply-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid #eee;
}

.btn-send {
  background: #4d9dff;
  color: #fff;
  border: none;
  padding: 8px 22px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn-send:hover {
  background: #3a8ae6;
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: #ddd;
  margin: 0 6px;
}

.tb-icon {
  border: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: #555;
}

.tb-icon:hover {
  background: #f0f4ff;
  color: #4d9dff;
}

.tb-clear {
  font-size: 12px;
  font-weight: 600;
  text-decoration: line-through;
}

.tb-icon.active {
  background: #4d9dff;
  color: #fff;
}

.link-popover {
  position: absolute;
  bottom: 55px;
  left: 100px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  padding: 10px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.link-popover input {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  width: 220px;
}

.link-popover button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: #4d9dff;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.link-popover button:last-child {
  background: #eee;
  color: #444;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0 48px;
}


.message-attachment-chip {
  background: #f0f0f0;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #444;
  text-decoration: none;
}

.message-attachment-chip:hover {
  background: #e0eaff;
  color: #4d9dff;
}
#ccField input,
#bccField input {
  width: 100%;
  box-sizing: border-box;
}

#replyCardWrapper {
  position: relative;
  flex-shrink: 0;   /* isse ye hamesha bottom pe rahega, scroll nahi hoga */
  border-top: 1px solid #eee;
  background: #fff;
}

.reply-forward-bar .btn-reply-icon {
  margin: 16px 0;
}

.reply-forward-bar {
  display: flex;
  gap: 6px;
  padding: 12px 20px;
}

.nav-item i {
  width: 20px;
  margin-right: 8px;
  text-align: center;
}

/* ---- Compose box (New Conversation message area) ---- */
.compose-box {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: 0.15s ease;
}

.compose-box:focus-within {
  border-color: #4d9dff;
  box-shadow: 0 0 0 3px rgba(77, 157, 255, 0.1);
}

.compose-box .editor-body {
  border: none;
}

.compose-box .reply-toolbar {
  border-top: 1px solid #eee;
}

.editor-lg {
  min-height: 220px;
  max-height: 420px;
}

/* ---- Cc/Bcc pill buttons ---- */
.cc-bcc-toggle {
  display: flex;
  gap: 8px;
  margin-top: -6px;
}

.cc-bcc-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 14px;
  cursor: pointer;
  transition: 0.15s ease;
}

.cc-bcc-btn:hover {
  background: #f5f5f5;
  border-color: #4d9dff;
  color: #4d9dff;
}

/* ---- Custom confirm modal (replaces browser's default confirm()) ---- */
.confirm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.confirm-modal-overlay.active {
  display: flex;
}

.confirm-modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px 30px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.confirm-modal p {
  font-size: 15px;
  color: #1a1a1a;
  line-height: 1.5;
  margin-bottom: 22px;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-modal-actions button {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: 0.15s ease;
}

.confirm-modal-cancel {
  background: #e0e0e0;
  color: #1a1a1a;
}

.confirm-modal-cancel:hover {
  background: #cfcfcf;
}

.confirm-modal-confirm {
  background: #e05252;
  color: #fff;
}

.confirm-modal-confirm:hover {
  background: #cc3f3f;
}
