/* ==========================================================================
   Lovable License Manager — Professional Reseller & Admin Portal CSS
   High-End Dark/Light Hybrid Studio Aesthetics
   ========================================================================== */

:root {
  --purple-primary: #4C00B0;
  --purple-hover: #3c008c;
  --purple-light: #f3e8ff;
  --purple-text: #4C00B0;
  --ethio-green: #009639;
  
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  
  --border-color: #e2e8f0;
  --border-focus: #4C00B0;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  height: 100%;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  font-family: var(--font-sans);
  background-color: #f8fafc !important;
  background: #f8fafc !important;
  color: #0f172a !important;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Auth Gate Modal Screen (Light Mode) */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--purple-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 20px rgba(76, 0, 176, 0.3);
}

.auth-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
  margin: 1.25rem 0 1rem 0;
  transition: border-color 0.2s ease;
}

.auth-input:focus {
  border-color: var(--purple-primary);
}

/* App Shell Layout */
.app-layout {
  display: flex;
  min-height: 100dvh;
  width: 100%;
  background-color: #f8fafc !important;
  background: #f8fafc !important;
}

/* Sidebar Navigation (Light Mode) */
.sidebar {
  width: 260px;
  background-color: #ffffff !important;
  border-right: 1px solid #e2e8f0 !important;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: #ffffff;
}

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--purple-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-text h2 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.sidebar-brand-text span {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ethio-green);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-menu {
  flex: 1;
  padding: 1.25rem 0.85rem;
  overflow-y: auto;
  background-color: #ffffff;
}

.menu-section-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.65rem;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.menu-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.menu-item.active {
  background: #4C00B0 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(76, 0, 176, 0.25);
}

.menu-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  background-color: #ffffff;
}

.user-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  padding: 0.6rem 0.85rem;
}

/* Main Content Area */
.main-wrapper {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: calc(100% - 260px);
  background-color: #f8fafc !important;
  background: #f8fafc !important;
}

