/* ─── EpicRegards — App Styles ─────────────────────────────────────────────── */

:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1a1d23;
  --topbar-height: 56px;
  --primary: #4f6ef7;
  --primary-hover: #3b57d9;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
body {
  background: #f4f6fb;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.auth-body {
  background: linear-gradient(135deg, #1a1d23 0%, #2d3250 100%);
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  transition: width 0.2s ease;
  z-index: 100;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar .nav-link {
  color: rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

#sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

#sidebar .nav-link.active {
  color: #fff;
  background: var(--primary);
}

#sidebar .nav-link i {
  width: 18px;
  text-align: center;
}

.sidebar-brand span {
  font-size: 1.1rem;
}

/* ── Main content ───────────────────────────────────────────────────────────── */
.main-content {
  min-height: 100vh;
  min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .breadcrumb {
  font-size: 0.82rem;
}

/* ── Avatar circle ──────────────────────────────────────────────────────────── */
.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.x-small { font-size: 0.72rem; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid #e9ecef;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stat-card {
  border-radius: 12px;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-hover tbody tr:hover {
  background: #f8f9ff;
}

.table th {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
  border-bottom-width: 1px;
}

/* ── Status badges ──────────────────────────────────────────────────────────── */
.badge-active    { background: #d1fae5; color: #065f46; }
.badge-draft     { background: #fef3c7; color: #92400e; }
.badge-archived  { background: #f1f5f9; color: #475569; }
.badge-scheduled { background: #dbeafe; color: #1e40af; }
.badge-suspended { background: #fee2e2; color: #991b1b; }
.badge-invited   { background: #ede9fe; color: #5b21b6; }

/* ── Page header ────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

/* ── Search bar ─────────────────────────────────────────────────────────────── */
.search-bar {
  max-width: 280px;
}

/* ── Editor container ───────────────────────────────────────────────────────── */
.editor-wrapper {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
}

/* ── Placeholder chips ──────────────────────────────────────────────────────── */
.placeholder-chip {
  cursor: pointer;
  font-size: 0.78rem;
  font-family: monospace;
  user-select: none;
  transition: all 0.15s;
}

.placeholder-chip:hover {
  background: var(--primary) !important;
  color: #fff !important;
}

/* ── Media gallery ──────────────────────────────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.media-item {
  position: relative;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
  background: #f8f9fa;
}

.media-item:hover { border-color: var(--primary); }
.media-item.selected { border-color: var(--primary); }

.media-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.media-item .media-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.media-item.selected .media-check { display: flex; }

.media-item .media-name {
  padding: 4px 6px;
  font-size: 0.72rem;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sync log ───────────────────────────────────────────────────────────────── */
.sync-log-item {
  font-size: 0.8rem;
  padding: 2px 0;
  border-bottom: 1px solid #f0f0f0;
}

/* ── Dropdown action menu ───────────────────────────────────────────────────── */
.dropdown-menu {
  font-size: 0.85rem;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border: 1px solid #e9ecef;
}

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: 0.875rem; }

/* ── Responsive sidebar collapse ───────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: -240px;
    height: 100vh;
    transition: left 0.25s ease;
  }

  #sidebar.show {
    left: 0;
  }

  .main-content {
    margin-left: 0 !important;
  }
}

/* ── Signature preview iframe ───────────────────────────────────────────────── */
.sig-preview-frame {
  width: 100%;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #fff;
  min-height: 200px;
}

/* ── Tenant switch banner ───────────────────────────────────────────────────── */
.tenant-banner {
  background: #fff3cd;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
}
