/* ==========================================================================
   Pierlink / 码头链 — Material Design 3 Light Theme
   base.css — Design tokens, typography scale, base elements
   ========================================================================== */

/* --------------------------------------------------------------------------
   Color tokens — Google-product palette, light-only
   -------------------------------------------------------------------------- */
:root {
  /* Primary — Google Blue */
  --md-primary:              #1a73e8;
  --md-primary-hover:        #1557b0;
  --md-primary-container:    #e8f0fe;
  --md-on-primary:           #ffffff;
  --md-on-primary-container: #174ea6;

  /* Secondary / Tertiary */
  --md-secondary:  #12b5cb;
  --md-tertiary:   #0d9488;

  /* Semantic */
  --md-error: #d93025;
  --md-warn:  #f29900;

  /* Surface scale */
  --md-surface:         #ffffff;
  --md-surface-variant: #f1f3f4;
  --md-surface-tint:    rgba(26, 115, 232, 0.05);

  /* On-surface */
  --md-on-surface:         #202124;
  --md-on-surface-variant: #5f6368;
  --md-on-surface-muted:   #9aa0a6;

  /* Outline */
  --md-outline:      #dadce0;
  --md-outline-soft: #e8eaed;

  /* Brand accent (Pierlink teal) */
  --md-brand-accent:    #0d9488;
  --md-brand-accent-lt: #ccfbf1;

  /* Selection */
  --md-selection-bg:    #c2d7fc;
  --md-selection-color: #174ea6;
}

/* Light-only — no dark overrides */

::selection {
  background: var(--md-selection-bg);
  color:      var(--md-selection-color);
}

/* --------------------------------------------------------------------------
   Typography tokens
   -------------------------------------------------------------------------- */
:root {
  /* Font stack — no CDN, fallback chain only */
  --font-sans: 'Google Sans', 'Roboto', -apple-system, system-ui, sans-serif;
  --font-mono: ui-monospace, 'Roboto Mono', 'Cascadia Code', monospace;

  /* Weight tokens */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* Display scale */
  --type-display-lg-size:   48px;
  --type-display-lg-lh:     52px;
  --type-display-sm-size:   36px;
  --type-display-sm-lh:     40px;

  /* Headline scale */
  --type-headline-lg-size:  32px;
  --type-headline-lg-lh:    40px;
  --type-headline-md-size:  24px;
  --type-headline-md-lh:    32px;
  --type-headline-sm-size:  20px;
  --type-headline-sm-lh:    28px;

  /* Title scale */
  --type-title-lg-size:     16px;
  --type-title-lg-lh:       24px;
  --type-title-sm-size:     14px;
  --type-title-sm-lh:       20px;

  /* Body scale */
  --type-body-lg-size:      16px;
  --type-body-lg-lh:        24px;
  --type-body-sm-size:      14px;
  --type-body-sm-lh:        20px;

  /* Label scale */
  --type-label-lg-size:     14px;
  --type-label-lg-lh:       20px;
  --type-label-sm-size:     12px;
  --type-label-sm-lh:       16px;
}

/* --------------------------------------------------------------------------
   Spacing scale
   -------------------------------------------------------------------------- */
:root {
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  32px;
  --space-8:  40px;
  --space-9:  48px;
  --space-10: 64px;
}

/* --------------------------------------------------------------------------
   Elevation — subtle, layered, Google product depth
   -------------------------------------------------------------------------- */
:root {
  --md-elev-0: none;
  --md-elev-1: 0 1px 2px rgba(60,64,67,.15), 0 1px 3px 1px rgba(60,64,67,.08);
  --md-elev-2: 0 1px 2px rgba(60,64,67,.20), 0 2px 6px 2px rgba(60,64,67,.10);
  --md-elev-3: 0 1px 3px rgba(60,64,67,.20), 0 4px 8px 3px rgba(60,64,67,.12);
  --md-elev-4: 0 2px 3px rgba(60,64,67,.20), 0 6px 10px 4px rgba(60,64,67,.14);
  --md-elev-5: 0 4px 4px rgba(60,64,67,.20), 0 8px 12px 6px rgba(60,64,67,.15);
}

/* --------------------------------------------------------------------------
   Radius scale
   -------------------------------------------------------------------------- */
:root {
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Legacy aliases — kept for existing admin views */
  --md-radius-sm: 8px;
  --md-radius:    12px;
  --md-radius-lg: 16px;
  --md-radius-xl: 24px;
}

/* --------------------------------------------------------------------------
   Motion tokens
   -------------------------------------------------------------------------- */