.top-bar {
  height: 68px;
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.top-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

.status-pill-green {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  padding: 0.3rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.page-content {
  padding: 2rem;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  background-color: #f8fafc !important;
  background: #f8fafc !important;
}

/* Cards & Grid Layouts */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 900;
  color: #0f172a;
}

/* Action Buttons */
.btn-purple {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--purple-primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 0.65rem 1.25rem;
  border-radius: 0.65rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-purple:hover {
  background: var(--purple-hover);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 0.65rem 1.25rem;
  border-radius: 0.65rem;
  border: 1px solid #cbd5e1;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* Form Controls & Tables */
.card-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.custom-table th {
  background: #f8fafc;
  padding: 0.85rem 1rem;
  color: #64748b;
  font-weight: 800;
  border-bottom: 1px solid #e2e8f0;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.custom-table td {
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
  font-weight: 600;
}

.custom-table tr:hover td {
  background: #f8fafc;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

/* ========================================================================
   Partner portal release-desk refresh
   ======================================================================== */
:root {
  --portal-paper: #f7f6f2;
  --portal-surface: #fffefa;
  --portal-muted-surface: #ecebe5;
  --portal-ink: #1b1d1b;
  --portal-muted: #5d625d;
  --portal-line: #d8d6ce;
  --portal-accent: #b6532d;
  --portal-green: #23664a;
  --portal-mono: 'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; }
body { background: var(--portal-paper) !important; color: var(--portal-ink) !important; font-family: 'DM Sans', sans-serif !important; }
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.2; background-image: radial-gradient(rgba(27, 29, 27, 0.08) 0.6px, transparent 0.6px); background-size: 7px 7px; mask-image: linear-gradient(to bottom, black, transparent 70%); }
.app-layout, .main-wrapper, .page-content { background: transparent !important; }
.app-layout, .main-wrapper, .top-bar, .sidebar, .page-content { position: relative; z-index: 1; }
.auth-overlay, #authGate, #magicModalOverlay { background: rgba(27, 29, 27, 0.86) !important; }
#authGate > div, #magicModalOverlay > div { background: var(--portal-surface) !important; border-color: var(--portal-line) !important; box-shadow: 0 24px 60px rgba(27, 29, 27, 0.2) !important; }
#authGate .bg-purple-50, #authGate .bg-purple-100, #magicModalOverlay .bg-purple-50, #magicModalOverlay .bg-purple-100 { background: var(--portal-muted-surface) !important; border-color: var(--portal-line) !important; }
#authGate .bg-primary-container, #magicModalOverlay .bg-primary-container { background: var(--portal-accent) !important; }
#authGate .text-primary, #magicModalOverlay .text-primary { color: var(--portal-accent) !important; }
#authGate input, #magicModalOverlay input { background: var(--portal-surface) !important; border-color: var(--portal-line) !important; }
#authGate input:focus, #magicModalOverlay input:focus { border-color: var(--portal-accent) !important; }
.sidebar { background: rgba(255, 254, 250, 0.94) !important; border-color: var(--portal-line) !important; box-shadow: 10px 0 34px rgba(35, 42, 35, 0.04); }
.sidebar-header, .sidebar-footer { background: transparent !important; border-color: var(--portal-line) !important; }
.sidebar-brand-text h2, .top-title, .page-content h1, .page-content h2, .page-content h3, .page-content h4 { color: var(--portal-ink) !important; letter-spacing: -0.025em; }
.sidebar-brand-text span { color: var(--portal-green) !important; }
.sidebar-menu { background: transparent !important; }
.menu-item { color: var(--portal-muted) !important; border-radius: 0.6rem !important; min-height: 44px; transition: background 180ms ease, color 180ms ease, transform 180ms ease; }
.menu-item:hover { background: var(--portal-muted-surface) !important; color: var(--portal-ink) !important; transform: translateX(2px); }
.menu-item.active { background: var(--portal-accent) !important; color: #fff !important; box-shadow: none !important; }
.menu-item.active svg, .menu-item.active span { color: #fff !important; }
.top-bar { background: rgba(255, 254, 250, 0.92) !important; border-color: var(--portal-line) !important; box-shadow: 0 8px 20px rgba(35, 42, 35, 0.04); }
.top-bar > div:first-of-type p { color: var(--portal-muted) !important; }
.page-content { padding: clamp(1rem, 3vw, 2.25rem) !important; }
.page-content [style*="background: #ffffff"], .page-content [style*="background:#ffffff"], .page-content .card-box, .page-content .stat-card { background: rgba(255, 254, 250, 0.86) !important; border-color: var(--portal-line) !important; box-shadow: none !important; }
.page-content [style*="background: #f8fafc"], .page-content [style*="background:#f8fafc"] { background: var(--portal-muted-surface) !important; }
.page-content [style*="color: #0f172a"], .page-content [style*="color:#0f172a"] { color: var(--portal-ink) !important; }
.page-content [style*="color: #64748b"], .page-content [style*="color:#64748b"] { color: var(--portal-muted) !important; }
.btn-purple { background: var(--portal-accent) !important; color: #fff !important; box-shadow: none !important; }
.btn-purple:hover { background: #8f3c22 !important; transform: translateY(-1px); }
.btn-purple:disabled, .btn-secondary:disabled { background: var(--portal-muted-surface) !important; border-color: var(--portal-line) !important; color: var(--portal-muted) !important; cursor: not-allowed !important; opacity: 0.72; transform: none !important; }
.btn-secondary { background: var(--portal-muted-surface) !important; border-color: var(--portal-line) !important; color: var(--portal-ink) !important; }
.btn-secondary:hover { background: var(--portal-surface) !important; }
input, select, textarea { min-height: 44px; border-color: var(--portal-line) !important; background: var(--portal-surface) !important; color: var(--portal-ink) !important; }
input:focus, select:focus, textarea:focus { border-color: var(--portal-accent) !important; box-shadow: 0 0 0 3px rgba(182, 83, 45, 0.14) !important; outline: none !important; }
button, [role='button'], .menu-item, summary { cursor: pointer; }
:where(a, button, input, select, textarea, summary, [role='button']):focus-visible { outline: 3px solid rgba(182, 83, 45, 0.45) !important; outline-offset: 3px; }
.custom-table th { background: var(--portal-muted-surface) !important; color: var(--portal-muted) !important; border-color: var(--portal-line) !important; }
.custom-table td { border-color: var(--portal-line) !important; color: var(--portal-ink) !important; }
.custom-table tr:hover td { background: rgba(236, 235, 229, 0.55) !important; }
.portal-menu-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--portal-line); border-radius: 0.65rem; background: var(--portal-surface); align-items: center; justify-content: center; flex-direction: column; gap: 4px; cursor: pointer; }
.portal-menu-toggle span { width: 17px; height: 2px; border-radius: 99px; background: var(--portal-ink); transition: transform 180ms ease, opacity 180ms ease; }
.portal-menu-toggle[aria-expanded='true'] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.portal-menu-toggle[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.portal-menu-toggle[aria-expanded='true'] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.portal-notice { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 100000; max-width: min(28rem, calc(100vw - 2rem)); padding: 0.85rem 1rem; border: 1px solid var(--portal-line); border-radius: 0.7rem; background: var(--portal-ink); color: #fff; box-shadow: 0 18px 42px rgba(27, 29, 27, 0.18); font-size: 0.82rem; font-weight: 700; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }

/* The icon font is intentionally not a network dependency. If it is unavailable,
   keep its labels from rendering as oversized words behind the auth gate. */
.material-symbols-outlined { font-family: inherit !important; font-size: 0 !important; line-height: 1 !important; }
.material-symbols-outlined::before { content: ""; display: block; width: 0.48rem; height: 0.48rem; margin: auto; border-radius: 50%; background: currentColor; }
/* Keep small utility labels readable on the light portal surfaces. */
.text-slate-400 { color: #64748b !important; }
.text-slate-500 { color: #52606f !important; }
.text-emerald-600 { color: #047857 !important; }
.text-\[10px\].tracking-widest { color: #64748b !important; }
.portal-notice.is-visible { opacity: 1; transform: translateY(0); }
.portal-notice[data-tone='success'] { background: var(--portal-green); }
.portal-notice[data-tone='error'] { background: #8f2d28; }

@media (max-width: 900px) {
  .portal-menu-toggle { display: flex; flex-shrink: 0; }
  .sidebar { transform: translateX(-102%); transition: transform 220ms ease; box-shadow: 18px 0 40px rgba(35, 42, 35, 0.14); }
  .sidebar.is-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; width: 100% !important; }
  .top-bar { gap: 0.8rem; padding: 0.75rem 1rem !important; }
  .top-bar > div:first-of-type { min-width: 0; }
  .top-bar > div:last-child { gap: 0.4rem !important; }
  .top-bar > div:last-child > div:first-child { display: none !important; }
  .top-bar > div:last-child > div:nth-child(2) { display: none !important; }
  .top-bar > div:last-child > div:nth-child(3) { padding: 0.35rem 0.5rem !important; }
  .top-bar > div:last-child > div:nth-child(3) > span:last-child { display: none; }
  .page-content [style*="grid-template-columns: repeat(5"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .page-content [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 560px) {
  .top-bar h1 { font-size: 1.12rem !important; }
  .top-bar p { font-size: 0.72rem !important; }
  .top-bar > div:last-child > div:nth-child(3) { display: none !important; }
  .page-content { padding: 1rem !important; }
  .page-content [style*="grid-template-columns: repeat(5"] { grid-template-columns: 1fr !important; }
  .page-content [style*="display: flex; justify-content: space-between"] { align-items: flex-start !important; gap: 0.75rem; flex-wrap: wrap; }
  .portal-notice { right: 1rem; bottom: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
