/* ========================================================
   PlexMail - Authentic Gmail Material Design 3 Stylesheet
   ======================================================== */

:root {
  /* Google Material 3 Design Tokens (Light Default) */
  --bg-app: #f6f8fc;
  --bg-surface: #ffffff;
  --bg-sidebar: #f6f8fc;
  --bg-header: #f6f8fc;
  --bg-search: #eaf1fb;
  --bg-search-focus: #ffffff;
  --bg-hover: #f0f4f9;
  --bg-active-pill: #d3e3fd;
  --text-active-pill: #041e49;
  --bg-compose: #c2e7ff;
  --text-compose: #001d35;
  --hover-compose: #b3dbf8;

  --google-blue: #0b57d0;
  --google-blue-hover: #0842a0;
  --google-red: #ea4335;
  --google-yellow: #fbbc04;
  --google-green: #34a853;

  --text-primary: #1f1f1f;
  --text-secondary: #444746;
  --text-muted: #5e5e5e;
  --text-snippet: #747775;
  --border-color: #e0e3e7;
  --border-subtle: #f2f2f2;

  --mail-unread-bg: #ffffff;
  --mail-read-bg: #f8fafc;
  --mail-selected-bg: #c2e7ff;

  --shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.15);
  --shadow-md: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
  --shadow-lg: 0 8px 24px rgba(60,64,67,0.2);
  --shadow-compose: 0 4px 16px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.12);

  --font-family: 'Google Sans', 'Roboto', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-full: 9999px;
  --radius-pill: 28px;
  --radius-card: 16px;
  --radius-sm: 8px;
}

/* Dark Mode Tokens */
body.theme-dark {
  --bg-app: #141517;
  --bg-surface: #1e1f22;
  --bg-sidebar: #141517;
  --bg-header: #141517;
  --bg-search: #282a2d;
  --bg-search-focus: #303134;
  --bg-hover: #2d2f33;
  --bg-active-pill: #004a77;
  --text-active-pill: #c2e7ff;
  --bg-compose: #a8c7fa;
  --text-compose: #041e49;
  --hover-compose: #9bc0fa;

  --google-blue: #a8c7fa;
  --google-blue-hover: #8ab4f8;

  --text-primary: #e3e3e3;
  --text-secondary: #c4c7c5;
  --text-muted: #8e918f;
  --text-snippet: #8e918f;
  --border-color: #383a3e;
  --border-subtle: #292a2d;

  --mail-unread-bg: #1e1f22;
  --mail-read-bg: #18191b;
  --mail-selected-bg: #003355;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.4);
  --shadow-md: 0 4px 8px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
  --shadow-compose: 0 8px 24px rgba(0,0,0,0.6);
}

/* Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: var(--google-blue);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* ========================================================
   TOAST NOTIFICATIONS (GMAIL SNACKBAR)
   ======================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #323232;
  color: #ffffff;
  padding: 14px 24px;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px 0 rgba(0,0,0,.14);
  animation: slideUpToast 0.25s ease-out;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}

.toast.error {
  background: #b3261e;
}

@keyframes slideUpToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ========================================================
   VIEW CONTAINERS
   ======================================================== */
.view-container {
  display: none;
  width: 100vw;
  height: 100vh;
}

.view-container.active {
  display: flex;
  flex-direction: column;
}

/* ========================================================
   GOOGLE SIGN-IN STYLE (LOGIN SCREEN)
   ======================================================== */
.google-login-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-app);
  padding: 20px;
}

