/* ═══════════════════════════════════════════════════════════════════════════
   common.css — TKC Central shared design tokens, reset, and components
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  /* Typography */
  --heading: 'Playfair Display', Georgia, serif;
  --body:    'DM Sans', -apple-system, 'Segoe UI', sans-serif;
  --mono:    'IBM Plex Sans', sans-serif;

  /* Ink (text colors) */
  --ink:       #1a2332;
  --ink-2:     #2d3d4f;
  --ink-3:     #5a6d7e;
  --mute:      #8a9baa;

  /* Rules (borders) */
  --rule:    #c5cdd6;
  --rule-lt: #e4e9ee;

  /* Brand */
  --primary:      #2e5090;
  --primary-dark: #1e3668;
  --primary-lt:   #4a8bc2;
  --gold:         #c08a1a;
  --gold-lt:      #d4a94e;

  /* Surfaces */
  --bg:      #edf2f7;
  --surface: #ffffff;

  /* Status */
  --good: #15803d;
  --bad:  #b91c1c;
  --warn: #c08a1a;

  /* Elevation */
  --shadow-sm: 0 2px 8px rgba(30, 54, 104, 0.04);
  --shadow-md: 0 4px 16px rgba(30, 54, 104, 0.06);
  --shadow-lg: 0 8px 32px rgba(30, 54, 104, 0.12);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  animation: pageIn 0.3s ease-out;
}

@keyframes pageIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

::selection {
  background: var(--primary);
  color: #fff;
}
::-moz-selection {
  background: var(--primary);
  color: #fff;
}

/* ── Focus indicators ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Portal Nav (used by layout.ejs and pctr.ejs) ── */
.portal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 56px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(46, 80, 144, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}
.portal-nav::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(46, 80, 144, 0.18), transparent);
  pointer-events: none;
}

.portal-nav-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1;
}

.portal-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.portal-nav-brand-mark {
  width: 32px;
  height: 32px;
  display: block;
  background-color: var(--primary-dark);
  -webkit-mask: url('/favicon.png') center / contain no-repeat;
          mask: url('/favicon.png') center / contain no-repeat;
}
.portal-nav-logo {
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
}
.portal-nav-brand-text {
  font-family: var(--heading);
  font-size: 17px;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.2px;
}

.portal-nav-divider {
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, transparent, var(--rule), transparent);
  flex-shrink: 0;
}

.portal-nav-crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  min-width: 0;
  flex: 1;
}
.portal-nav-crumb {
  color: var(--mute);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: color 0.15s;
  white-space: nowrap;
}
.portal-nav-crumb:hover { color: var(--primary); }
.portal-nav-sep {
  color: var(--rule);
  font-size: 11px;
  flex-shrink: 0;
}
.portal-nav-current {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.portal-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Nav user section — shared by both class naming schemes */
.portal-nav-user,
.nav-user-area {
  display: flex;
  align-items: center;
  gap: 10px;
}
.portal-nav-avatar,
.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(46, 80, 144, 0.15);
}
.portal-nav-username,
.nav-username {
  font-family: var(--mono);
  font-size: 12px;
  color: #3d5a80;
  font-weight: 500;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sign-out button — all variants */
.portal-nav-signout,
.sign-out-btn {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--mute);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.portal-nav-signout:hover,
.sign-out-btn:hover {
  color: #dc2626;
  border-color: #dc2626;
  background: #fef2f2;
}

/* Sign-in button — all variants */
.portal-nav-signin,
.sign-in-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: #3d5a80;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 6px 14px;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.portal-nav-signin:hover,
.sign-in-btn:hover {
  border-color: #4285f4;
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.18);
}

/* Admin link in nav */
.admin-link {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.admin-link:hover { background: var(--primary); color: #fff; }

/* Mobile collapse */
@media (max-width: 768px) {
  .portal-nav { padding: 0 16px; }
  .portal-nav-divider { display: none; }
  .portal-nav-crumb, .portal-nav-sep { display: none; }
  .portal-nav-username, .nav-username { max-width: 80px; }
}

/* ── Mobile Notice ── */
.mobile-notice {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #3d6098 100%);
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.mobile-notice-inner { text-align: center; max-width: 340px; }
.mobile-notice-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.mobile-notice-title {
  font-family: var(--body);
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  margin-bottom: 12px;
}
.mobile-notice-text {
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--rule);
}
@media (max-width: 768px) and (orientation: portrait) {
  .mobile-notice { display: flex; }
}

/* ── Responsive table wrapper ── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll::-webkit-scrollbar { height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
.table-scroll table { min-width: 100%; }

/* ── Button press feedback ── */
button:active:not(:disabled),
.admin-link:active,
.portal-nav-signin:active,
.portal-nav-signout:active,
.sign-in-btn:active,
.sign-out-btn:active {
  transform: scale(0.97);
}

/* ── Breadcrumb underline animation ── */
.portal-nav-crumb {
  position: relative;
}
.portal-nav-crumb::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--primary);
  transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.portal-nav-crumb:hover::after {
  width: 100%;
}

/* ── Empty state styling ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 12px;
  border: 1px dashed var(--rule-lt);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #f8fafe 0%, var(--surface) 100%);
}
