/* ================================================================
   Liaison Central — Portal CSS
   Synced with Liaison Office M365-style design
   ================================================================ */

/* ── Variables (matched to LO) ────────────────────────────────── */
:root {
  --primary:          #0078d4;
  --primary-hover:    #106ebe;
  --primary-light:    #deecf9;
  --primary-dark:     #005a9e;
  --danger:           #d13438;
  --success:          #107c10;
  --warning:          #ffb900;

  --neutral-dark:     #201f1e;
  --neutral-primary:  #323130;
  --neutral-secondary:#605e5c;
  --neutral-tertiary: #a19f9d;
  --neutral-light:    #edebe9;
  --neutral-lighter:  #f3f2f1;
  --neutral-white:    #ffffff;

  --header-bg:        #0078d4;
  --sidebar-bg:       #faf9f8;
  --sidebar-hover:    #f3f2f1;
  --sidebar-active:   #e1dfdd;
  --sidebar-border:   #edebe9;

  --header-height:    40px;
  --sidebar-width:    220px;
  --radius:           4px;
  --radius-md:        6px;
  --radius-lg:        8px;
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.08);
  --shadow:           0 2px 8px rgba(0,0,0,0.10);
  --shadow-lg:        0 4px 20px rgba(0,0,0,0.12);

  /* Legacy aliases for existing views */
  --text:             var(--neutral-primary);
  --text-muted:       var(--neutral-secondary);
  --text-light:       var(--neutral-tertiary);
  --surface:          var(--neutral-lighter);
  --bg:               var(--neutral-lighter);
  --border:           var(--neutral-light);
  --white:            var(--neutral-white);
  --navy:             #0D2137;
  --teal:             var(--primary);
  --teal-light:       var(--primary-light);
  --amber-light:      #FEF3C7;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Segoe UI', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px; color: var(--neutral-primary); background: var(--neutral-lighter);
}
a      { color: var(--primary); text-decoration: none; }
a:hover{ text-decoration: underline; }
h1,h2,h3,h4 { margin: 0 0 8px; font-weight: 600; }

/* ── Portal Layout ────────────────────────────────────────────── */
.portal-wrap {
  display: grid;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-areas: "header header" "sidebar main";
  min-height: 100vh;
}
.portal-body { display: contents; }

/* ── Topbar ───────────────────────────────────────────────────── */
.topbar {
  grid-area: header;
  height: var(--header-height);
  background: var(--header-bg);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.topbar-brand .brand-logo { height: 22px; width: auto; }
.topbar-brand .brand-name {
  font-size: 18px; font-weight: 700; color: white;
  letter-spacing: -0.01em;
}
.topbar-brand .brand-name span { color: rgba(255,255,255,0.75); font-weight: 400; }
.topbar-spacer { flex: 1; }

/* Topbar platform badge */
.topbar-platform { display: flex; align-items: center; margin-right: 4px; }
.platform-badge {
  font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.15); padding: 4px 12px; border-radius: 4px;
}

/* Topbar user menu */
.topbar-user-menu { position: relative; }
.topbar-user-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; transition: background 0.12s;
}
.topbar-user-btn:hover { background: rgba(255,255,255,0.12); }
.topbar-user-btn .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.3);
}
.topbar-user-btn .user-name { font-size: 14px; color: rgba(255,255,255,0.9); font-weight: 500; }
.topbar-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: white; border: 1px solid var(--neutral-light); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); min-width: 180px; z-index: 200; overflow: hidden;
}
.topbar-dropdown a {
  display: block; padding: 10px 16px; font-size: 14px;
  color: var(--neutral-primary); text-decoration: none; transition: background 0.1s;
}
.topbar-dropdown a:hover { background: var(--neutral-lighter); text-decoration: none; }
.topbar-dropdown.hidden { display: none; }
.topbar-auth { display: flex; align-items: center; gap: 12px; }
.topbar-auth a { color: rgba(255,255,255,0.85); font-size: 14px; }

/* Hamburger toggle — always visible */
.menu-toggle {
  display: flex; align-items: center;
  background: none; border: none; cursor: pointer;
  padding: 6px; color: white;
}
.menu-toggle svg { width: 24px; height: 24px; }

/* ── Sidebar (matched to LO) ─────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 8px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Nav sections (collapsible) */
.nav-section { margin: 2px 4px; }
.nav-section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; cursor: pointer; border-radius: var(--radius);
  color: var(--neutral-primary); font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.04em;
  transition: background 0.12s;
}
.nav-section-header:hover { background: var(--sidebar-hover); }
.nav-chevron {
  width: 10px; height: 10px; color: var(--neutral-tertiary);
  transition: transform 0.2s ease; order: -1; flex-shrink: 0;
}
.nav-section:not(.expanded) .nav-chevron { transform: rotate(-90deg); }
.nav-section.expanded .nav-chevron { transform: rotate(0deg); }
.nav-submenu {
  list-style: none; margin: 0; padding: 0 0 0 16px;
  display: none;
}
.nav-section.expanded .nav-submenu { display: block; }
.nav-subitem {
  padding: 7px 12px; border-radius: var(--radius); cursor: pointer;
  color: var(--neutral-secondary); font-size: 13px;
  transition: all 0.12s; display: block; text-decoration: none;
}
.nav-subitem:hover { background: var(--sidebar-hover); color: var(--neutral-primary); text-decoration: none; }
.nav-subitem.active { background: var(--sidebar-active); color: var(--neutral-primary); font-weight: 600; }

