/* PixMail — CSS glassmorphisme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary:   #0a0a1a;
  --bg-secondary: #0f0f2a;
  --glass-bg:     rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.12);
  --accent:       #8b5cf6;
  --accent-light: #a78bfa;
  --accent-glow:  rgba(139,92,246,0.3);
  --cyan:         #06b6d4;
  --danger:       #ef4444;
  --success:      #10b981;
  --warning:      #f59e0b;
  --text:         #e2e8f0;
  --text-muted:   #94a3b8;
  --sidebar-w:    270px;
  --list-w:       380px;
}

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

html, body { height: 100%; overflow: hidden; font-family: 'Inter', sans-serif; color: var(--text); }

body {
  background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #0d1a2e 100%);
  background-attachment: fixed;
}

/* Particules animées en arrière-plan */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(139,92,246,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(6,182,212,0.06) 0%, transparent 50%);
  animation: bgPulse 8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes bgPulse {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}

/* Utilitaires glass */
.glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
}

/* ═══════════════════════════════════════
   LAYOUT PRINCIPAL
═══════════════════════════════════════ */
.app-container {
  position: fixed; inset: 0; z-index: 1;
  display: flex;
  gap: 0;
  padding: 12px;
  gap: 8px;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  position: relative;
  z-index: 1001;
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1), min-width 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px 12px;
  font-size: 1.2rem; font-weight: 700;
  color: var(--accent-light);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 4px;
  justify-content: flex-start;
}
.sidebar-logo i { font-size: 1.4rem; color: var(--accent); }

.account-selector {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.8rem;
}
.account-selector:hover { background: rgba(255,255,255,0.08); }
.account-selector .account-email { color: var(--text-muted); font-size: 0.75rem; }
.account-selector .account-name  { font-weight: 600; color: var(--text); }

.btn-compose {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 10px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border: none; border-radius: 8px;
  color: white; font-weight: 600; font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px var(--accent-glow);
  margin: 4px 0;
}
.btn-compose:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.folder-section-label {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 8px 4px 4px;
}

.folder-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 7px;
  cursor: pointer; font-size: 0.78rem;
  transition: background 0.15s ease;
  position: relative;
}
.folder-item i { width: 14px; text-align: center; color: var(--text-muted); font-size: 0.72rem; flex-shrink: 0; }
.folder-item .folder-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-item:hover { background: rgba(139,92,246,0.1); }
.folder-item.active { background: rgba(139,92,246,0.2); color: var(--accent-light); }
.folder-item.active i { color: var(--accent); }
.folder-item.has-unread { font-weight: 600; }

.unread-badge {
  background: var(--accent);
  color: white; font-size: 0.6rem; font-weight: 700;
  padding: 1px 5px; border-radius: 10px;
  min-width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; flex-shrink: 0;
}

.btn-new-folder {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 6px 10px;
  background: transparent; border: 1px dashed var(--glass-border);
  border-radius: 8px; color: var(--text-muted);
  font-size: 0.8rem; cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}
.btn-new-folder:hover { border-color: var(--accent); color: var(--accent); }

/* Footer items sidebar */
.sidebar-footer { padding: 8px 0 4px; border-top: 1px solid rgba(255,255,255,0.06); margin-top: auto; }
.footer-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 10px;
  color: var(--text-muted); text-decoration: none; background: transparent; border: none;
  cursor: pointer; width: 100%; font-size: 13px;
  transition: all 0.15s ease;
}
.footer-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
/* Footer collapsed : icône seule */
#sidebar.collapsed .footer-item { justify-content: center; padding: 8px 0; }
#sidebar.collapsed .footer-item .folder-label { display: none !important; }
#sidebar.collapsed .sidebar-lang { text-align: center; }
#sidebar.collapsed .lang-btn-sidebar { justify-content: center !important; padding: 8px 0 !important; background: transparent !important; border: none !important; }
#sidebar.collapsed .lang-btn-sidebar .folder-label { display: none !important; }

/* ═══ MESSAGE LIST ═══ */
.message-list {
  width: var(--list-w);
  min-width: var(--list-w);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1), min-width 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.2s ease;
}

.message-list-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.message-list-header .folder-title {
  font-weight: 600; font-size: 0.95rem; flex: 1;
}
.select-all-wrap { display: flex; align-items: center; gap: 8px; }
.search-wrap {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 6px; padding: 4px 8px; gap: 6px;
  flex: 1;
}
.search-wrap input {
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 0.82rem; width: 100%;
}
.search-wrap input::placeholder { color: var(--text-muted); }
.search-wrap i { color: var(--text-muted); font-size: 0.78rem; }

