/* EmailFlow SaaS Custom Styling */
:root {
  --ef-primary: #4f46e5;
  --ef-primary-hover: #4338ca;
  --ef-primary-light: #eef2ff;
  --ef-secondary: #64748b;
  --ef-dark: #0f172a;
  --ef-sidebar-bg: #1e293b;
  --ef-sidebar-color: #94a3b8;
  --ef-sidebar-active: #ffffff;
  --ef-sidebar-active-bg: #334155;
  --ef-sidebar-width: 260px;
  --ef-bg-light: #f8fafc;
  --ef-card-border: #e2e8f0;
  --ef-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --ef-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --ef-radius: 0.75rem;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--ef-bg-light);
  color: #334155;
  min-height: 100vh;
}

/* Auth Layout */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  border-radius: var(--ef-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ef-primary);
}

.auth-brand i {
  font-size: 1.8rem;
}

/* App Main Layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--ef-sidebar-width);
  background-color: var(--ef-sidebar-bg);
  color: var(--ef-sidebar-color);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease-in-out;
  z-index: 1040;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
}

.sidebar-brand {
  color: #ffffff;
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-brand i {
  color: #6366f1;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.sidebar-nav .nav-link {
  color: var(--ef-sidebar-color);
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.925rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.2rem;
  transition: all 0.2s ease;
}

.sidebar-nav .nav-link i {
  font-size: 1.1rem;
  width: 1.25rem;
  text-align: center;
  transition: color 0.2s ease;
}

.sidebar-nav .nav-link:hover {
  color: var(--ef-sidebar-active);
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav .nav-link.active {
  color: var(--ef-sidebar-active);
  background-color: var(--ef-primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.sidebar-nav .nav-link.disabled-placeholder {
  opacity: 0.65;
  cursor: default;
}

.sidebar-nav .nav-link .badge {
  margin-left: auto;
  font-size: 0.7rem;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid #334155;
  background-color: #0f172a;
}

.user-profile-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ef-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Main Content Area */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Navbar */
.app-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--ef-card-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--ef-shadow-sm);
}

/* Dashboard Cards */
.metric-card {
  background: #ffffff;
  border-radius: var(--ef-radius);
  border: 1px solid var(--ef-card-border);
  padding: 1.25rem;
  box-shadow: var(--ef-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ef-shadow-md);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.metric-icon.indigo {
  background-color: #eef2ff;
  color: #4f46e5;
}

.metric-icon.emerald {
  background-color: #ecfdf5;
  color: #10b981;
}

.metric-icon.amber {
  background-color: #fffbeb;
  color: #f59e0b;
}

.metric-icon.sky {
  background-color: #f0f9ff;
  color: #0ea5e9;
}

/* Custom Table */
.custom-table-card {
  background: #ffffff;
  border-radius: var(--ef-radius);
  border: 1px solid var(--ef-card-border);
  box-shadow: var(--ef-shadow-sm);
  overflow: hidden;
}

.custom-table-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--ef-card-border);
  padding: 1rem 1.25rem;
}

/* Fix Table Responsive Overflow Clipping & Dropdown Menus */
.card-body.overflow-visible,
.card.overflow-visible {
  overflow: visible !important;
}

.table-responsive {
  overflow-x: auto;
  overflow-y: visible !important;
  min-height: 220px;
}

.table-responsive .table {
  margin-bottom: 0;
}

.table-responsive .table td,
.table-responsive .table th {
  white-space: nowrap;
  vertical-align: middle;
}

/* Dropdown Menu Z-Index & Elevation */
.table .dropdown-menu {
  z-index: 1060 !important;
  border: 1px solid var(--ef-card-border) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
  border-radius: 0.5rem;
  padding: 0.4rem 0;
}

.table .dropdown-item {
  font-size: 0.875rem;
  padding: 0.45rem 1rem;
}

/* Responsive Sidebar Toggle */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
  }

  .app-sidebar.show {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1035;
    display: none;
  }

  .sidebar-backdrop.show {
    display: block;
  }
}