.google-login-card {
  width: 100%;
  max-width: 448px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  padding: 40px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.google-brand {
  text-align: center;
  margin-bottom: 30px;
}

.gmail-logo-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.google-brand-title {
  font-size: 24px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.google-brand-title span {
  color: var(--google-blue);
  font-weight: 700;
}

.google-brand-sub {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  display: block;
}

.google-brand-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

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

/* Material Floating Inputs */
.google-input-group {
  position: relative;
  width: 100%;
}

.google-input-group input {
  width: 100%;
  height: 56px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: transparent;
  color: var(--text-primary);
  padding: 16px 16px 0 16px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.google-input-group input:focus {
  border-color: var(--google-blue);
  box-shadow: 0 0 0 1px var(--google-blue);
}

.google-input-group label {
  position: absolute;
  top: 18px;
  left: 16px;
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
  transition: all 0.2s ease;
}

.google-input-group input:focus ~ label,
.google-input-group input:not(:placeholder-shown) ~ label {
  top: 6px;
  font-size: 12px;
  color: var(--google-blue);
  font-weight: 500;
}

.btn-toggle-eye {
  position: absolute;
  right: 12px;
  top: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-eye:hover {
  color: var(--text-primary);
}

.login-meta-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.server-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.status-indicator-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--google-green);
  display: inline-block;
}

.google-link {
  color: var(--google-blue);
  font-weight: 500;
}

.google-link:hover {
  text-decoration: underline;
}

.google-login-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.btn-gmail-primary {
  background: var(--google-blue);
  color: #ffffff;
  border: none;
  border-radius: 24px;
  height: 44px;
  padding: 0 24px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-gmail-primary:hover {
  background: var(--google-blue-hover);
  box-shadow: 0 1px 3px 1px rgba(66,133,244,0.3);
}

.btn-gmail-outline {
  background: transparent;
  color: var(--google-blue);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  height: 38px;
  padding: 0 18px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-gmail-outline:hover {
  background: var(--bg-hover);
}

/* ========================================================
   GMAIL APP HEADER
   ======================================================== */
.gmail-header {
  height: 64px;
  background: var(--bg-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  gap: 16px;
  flex-shrink: 0;
  border-bottom: 1px solid transparent;
}

.header-left-section {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}

.icon-btn-round {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

.gmail-logo-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 8px;
}

.gmail-logo-container:hover {
  background: var(--bg-hover);
}

.gmail-text-logo {
  font-size: 22px;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: -0.5px;
}

.gmail-text-logo span {
  font-weight: 700;
  color: var(--google-blue);
}

/* Header Search Bar (Gmail Pill) */
.header-search-section {
  flex: 1;
  max-width: 720px;
}

.gmail-search-bar {
  background: var(--bg-search);
  border-radius: var(--radius-pill);
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  transition: background 0.2s, box-shadow 0.2s;
}

.gmail-search-bar:focus-within {
  background: var(--bg-search-focus);
  box-shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
}

.search-icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  cursor: pointer;
}

.gmail-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 16px;
}

.clear-search-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

/* Header Right Actions */
.header-right-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gmail-top-pill {
  height: 38px;
  border-radius: 19px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.gmail-top-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.gmail-top-pill.active {
  background: var(--bg-active-pill);
  color: var(--text-active-pill);
  border-color: transparent;
  font-weight: 600;
}

/* User Avatar & Google Account Menu */
.user-avatar-wrapper {
  position: relative;
}

.google-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0b57d0;
  color: #ffffff;
  border: 2px solid transparent;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.google-avatar-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.google-account-menu {
  position: absolute;
  top: 48px;
  right: 0;
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 1000;
  animation: menuDrop 0.15s ease-out;
}

@keyframes menuDrop {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.account-card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0;
}

.account-card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0b57d0;
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.account-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.account-card-email {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.account-badge {
  background: var(--bg-active-pill);
  color: var(--text-active-pill);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.account-card-divider {
  height: 1px;
  background: var(--border-color);
  margin: 12px 0;
}

.account-actions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-menu-item {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: background 0.15s;
}

.account-menu-item:hover {
  background: var(--bg-hover);
}

.account-logout-row {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.btn-google-signout {
  width: 100%;
  height: 38px;
  border-radius: 19px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}

.btn-google-signout:hover {
  background: var(--bg-hover);
  color: var(--google-red);
}

/* ========================================================
   GMAIL MAIN LAYOUT
   ======================================================== */
.gmail-main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(100vh - 64px);
}

.subview {
  display: none;
  width: 100%;
  height: 100%;
}

.subview.active {
  display: flex;
}

/* ========================================================
   GMAIL SIDEBAR
   ======================================================== */
.gmail-sidebar {
  width: 256px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  padding: 8px 16px 16px 0;
  flex-shrink: 0;
  transition: width 0.2s ease, padding 0.2s ease;
  user-select: none;
}

.gmail-sidebar.collapsed {
  width: 72px;
  padding-right: 8px;
}

.compose-btn-wrapper {
  padding-left: 12px;
  margin-bottom: 16px;
}

/* Material 3 Compose Button */
.btn-gmail-compose {
  height: 56px;
  border-radius: 16px;
  background: var(--bg-compose);
  color: var(--text-compose);
  border: none;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
  transition: box-shadow 0.2s, background 0.2s;
}

.btn-gmail-compose:hover {
  box-shadow: 0 4px 8px 3px rgba(0,0,0,0.15);
  background: var(--hover-compose);
}

.gmail-sidebar.collapsed .btn-gmail-compose {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 16px;
  justify-content: center;
}

.gmail-sidebar.collapsed .btn-gmail-compose span {
  display: none;
}

/* Folder Navigation Items */
.gmail-folder-nav {
  flex: 1;
  overflow-y: auto;
}

.gmail-folder-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gmail-folder-item {
  height: 32px;
  border-radius: 0 16px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 24px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.gmail-folder-item:hover {
  background: var(--bg-hover);
}

.gmail-folder-item.active {
  background: var(--bg-active-pill);
  color: var(--text-active-pill);
  font-weight: 700;
}

.folder-left-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.folder-left-content svg {
  color: inherit;
}

.gmail-sidebar.collapsed .gmail-folder-item {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
  margin: 0 auto;
}

.gmail-sidebar.collapsed .folder-left-content span,
.gmail-sidebar.collapsed .folder-badge-unread {
  display: none;
}

.folder-badge-unread {
  font-size: 12px;
  font-weight: 700;
  color: inherit;
}

/* Storage / Quota */
.gmail-sidebar-storage {
  padding: 12px 16px 0 24px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-secondary);
}

.storage-text-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.storage-progress-track {
  width: 100%;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.storage-progress-bar {
  height: 100%;
  background: var(--google-blue);
  border-radius: 2px;
  transition: width 0.3s;
}

.gmail-sidebar.collapsed .gmail-sidebar-storage {
  display: none;
}

/* ========================================================
   GMAIL CONTENT AREA
   ======================================================== */
.gmail-content-area {
  flex: 1;
  background: var(--bg-surface);
  border-radius: 16px;
  margin: 0 16px 16px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

/* Mail List View */
.gmail-mail-list-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Toolbar */
.gmail-toolbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-info {
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
}

/* Category Tabs (Primary) */
.gmail-category-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  flex-shrink: 0;
}

.gmail-tab {
  height: 56px;
  width: 250px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.gmail-tab:hover {
  background: var(--bg-hover);
}

.gmail-tab.active {
  color: var(--google-blue);
  font-weight: 700;
}

.gmail-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--google-blue);
  border-radius: 3px 3px 0 0;
}

/* Checkbox Style */
.gmail-checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.gmail-checkbox-wrapper input {
  display: none;
}

.gmail-checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 2px;
  display: inline-block;
  transition: all 0.15s;
}

.gmail-checkbox-wrapper input:checked + .gmail-checkbox-custom {
  background: var(--google-blue);
  border-color: var(--google-blue);
  position: relative;
}

.gmail-checkbox-wrapper input:checked + .gmail-checkbox-custom::after {
  content: '✓';
  position: absolute;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  top: -2px;
  left: 3px;
}

/* Messages List */
.gmail-messages-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.gmail-loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 12px;
  color: var(--text-muted);
}

.gmail-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--google-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Authentic Gmail Mail Row */
.gmail-mail-row {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  background: var(--mail-read-bg);
  position: relative;
  transition: background 0.1s, box-shadow 0.1s;
}

.gmail-mail-row.unread {
  background: var(--mail-unread-bg);
  font-weight: 700;
}

.gmail-mail-row:hover {
  box-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60,64,67,0.3);
  background: var(--bg-hover) !important;
  z-index: 2;
}

.gmail-mail-row.selected {
  background: var(--mail-selected-bg) !important;
}

.mail-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  max-width: 240px;
  flex-shrink: 0;
}

.mail-star-btn {
  background: none;
  border: none;
  color: #c4c7c5;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color 0.15s;
}

.mail-star-btn:hover {
  color: #747775;
}

.mail-star-btn.starred {
  color: var(--google-yellow) !important;
}

.mail-sender-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text-primary);
}