.bulk-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: rgba(139,92,246,0.08);
  border-bottom: 1px solid var(--accent-glow);
  flex-shrink: 0; font-size: 0.82rem;
}
.bulk-actions span { color: var(--accent-light); font-weight: 600; flex: 1; }
.bulk-actions button {
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.06);
  color: var(--text); font-size: 0.78rem;
  cursor: pointer; transition: all 0.2s;
}
.bulk-actions button:hover { background: rgba(255,255,255,0.12); }
.bulk-actions .btn-delete { border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.bulk-actions .btn-delete:hover { background: rgba(239,68,68,0.15); }

.messages-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
}
.messages-container::-webkit-scrollbar { width: 4px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 2px; }

/* ═══ EMAIL ROW ═══ */
.email-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s ease;
  position: relative;
  animation: fadeInRow 0.2s ease;
}
@keyframes fadeInRow {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.email-row:hover { background: rgba(139,92,246,0.08); }
.email-row.selected { background: rgba(139,92,246,0.15); border-left: 2px solid var(--accent); }
.email-row.active { background: rgba(139,92,246,0.2); }
.email-row.unread { font-weight: 600; }
.email-row.slide-out {
  animation: slideOut 0.25s ease forwards;
}
@keyframes slideOut {
  to { opacity: 0; transform: translateX(-100%); max-height: 0; padding: 0; overflow: hidden; }
}

.email-checkbox {
  opacity: 0; width: 14px; height: 14px; flex-shrink: 0;
  margin-top: 2px; cursor: pointer; accent-color: var(--accent);
}
.email-row:hover .email-checkbox,
.email-row.selected .email-checkbox { opacity: 1; }

.email-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; flex-shrink: 0;
  color: white; letter-spacing: 0.02em;
}

.email-body { flex: 1; min-width: 0; }
.email-from {
  font-size: 0.77rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.email-subject {
  font-size: 0.75rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.email-row.unread .email-subject { color: var(--text); }
.email-preview {
  font-size: 0.7rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}

.email-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px; flex-shrink: 0; min-width: 50px;
}
.email-date { font-size: 0.72rem; color: var(--text-muted); }
.email-badges { display: flex; gap: 4px; align-items: center; }
.email-badges .unread-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.email-badges .attach-icon { color: var(--text-muted); font-size: 0.7rem; }
.email-badges .star-icon { color: var(--warning); font-size: 0.7rem; }

/* Empty + error states */
.list-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 200px;
  color: var(--text-muted); gap: 8px;
}
.list-empty i { font-size: 2rem; color: var(--accent-glow); }

/* Skeleton */
.skeleton-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.05) 25%,
    rgba(255,255,255,0.1) 50%,
    rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}
.skeleton-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.pagination button {
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: transparent; color: var(--text-muted);
  font-size: 0.78rem; cursor: pointer; transition: all 0.2s;
}
.pagination button:hover,
.pagination button.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ═══ READING PANE ═══ */
.reading-pane {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
}

.reading-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); gap: 12px;
}
.reading-empty i { font-size: 3rem; color: rgba(139,92,246,0.3); }

.reading-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.reading-header {
  padding: 16px 20px; border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.reading-subject {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 8px;
  line-height: 1.3;
}
.reading-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px;
}
.reading-meta .meta-label { color: var(--text-muted); }
.reading-meta .meta-value { color: var(--text); }

.reading-toolbar {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.reading-toolbar button {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.06);
  color: var(--text); font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s;
}
.reading-toolbar button:hover { background: rgba(255,255,255,0.12); }
.reading-toolbar .btn-star.starred { color: var(--warning); }
.reading-toolbar .btn-delete { border-color: rgba(239,68,68,0.3); }
.reading-toolbar .btn-delete:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }

.reading-body {
  flex: 1; overflow: auto; padding: 0;
}
.reading-body iframe {
  width: 100%; height: 100%; border: none;
  background: white;
}

.reading-attachments {
  padding: 12px 20px; border-top: 1px solid var(--glass-border);
  display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0;
}
.attachment-card {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
  font-size: 0.78rem; color: var(--text-muted);
}
.attachment-card i { color: var(--accent); }

