/* ============================================================
   ALGEBRA STUDIO — PARTNER PORTAL DESIGN SYSTEM
   shared-styles.css
   Matches shared-nav.js class names: .portal-sidebar, .nav-section, etc.
   ============================================================ */

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

:root {
  --purple: #502D8C; --purple-dark: #3A1F66; --purple-light: #6B42B0; --purple-faint: #F3EFF9;
  --cyan: #19C1E1; --cyan-dark: #0EA3BF; --cyan-light: #E6F9FC;
  --red: #E03C26; --red-light: #FDF0EE;
  --gray-50: #FAFAFA; --gray-100: #F4F4F5; --gray-200: #E4E4E7; --gray-300: #D4D4D8;
  --gray-400: #A1A1AA; --gray-500: #71717A; --gray-600: #52525B; --gray-700: #3F3F46;
  --gray-800: #27272A; --gray-900: #18181B; --white: #FFFFFF;
  --sidebar-width: 240px; --header-height: 56px; --content-max: 960px;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.10);
  --shadow-card: 0 1px 4px rgba(0,0,0,0.06), 0 2px 12px rgba(0,0,0,0.04);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Reset & Base --- */
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Poppins', sans-serif;
  color: var(--gray-800); background: var(--gray-50);
  line-height: 1.6; min-height: 100vh;
}
a { color: var(--purple); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--purple-light); }
img { max-width: 100%; display: block; }

/* --- Typography --- */
h1, h2, h3, h4 { color: var(--gray-900); font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }
p { margin-bottom: 0.75rem; } p:last-child { margin-bottom: 0; }
small, .text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray-500); }

/* ============================================================
   LAYOUT — Sidebar + Main
   ============================================================ */
.portal-layout { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.portal-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width); background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
  transition: transform 0.3s ease;
}
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--gray-200);
  text-align: center;
}
.sidebar-logo > img { display: block; width: 100%; height: auto; }
.sidebar-label {
  display: block; margin-top: 10px;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gray-400);
}
.sidebar-partner {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--gray-100); text-align: center;
}
.sidebar-partner img {
  display: block; width: 100%; height: auto;
  max-height: 48px; object-fit: contain;
}
.sidebar-partner .partner-welcome {
  font-size: 1.3rem; font-weight: 600; color: var(--gray-600);
}

/* --- Nav --- */
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { margin-bottom: 4px; }
.nav-section-label {
  padding: 8px 20px 4px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--gray-400);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  font-size: 0.85rem; font-weight: 500; color: var(--gray-600);
  text-decoration: none; border-left: 3px solid transparent;
  cursor: pointer; transition: all 0.15s;
}
.nav-item:hover { color: var(--gray-900); background: var(--gray-50); }
.nav-item.active {
  color: var(--purple); background: var(--purple-faint);
  border-left-color: var(--purple); font-weight: 600;
}
.nav-item .nav-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-item .nav-icon svg {
  width: 16px; height: 16px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.nav-icon-img { display: inline-flex; align-items: center; justify-content: center; }
.nav-icon-img img { width: 24px; height: 24px; object-fit: contain; }

/* --- Sidebar Footer --- */
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--gray-200); }
.sidebar-footer .logout-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 8px 12px;
  font-family: 'Poppins', sans-serif; font-size: 0.8rem; font-weight: 500;
  color: var(--gray-500); background: none;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s;
}
.sidebar-footer .logout-btn:hover {
  color: var(--gray-700); border-color: var(--gray-300); background: var(--gray-50);
}

/* --- Main Content Area --- */
.main-content {
  flex: 1; margin-left: var(--sidebar-width);
  display: flex; flex-direction: column; min-height: 100vh;
}

/* --- Header --- */
.portal-header {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-height); padding: 0 32px;
  background: var(--white); border-bottom: 1px solid var(--gray-200);
}
.header-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--gray-500);
}
.header-breadcrumb .section { font-weight: 500; }
.header-breadcrumb .divider { color: var(--gray-300); }
.header-breadcrumb .page { color: var(--gray-800); font-weight: 600; }
.partner-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; font-size: 0.7rem; font-weight: 600;
  color: var(--purple); background: var(--purple-faint); border-radius: 20px;
}
.partner-badge .dot { width: 6px; height: 6px; background: var(--cyan); border-radius: 50%; }