.mail-row-middle {
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding-right: 16px;
}

.mail-subject-text {
  color: var(--text-primary);
  margin-right: 6px;
  flex-shrink: 0;
}

.mail-snippet-text {
  color: var(--text-snippet);
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.mail-attach-icon {
  color: var(--text-muted);
}

.mail-date-text {
  min-width: 60px;
  text-align: right;
}

/* Hover Quick Actions on Row */
.mail-hover-actions {
  display: none;
  align-items: center;
  gap: 4px;
}

.gmail-mail-row:hover .mail-date-text {
  display: none;
}

.gmail-mail-row:hover .mail-hover-actions {
  display: flex;
}

/* ========================================================
   READING VIEW (GMAIL THREAD DETAIL)
   ======================================================== */
.gmail-reading-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reading-toolbar {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.reading-actions-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
}

.reading-header-content {
  padding: 20px 24px 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.reading-subject {
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 16px;
  word-break: break-word;
}

.sender-card-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.sender-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--google-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.sender-info-block {
  flex: 1;
}

.sender-line-1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.sender-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.sender-email-address {
  font-size: 12px;
  color: var(--text-muted);
}

.sender-line-2 {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sender-date-block {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Attachments Tray in Reading View */
.reading-attachments-tray {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.attachments-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.attachments-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attachment-card-chip {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.15s;
}

.attachment-card-chip:hover {
  background: var(--bg-active-pill);
  border-color: var(--google-blue);
}

/* Email Body Container */
.reading-body-container {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
}

.reading-body-container img {
  max-width: 100%;
  height: auto;
}

.reading-bottom-actions {
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.gmail-pill-btn {
  height: 38px;
  border-radius: 19px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  padding: 0 20px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.gmail-pill-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ========================================================
   SIGNATURE GMAIL FLOATING COMPOSE WINDOW (Bottom-Right)
   ======================================================== */
.gmail-floating-compose {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 540px;
  height: 520px;
  z-index: 10000;
  border-radius: 12px 12px 0 0;
  background: var(--bg-surface);
  box-shadow: var(--shadow-compose);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: height 0.2s ease, width 0.2s ease;
}

.gmail-floating-compose.minimized {
  height: 44px !important;
}

.gmail-floating-compose.expanded {
  width: 80vw !important;
  height: 80vh !important;
  right: 10vw !important;
  bottom: 10vh !important;
  border-radius: 12px !important;
}

.floating-compose-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.compose-titlebar {
  height: 44px;
  background: #f2f6fc;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
  cursor: pointer;
}

body.theme-dark .compose-titlebar {
  background: #282a2d;
}

.compose-title-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.compose-titlebar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.titlebar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
}

.titlebar-btn:hover {
  background: rgba(0,0,0,0.08);
  color: var(--text-primary);
}

.compose-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compose-body-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.compose-field-row {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.compose-field-row label {
  color: var(--text-muted);
  font-size: 13px;
  width: 50px;
}

.compose-field-row input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
}

.compose-formatting-bar {
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-subtle);
}

.fmt-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.fmt-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.compose-rich-editor {
  flex: 1;
  padding: 16px;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 180px;
}

.staged-attachments-tray {
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.staged-file-pill {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.staged-file-pill button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

.compose-footer-row {
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.compose-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-gmail-send {
  height: 36px;
  border-radius: 18px;
  background: var(--google-blue);
  color: #ffffff;
  border: none;
  padding: 0 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-gmail-send:hover {
  background: var(--google-blue-hover);
}

/* ========================================================
   GOOGLE MODAL SYSTEM (PASSWORD CHANGE, DNS, CLIENT)
   ======================================================== */
.google-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.google-modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUpModal 0.2s ease-out;
}

.google-modal-card.modal-lg {
  max-width: 760px;
}

@keyframes scaleUpModal {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.google-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
}

.header-icon-key {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(11, 87, 208, 0.1);
  color: var(--google-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-title-wrap h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.header-title-wrap p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.btn-close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-modal:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.google-modal-form, .google-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(85vh - 130px);
  overflow-y: auto;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input, .form-group select {
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--google-blue);
  box-shadow: 0 0 0 1px var(--google-blue);
}

.pass-toggle-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.pass-toggle-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.pass-toggle-wrapper .btn-toggle-eye {
  position: absolute;
  right: 10px;
  top: 10px;
}

/* Password Strength Meter */
.password-meter-wrap {
  width: 100%;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.password-meter-bar {
  height: 100%;
  width: 0%;
  transition: width 0.3s, background 0.3s;
}

.password-meter-label {
  font-size: 11px;
  color: var(--text-muted);
}

.pass-match-hint {
  font-size: 12px;
  color: var(--google-red);
}

.google-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-surface);
}

/* ========================================================
   ADMIN HUB STYLING (GOOGLE ADMIN CONSOLE DESIGN)
   ======================================================== */
.admin-wrapper {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-top-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-main-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
}

.admin-main-sub {
  font-size: 14px;
  color: var(--text-secondary);
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrap.blue { background: #e8f0fe; color: #1a73e8; }
.stat-icon-wrap.green { background: #e6f4ea; color: #137333; }
.stat-icon-wrap.purple { background: #f3e8fd; color: #9334e6; }
.stat-icon-wrap.amber { background: #fef7e0; color: #b06000; }

.stat-data {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.admin-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.admin-card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.admin-card-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  margin-bottom: 16px;
}

.admin-card-header.flex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.full-width-field {
  grid-column: span 2;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

.input-with-button input, .input-with-button select {
  flex: 1;
}

.input-addon-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
  overflow: hidden;
}

.input-addon-wrap input {
  flex: 1;
  border: none;
  height: 44px;
  padding: 0 14px;
  outline: none;
  background: transparent;
  color: var(--text-primary);
}

.input-addon-text {
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.custom-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}

.checkmark-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 3px;
  display: inline-block;
}

.custom-checkbox-row input:checked ~ .checkmark-box {
  background: var(--google-blue);
  border-color: var(--google-blue);
}

.admin-tables-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.table-scroll-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 600;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

/* ========================================================
   DNS & CLIENT SETUP BANNER
   ======================================================== */
.apple-profile-banner {
  background: #f0f7ff;
  border: 1px solid #c2e7ff;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

body.theme-dark .apple-profile-banner {
  background: #003355;
  border-color: #004a77;
}

.apple-profile-banner h4 {
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.apple-profile-banner p {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-apple-download {
  background: var(--google-blue);
  color: #fff;
  padding: 8px 16px;
  border-radius: 18px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.client-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.config-box {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.config-box h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.cfg-line {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.cfg-line strong {
  color: var(--text-primary);
}

/* DNS Guide Cards */
.dns-records-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dns-card {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
}

.dns-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.dns-type-tag {
  background: var(--google-blue);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}

.dns-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.dns-val-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  font-size: 13px;
}

.dns-val-text {
  font-family: monospace;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: 6px;
  word-break: break-all;
  flex: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .gmail-sidebar {
    position: fixed;
    top: 64px;
    bottom: 0;
    left: -260px;
    z-index: 5000;
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
  }

  .gmail-sidebar.open-mobile {
    left: 0;
  }

  .gmail-floating-compose {
    width: 100% !important;
    right: 0 !important;
    border-radius: 16px 16px 0 0 !important;
  }

  .admin-tables-split {
    grid-template-columns: 1fr;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .full-width-field {
    grid-column: span 1;
  }

  .header-search-section {
    display: none;
  }
}