/* ═══ CONTEXT MENU ═══ */
.context-menu {
  position: fixed; z-index: 9999;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(15,10,30,0.95);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  min-width: 180px; overflow: hidden;
  animation: ctxFadeIn 0.12s ease;
}
@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.ctx-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 0.83rem; cursor: pointer;
  transition: background 0.15s;
}
.ctx-item i { width: 14px; text-align: center; color: var(--text-muted); }
.ctx-item:hover { background: rgba(139,92,246,0.15); color: var(--accent-light); }
.ctx-item:hover i { color: var(--accent); }
.ctx-item.danger:hover { background: rgba(239,68,68,0.1); color: #fca5a5; }
.ctx-item.danger:hover i { color: #ef4444; }
.ctx-separator { height: 1px; background: var(--glass-border); margin: 4px 0; }
.ctx-submenu { position: relative; }
.ctx-submenu-content {
  position: absolute; left: 100%; top: -4px;
  background: rgba(15,10,30,0.95);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 8px; min-width: 160px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: none;
}
.ctx-submenu:hover .ctx-submenu-content { display: block; }

/* ═══ MODALS ═══ */
/* ═══ MODAUX — animation unifiée ═══ */
@@keyframes pmOverlayIn {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to   { opacity: 1; backdrop-filter: blur(10px); }
}
@@keyframes pmModalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.96); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0) scale(1);    filter: blur(0px); }
}
@@keyframes pmModalOut {
  from { opacity: 1; transform: translateY(0) scale(1);    filter: blur(0px); }
  to   { opacity: 0; transform: translateY(18px) scale(0.96); filter: blur(4px); }
}

.modal-overlay {
  position: fixed; inset: 0; z-index: 8888;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  display: flex; align-items: center; justify-content: center;
  animation: pmOverlayIn 0.25s cubic-bezier(0.4,0,0.2,1) forwards;
}
.modal-overlay.closing {
  animation: pmOverlayOut 0.2s cubic-bezier(0.4,0,0.2,1) forwards;
}
@@keyframes pmOverlayOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.modal-box {
  background: rgba(15,10,35,0.95);
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 18px;
  width: 560px; max-width: 95vw; max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 72px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.04) inset;
  animation: pmModalIn 0.28s cubic-bezier(0.34,1.2,0.64,1) forwards;
}
.modal-box.closing {
  animation: pmModalOut 0.18s cubic-bezier(0.4,0,0.2,1) forwards;
}

/* Classe utilitaire pour les modaux JS dynamiques (account ctx, lang modal, etc.) */
.pm-modal-anim {
  animation: pmModalIn 0.28s cubic-bezier(0.34,1.2,0.64,1) forwards;
}
.pm-overlay-anim {
  animation: pmOverlayIn 0.25s cubic-bezier(0.4,0,0.2,1) forwards;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--glass-border);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: transparent; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 1.1rem;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--glass-border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ═══ FORM ELEMENTS ═══ */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.form-control {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 8px 12px;
  color: var(--text); font-size: 0.85rem;
  outline: none; transition: border-color 0.2s;
  font-family: 'Inter', sans-serif;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }
select.form-control option { background: #1a0a2e; }

/* Tags input (To, Cc, Bcc) */
.tags-input {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 6px 10px; min-height: 38px;
  cursor: text;
}
.tags-input:focus-within { border-color: var(--accent); }
.tag {
  display: flex; align-items: center; gap: 4px;
  background: rgba(139,92,246,0.25); border: 1px solid var(--accent-glow);
  border-radius: 4px; padding: 2px 8px; font-size: 0.75rem;
}
.tag button { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.7rem; }
.tags-input-field {
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 0.82rem; min-width: 120px; flex: 1;
}

/* ═══ BUTTONS ═══ */
.btn {
  padding: 8px 16px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px var(--accent-glow); }
.btn-secondary {
  background: rgba(255,255,255,0.06);
  border-color: var(--glass-border); color: var(--text);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-danger {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3); color: #fca5a5;
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 4px 10px; font-size: 0.78rem; }

/* ═══ CHECKBOX CUSTOM ═══ */
input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--accent); cursor: pointer;
}

/* ═══ TOAST ═══ */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 99999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  font-size: 0.85rem; min-width: 200px; max-width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  animation: toastIn 0.25s ease;
}
.toast.success { background: rgba(16,185,129,0.2); border-color: rgba(16,185,129,0.4); }
.toast.error   { background: rgba(239,68,68,0.2);  border-color: rgba(239,68,68,0.4); }
.toast.info    { background: rgba(6,182,212,0.2);   border-color: rgba(6,182,212,0.4); }
.toast i { font-size: 1rem; }
.toast.success i { color: var(--success); }
.toast.error   i { color: var(--danger); }
.toast.info    i { color: var(--cyan); }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(40px); max-height: 0; margin: 0; padding: 0; } }