.mobile-toggle {
  display: none; background: none; border: none;
  cursor: pointer; padding: 4px; color: var(--gray-700);
}

/* --- Page Content --- */
.page-content {
  flex: 1; padding: 32px;
  max-width: calc(var(--content-max) + 64px);
}
.page-title { margin-bottom: 4px; }
.page-subtitle {
  color: var(--gray-500); font-size: 0.9rem;
  margin-bottom: 28px; font-weight: 400;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); padding: 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 20px;
  font-family: 'Poppins', sans-serif; font-size: 0.85rem; font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s var(--ease-out);
  text-decoration: none; line-height: 1.4;
}
.btn-primary { color: var(--white); background: var(--purple); }
.btn-primary:hover { background: var(--purple-light); color: var(--white); }
.btn-secondary { color: var(--purple); background: var(--white); border: 1.5px solid var(--gray-200); }
.btn-secondary:hover { border-color: var(--purple); background: var(--purple-faint); }
.btn-ghost { background: transparent; color: var(--gray-500); }
.btn-ghost:hover { color: var(--purple); background: var(--purple-faint); }
.btn-sm { padding: 6px 14px; font-size: 0.75rem; }
.btn-lg { padding: 14px 28px; font-size: 0.95rem; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ============================================================
   BADGES / TAGS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; border-radius: 4px;
}
.badge-purple { color: var(--purple); background: var(--purple-faint); }
.badge-cyan { color: var(--cyan-dark); background: var(--cyan-light); }
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px; font-size: 0.7rem; font-weight: 500;
  border-radius: 20px; letter-spacing: 0.02em;
}
.tag-purple { background: var(--purple-faint); color: var(--purple); }
.tag-cyan   { background: var(--cyan-light);   color: var(--cyan-dark); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--gray-100);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 20px; font-size: 0.85rem; font-weight: 500;
  color: var(--gray-500); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.15s;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.tab:hover { color: var(--gray-900); }
.tab.active { color: var(--purple); border-bottom-color: var(--purple); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   ACCORDIONS
   ============================================================ */
.accordion {
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md); overflow: hidden;
}
.accordion + .accordion { margin-top: 8px; }
.accordion-trigger {
  width: 100%; padding: 16px 20px;
  background: var(--white); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Poppins', sans-serif; font-size: 0.9rem; font-weight: 500;
  color: var(--gray-900); transition: background 0.15s;
}
.accordion-trigger:hover { background: var(--gray-50); }
.accordion-chevron { transition: transform 0.25s ease; color: var(--gray-400); flex-shrink: 0; }
.accordion.open .accordion-chevron { transform: rotate(180deg); }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.accordion.open .accordion-content { max-height: 800px; }
.accordion-inner {
  padding: 0 20px 20px;
  color: var(--gray-700); font-size: 0.85rem; line-height: 1.7;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 0.8rem; font-weight: 500;
  color: var(--gray-700); margin-bottom: 6px;
}
.form-input {
  width: 100%; padding: 10px 14px;
  font-family: 'Poppins', sans-serif; font-size: 0.9rem;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--gray-900); background: var(--white);
}
.form-input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(80,45,140,0.1); }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-50);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 40px 32px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.login-card .sidebar-logo { border-bottom: none; padding-bottom: 0; }
.login-error {
  font-size: 0.78rem; color: var(--red); margin-top: 8px; display: none;
}
.login-error.visible { display: block; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeIn 0.4s var(--ease-out) both; }

/* ============================================================
   MOBILE OVERLAY
   ============================================================ */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .portal-sidebar { transform: translateX(-100%); }
  .portal-sidebar.open { transform: translateX(0); }
  .mobile-toggle { display: flex; }
  .main-content { margin-left: 0; }
  .page-content { padding: 20px 16px; }
}