:root {
  --ease-standard:   cubic-bezier(0.2, 0, 0, 1);
  --ease-decelerate: cubic-bezier(0, 0, 0, 1);
  --ease-accelerate: cubic-bezier(0.3, 0, 1, 1);

  --motion-fast:      100ms;
  --motion-default:   200ms;
  --motion-emphasized: 300ms;
}

/* --------------------------------------------------------------------------
   Base reset + global elements
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  font-size: var(--type-body-lg-size);
  line-height: var(--type-body-lg-lh);
  color: var(--md-on-surface);
  background: var(--md-surface-variant);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--md-primary);
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-standard);
}
a:hover { text-decoration: underline; color: var(--md-primary-hover); }

/* --------------------------------------------------------------------------
   Typography utility classes
   -------------------------------------------------------------------------- */
.type-display-lg {
  font-size: var(--type-display-lg-size);
  line-height: var(--type-display-lg-lh);
  font-weight: var(--fw-bold);
  letter-spacing: 0;
}
.type-display-sm {
  font-size: var(--type-display-sm-size);
  line-height: var(--type-display-sm-lh);
  font-weight: var(--fw-bold);
  letter-spacing: 0;
}
.type-headline-lg {
  font-size: var(--type-headline-lg-size);
  line-height: var(--type-headline-lg-lh);
  font-weight: var(--fw-semibold);
}
.type-headline-md {
  font-size: var(--type-headline-md-size);
  line-height: var(--type-headline-md-lh);
  font-weight: var(--fw-semibold);
}
.type-headline-sm {
  font-size: var(--type-headline-sm-size);
  line-height: var(--type-headline-sm-lh);
  font-weight: var(--fw-medium);
}
.type-title-lg {
  font-size: var(--type-title-lg-size);
  line-height: var(--type-title-lg-lh);
  font-weight: var(--fw-medium);
}
.type-title-sm {
  font-size: var(--type-title-sm-size);
  line-height: var(--type-title-sm-lh);
  font-weight: var(--fw-medium);
}
.type-body-lg {
  font-size: var(--type-body-lg-size);
  line-height: var(--type-body-lg-lh);
  font-weight: var(--fw-regular);
}
.type-body-sm {
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-lh);
  font-weight: var(--fw-regular);
}
.type-label-lg {
  font-size: var(--type-label-lg-size);
  line-height: var(--type-label-lg-lh);
  font-weight: var(--fw-medium);
}
.type-label-sm {
  font-size: var(--type-label-sm-size);
  line-height: var(--type-label-sm-lh);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
}

/* --------------------------------------------------------------------------
   Legacy layout classes — preserved for admin views
   -------------------------------------------------------------------------- */
.md-container { max-width: 1140px; margin: 0 auto; padding: 0 var(--space-4); }

/* Topbar */
.md-topbar {
  background: var(--md-surface);
  border-bottom: 1px solid var(--md-outline-soft);
  position: sticky; top: 0; z-index: 50;
}
.md-topbar-inner {
  display: flex; justify-content: space-between; align-items: center;
  height: 56px;
}
.md-logo {
  display: flex; align-items: center; gap: var(--space-2);
  font-weight: var(--fw-semibold);
  color: var(--md-on-surface); text-decoration: none;
}
.md-logo-mark {
  display: inline-flex; width: 32px; height: 32px;
  border-radius: var(--radius-md); align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(8, 145, 178, .16);
}
.md-logo-text { letter-spacing: 0; }
.md-nav { display: flex; gap: 18px; align-items: center; }
.md-nav a, .md-nav .md-btn-text { color: var(--md-on-surface-variant); font-size: var(--type-body-sm-size); }
.md-nav a:hover { color: var(--md-primary); text-decoration: none; }
.md-nav .md-disabled { color: var(--md-on-surface-muted); cursor: not-allowed; pointer-events: none; }
.md-nav-user {
  color: var(--md-on-surface-muted); font-size: 13px;
  padding-right: var(--space-2); border-right: 1px solid var(--md-outline-soft);
}

/* Main / Footer */
.md-main { padding: var(--space-7) 0 var(--space-10); min-height: calc(100vh - 56px - 64px); }
.md-footer {
  padding: var(--space-4) 0;
  border-top: 1px solid var(--md-outline-soft);
  color: var(--md-on-surface-muted);
  font-size: 13px;
  background: var(--md-surface);
}
.md-footer .md-footer-sep { margin: 0 var(--space-2); opacity: .5; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .md-nav { gap: 10px; }
  .md-nav-user { display: none; }
}