/* ═══ SCROLLBAR GLOBAL ═══ */
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* ═══ AUTH PAGE ═══ */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
}
.auth-card {
  width: 380px; max-width: 95vw;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 20px; padding: 36px 32px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}
.auth-logo {
  text-align: center; margin-bottom: 28px;
}
.auth-logo i { font-size: 2.5rem; color: var(--accent); display: block; margin-bottom: 8px; }
.auth-logo h1 { font-size: 1.6rem; font-weight: 700; color: var(--accent-light); }
.auth-logo p  { font-size: 0.82rem; color: var(--text-muted); }
.auth-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px; padding: 10px 12px;
  font-size: 0.82rem; color: #fca5a5; margin-bottom: 12px;
}

/* ═══ ACCOUNTS PAGE ═══ */
.page-wrap {
  min-height: 100vh; padding: 24px; position: relative; z-index: 1;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); text-decoration: none; font-size: 0.85rem;
  margin-bottom: 16px; transition: color 0.2s;
}
.back-link:hover { color: var(--accent-light); }

.account-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; border-radius: 12px; margin-bottom: 10px;
  backdrop-filter: blur(12px);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  transition: border-color 0.2s;
}
.account-card:hover { border-color: var(--accent-glow); }
.account-card .ac-info { flex: 1; }
.account-card .ac-label { font-weight: 600; margin-bottom: 2px; }
.account-card .ac-email { font-size: 0.82rem; color: var(--text-muted); }
.account-card .ac-host  { font-size: 0.75rem; color: var(--text-muted); }

/* ═══ ADMIN PAGE ═══ */
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.admin-table th {
  text-align: left; padding: 10px 14px;
  background: rgba(139,92,246,0.1); color: var(--accent-light);
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.admin-table td {
  padding: 10px 14px; border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
}
.admin-table tr:hover td { background: rgba(255,255,255,0.03); }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 0.72rem; font-weight: 600;
}
.badge-cyan    { background: rgba(6,182,212,0.2);  color: var(--cyan);         border: 1px solid rgba(6,182,212,0.3);  }
.badge-violet  { background: rgba(139,92,246,0.2); color: var(--accent-light); border: 1px solid rgba(139,92,246,0.3); }
.badge-green   { background: rgba(16,185,129,0.2); color: #34d399;             border: 1px solid rgba(16,185,129,0.3); }

/* ═══ LOADING SPINNER ═══ */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(139,92,246,0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE MOBILE — PixMail
════════════════════════════════════════════════════════ */

/* Mobile ≤768px : layout 1 colonne */
@media (max-width: 768px) {
  .app-container { padding: 0; gap: 0; }

  /* Sidebar → drawer plein écran sur mobile */
  #sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    width: 100vw !important; min-width: 0 !important;
    z-index: 1001; border-radius: 0;
    transform: translateX(-100vw);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }
  #sidebar.open { transform: translateX(0); }

  /* Liste emails prend toute la largeur */
  #message-list {
    width: 100% !important; min-width: 100% !important;
    border-radius: 0; position: relative;
  }
  .message-list-header { padding-top: 14px; padding-left: 56px; }

  /* Panel lecture → fullscreen overlay */
  #message-panel {
    position: fixed; inset: 0; z-index: 900;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }
  #message-panel.open { transform: translateX(0); }

  /* Bouton hamburger visible */
  #hamburger-btn { display: flex; }

  /* Bouton retour dans le panel */
  #back-btn { display: flex; }
}

/* Tablet 769-1024px : sidebar collapsée */
@media (min-width: 769px) and (max-width: 1024px) {
  #sidebar { width: 200px; min-width: 200px; }
  #message-list { width: 300px; min-width: 300px; }
}

/* ═══════════════════════════════════════════════════════
   ANIMATIONS FLUIDES
════════════════════════════════════════════════════════ */

/* Transition inbox → panel lecture */
#message-panel {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