/* Sidebar contact footer */
.sidebar-contact { padding: 8px 12px; margin-top: auto; }
.contact-card {
  font-size: 12px; color: var(--neutral-secondary); line-height: 1.6;
  padding: 10px 12px; background: var(--neutral-white); border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
}
.contact-card strong { color: var(--neutral-primary); font-size: 13px; }
.contact-card a { font-size: 12px; }

/* ── Main Content ─────────────────────────────────────────────── */
.main-content {
  grid-area: main;
  padding: 0 24px 24px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  background: var(--neutral-white);
}

/* ── Page header ──────────────────────────────────────────────── */
.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-top: 16px;
}
.page-header-row h1 { margin: 0; font-size: 24px; font-weight: 600; color: var(--neutral-dark); }

/* ── Breadcrumb ───────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 0; font-size: 12px; color: var(--neutral-secondary);
}
.breadcrumb a { color: var(--neutral-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--neutral-tertiary); }

/* ── Data Table (matched to LO) ───────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--neutral-secondary);
  border-bottom: 1px solid var(--neutral-light); background: var(--neutral-lighter);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--neutral-light); vertical-align: middle; }
.data-table tr:hover td { background: var(--primary-light); }
.data-table a { font-weight: 600; }

/* ── Ticket filter bar (matched to LO) ────────────────────────── */
.ticket-filters { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.filter-btn {
  padding: 6px 16px; border: 1px solid var(--neutral-light); border-radius: var(--radius);
  background: white; color: var(--neutral-secondary); font-size: 13px;
  font-weight: 500; cursor: pointer; transition: all 0.12s;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* ── Badges ───────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.badge-new    { background: #fff4ce; color: #8a6914; }
.badge-open   { background: var(--primary-light); color: var(--primary); }
.badge-active { background: #fde7e9; color: #a4262c; }
.badge-closed { background: var(--neutral-lighter); color: var(--neutral-secondary); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer; border: none;
  transition: all 0.12s; text-decoration: none;
}
.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color: white; text-decoration: none; }
.btn-secondary { background: white; color: var(--primary); border: 1px solid var(--primary); }
.btn-secondary:hover { background: var(--primary-light); text-decoration: none; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-block { width: 100%; display: block; text-align: center; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: var(--neutral-primary); margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--neutral-tertiary);
  border-radius: var(--radius); font-size: 14px;
  background: var(--neutral-white); color: var(--neutral-primary);
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* ── Alerts ───────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fde7e9; color: #a4262c; border: 1px solid #f1bbbc; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #a9d3f2; }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--neutral-secondary); }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--neutral-primary); margin-bottom: 8px; }

/* ── Portal copyright ─────────────────────────────────────────── */
.portal-copyright {
  text-align: center; padding: 12px 20px; font-size: 11px;
  color: var(--neutral-tertiary); border-top: 1px solid var(--neutral-light);
  background: var(--sidebar-bg);
}
.portal-copyright a { color: var(--neutral-secondary); }

/* ── Auth pages (login, set-password) ─────────────────────────── */
.auth-body { background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-wrap { width: 100%; max-width: 420px; padding: 20px; }
.auth-card { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-card-header { background: var(--header-bg); padding: 24px; text-align: center; }
.auth-card-header .auth-logo { height: 40px; }
.auth-card-body { padding: 28px 32px; }
.auth-title { font-size: 20px; font-weight: 600; text-align: center; color: var(--neutral-dark); margin-bottom: 4px; }
.auth-subtitle { font-size: 14px; color: var(--neutral-secondary); text-align: center; margin-bottom: 20px; }
.password-rules { margin: 12px 0; }
.password-rules .rule { display: block; font-size: 13px; color: var(--neutral-tertiary); margin-bottom: 4px; }

/* ── Sidebar collapse (desktop) ────────────────────────────── */
.portal-wrap.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}
.portal-wrap.sidebar-collapsed .sidebar {
  display: none;
}

/* ── Responsive (mobile) ──────────────────────────────────── */
@media (max-width: 768px) {
  .portal-wrap { grid-template-columns: 1fr; grid-template-areas: "header" "main"; }
  .portal-wrap.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; left: 0; top: var(--header-height); bottom: 0; width: 280px; z-index: 99; box-shadow: var(--shadow-lg); }
  .sidebar.open { display: flex; }
  .main-content { padding: 0 16px 16px 16px; }
}