/* Language switcher dropdown */
.lang-dropdown {
  animation: slideDown 0.2s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Email row hover */
.email-row { transition: all 0.15s ease; }

/* Toast notification */
.toast { animation: toastIn 0.3s ease; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ══ Collapse colonnes ══ */
#sidebar.collapsed {
  width: 48px !important; min-width: 48px !important;
  overflow: visible !important;
}
/* Cacher tous les textes/labels quand collapsed */
#sidebar.collapsed .sidebar-logo span,
#sidebar.collapsed .sidebar-logo .col-collapse-btn,
#sidebar.collapsed .folder-label,
#sidebar.collapsed .folder-count,
#sidebar.collapsed .sidebar-footer a span,
#sidebar.collapsed .sidebar-footer button span,
#sidebar.collapsed .ai-label,
#sidebar.collapsed .ai-toggle-bar,
#sidebar.collapsed .btn-new-folder,
#sidebar.collapsed .sidebar-lang,
#sidebar.collapsed #compose-btn span,
#sidebar.collapsed #account-selector {
  display: none !important;
}
#sidebar.collapsed .folder-item { justify-content: center; padding: 8px 0; position: relative; }
#sidebar.collapsed .folder-item i { width: auto; margin: 0; }
#sidebar.collapsed #compose-btn { justify-content: center; padding: 10px 0; width: 100%; }
/* Logo collapsed = hamburger centré uniquement */
#sidebar.collapsed .sidebar-logo {
  justify-content: center; padding: 10px 0;
}
/* Cacher l'icône enveloppe quand collapsed */
#sidebar.collapsed .sidebar-logo > i:first-child {
  display: none !important;
}
/* Bouton collapse visible et centré quand collapsed */
#sidebar.collapsed .sidebar-logo .col-collapse-btn {
  display: flex !important;
  margin: 0 auto;
}
/* Pastilles CACHÉES en collapsed (affichées dans tooltip JS) */
#sidebar.collapsed .unread-badge { display: none !important; }
/* Compose en collapsed : juste l'icône, centré */
#sidebar.collapsed #compose-btn span,
#sidebar.collapsed .btn-compose span,
#sidebar.collapsed .btn-compose .compose-label { display: none !important; }
#sidebar.collapsed #compose-btn,
#sidebar.collapsed .btn-compose {
  justify-content: center !important;
  padding: 10px 0 !important;
  width: 100% !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#message-list.collapsed {
  width: 0 !important; min-width: 0 !important;
  opacity: 0; pointer-events: none;
}

/* Boutons collapse */
.col-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(139,92,246,0.12); border: 1px solid rgba(139,92,246,0.25);
  color: rgba(139,92,246,0.8); cursor: pointer; flex-shrink: 0;
  transition: all 0.2s ease; font-size: 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.col-collapse-btn:hover {
  background: rgba(139,92,246,0.28); color: var(--accent-light);
  border-color: rgba(139,92,246,0.6); box-shadow: 0 2px 8px rgba(139,92,246,0.25);
  transform: scale(1.08);
}
.col-collapse-btn i { pointer-events: none; }


/* Bouton expand liste (dans reading-pane quand liste collapsed) */
.col-expand-list {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  z-index: 50; width: 38px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(139,92,246,0.35), rgba(99,57,210,0.45));
  border: 1px solid rgba(139,92,246,0.6);
  color: #c4b5fd; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 18px rgba(139,92,246,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
}
.col-expand-list:hover {
  background: linear-gradient(135deg, rgba(139,92,246,0.55), rgba(99,57,210,0.65));
  box-shadow: 0 6px 24px rgba(139,92,246,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  color: #ede9fe; transform: translateY(-50%) scale(1.06);
  border-color: rgba(167,139,250,0.8);
}

/* ── Icônes flag répondu / transféré ── */
.msg-flag-icon { font-size: 10px; color: var(--accent-light); opacity: 0.8; margin-left: 2px; }
.msg-flag-icon.msg-forwarded { color: var(--cyan); }

/* ── Tag Input (To/Cc/Bcc) ── */
.tag-input-wrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  min-height: 38px; padding: 4px 8px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; cursor: text;
  transition: border-color .15s;
}
.tag-input-wrap:focus-within { border-color: var(--accent); }
.tag-input-field {
  flex: 1; min-width: 120px; background: transparent; border: none;
  color: var(--text); font-size: 13px; outline: none; padding: 2px 4px;
}
.email-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(139,92,246,0.2); border: 1px solid rgba(139,92,246,0.35);
  border-radius: 20px; padding: 2px 8px; font-size: 12px; color: #c4b5fd;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag-remove {
  background: none; border: none; color: rgba(196,181,253,0.7);
  cursor: pointer; font-size: 14px; padding: 0 1px; line-height: 1;
  transition: color .1s;
}
.tag-remove:hover { color: #ef4444; }

/* ── Refresh button spin ── */
@@keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
#btn-refresh.spinning #btn-refresh-icon { animation: spin 0.8s linear; }
