/*
 * Theme Name:  Vantage Interlink
 * Theme URI:   https://vantageinterlink.com
 * Description: Custom theme for the Vantage Interlink B2B marketplace.
 * Version:     0.1.0
 * Author:      Vantage Interlink
 * Author URI:  https://vantageinterlink.com
 * Text Domain: vantage-interlink-theme
 * Requires at least: 6.0
 * Requires PHP: 8.1
 *
 * Design follows the Vantage Interlink Brand Guidelines (December 2024).
 * See docs/Branding/ for colours, typography, and logo usage rules.
 */

/* ── Reset / base ─────────────────────────────────────────────────────────── */

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

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #1a1a2e;
  background: #f7f8fa;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Layout shell ─────────────────────────────────────────────────────────── */

.vi-site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.vi-main {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.vi-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.vi-header__logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: #1a1a2e;
  flex-shrink: 0;
}

.vi-header__logo-text { color: #1a1a2e; }
.vi-header__logo img { max-height: 36px; width: auto; }

.vi-header__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
}

.vi-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  color: #374151;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.vi-nav-link:hover { background: #f3f4f6; color: #1a1a2e; }

.vi-nav-link--muted { color: #6b7280; }
.vi-nav-link--muted:hover { color: #1a1a2e; }

.vi-nav-link--cta {
  background: #1a1a2e;
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-weight: 600;
}

.vi-nav-link--cta:hover { background: #2d2d4e; color: #fff; }

.vi-nav-link--outline {
  background: transparent;
  color: #1a1a2e;
  border: 1.5px solid #d1d5db;
}

.vi-nav-link--outline:hover {
  border-color: #1a1a2e;
  background: #f7f8fa;
  color: #1a1a2e;
}

.vi-nav-spacer { flex: 1; }

/* ── Hide WP admin bar for buyers and brands ─────────────────────────────── */
/* PHP filter handles this correctly; CSS is a failsafe only. */
.vi-role-brand #wpadminbar,
.vi-role-buyer #wpadminbar { display: none !important; }
.vi-role-brand html,
.vi-role-buyer html { margin-top: 0 !important; }

/* VI 360 AI — accented top-level link */
.vi-nav-link--ai {
  color: #4f46e5;
  font-weight: 600;
}
.vi-nav-link--ai:hover { background: #eef2ff; color: #4338ca; }

/* ── Nav dropdowns ────────────────────────────────────────────────────────── */

.vi-dropdown {
  position: relative;
}

/* The toggle button inherits .vi-nav-link styles; reset button-specific defaults */
.vi-dropdown__toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  gap: 0.3rem;
}

.vi-dropdown__chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #9ca3af;
  transition: transform 0.15s;
}

.vi-dropdown--open .vi-dropdown__chevron {
  transform: rotate(180deg);
}

.vi-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
  min-width: 210px;
  padding: 0.375rem;
  z-index: 200;
}

/* Right-aligned (for Account — opens near right edge) */
.vi-dropdown__menu--right {
  left: auto;
  right: 0;
}

/* ── Account dropdown (Elementor nav) ────────────────────────────────────── */

/* Account top-level item: hide for guests */
body:not(.logged-in) li#menu-item-284,
body:not(.logged-in) .vi-account-menu { display: none !important; }

/* VI 360 AI: hide for guests via CSS backup (PHP also handles this) */
body:not(.logged-in) .vi-menu-ai { display: none !important; }

/* Role-specific sub-items: show only to the right role */
body:not(.vi-role-buyer) .vi-buyer-only { display: none !important; }
body:not(.vi-role-brand) .vi-brand-only { display: none !important; }

/* Sub-menu background always white */
.vi-account-menu .sub-menu,
li.menu-item-has-children .sub-menu { background-color: #ffffff !important; }

.vi-dropdown--open .vi-dropdown__menu {
  display: block;
}

.vi-dropdown__item {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}

.vi-dropdown__item:hover {
  background: #f3f4f6;
  color: #1a1a2e;
}

.vi-dropdown__item--danger { color: #dc2626; }
.vi-dropdown__item--danger:hover { background: #fef2f2; color: #b91c1c; }

.vi-dropdown__divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.375rem 0;
}

/* ── Hamburger (mobile) ──────────────────────────────────────────────────── */

.vi-header__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
}

.vi-header__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #1a1a2e;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.vi-header__toggle--open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.vi-header__toggle--open span:nth-child(2) { opacity: 0; }
.vi-header__toggle--open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .vi-header { padding: 0 1rem; }

  .vi-header__toggle { display: flex; }

  .vi-header__nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex-direction: column;
    padding: 0.75rem 1rem 1rem;
    gap: 0.125rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  }

  .vi-header__nav--open { display: flex; }
  .vi-nav-spacer { display: none; }

  .vi-nav-link {
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    width: 100%;
  }

  .vi-nav-link--cta,
  .vi-nav-link--outline {
    text-align: center;
    justify-content: center;
    margin-top: 0.25rem;
  }

  /* Dropdowns — stack inline on mobile */
  .vi-dropdown { width: 100%; }

  .vi-dropdown__toggle {
    width: 100%;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
  }

  .vi-dropdown__menu {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0 0 0.25rem 0.75rem;
    background: transparent;
    min-width: 0;
  }

  /* Always visible when open on mobile (static positioning) */
  .vi-dropdown--open .vi-dropdown__menu { display: block; }

  .vi-dropdown__item {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    width: 100%;
  }

  .vi-dropdown__divider { margin: 0.25rem 0; }
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.vi-footer {
  background: #1a1a2e;
  color: #9ca3af;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
}

/* ── Shared buttons ───────────────────────────────────────────────────────── */

.vi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}

.vi-btn--primary {
  background: #1a1a2e;
  color: #ffffff;
  border-color: #1a1a2e;
}

.vi-btn--primary:hover {
  background: #2d2d4e;
  border-color: #2d2d4e;
  color: #ffffff;
}

.vi-btn--outline {
  background: transparent;
  color: #1a1a2e;
  border-color: #d1d5db;
}

.vi-btn--outline:hover {
  border-color: #1a1a2e;
  background: #f7f8fa;
  color: #1a1a2e;
}

.vi-btn--full {
  width: 100%;
}

.vi-btn--sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.vi-btn--ghost {
  background: transparent;
  color: #4b5563;
  border-color: transparent;
}

.vi-btn--ghost:hover {
  background: #f3f4f6;
  color: #1a1a2e;
  border-color: transparent;
}

/* ── Login page ───────────────────────────────────────────────────────────── */

.vi-login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  background: #f7f8fa;
}

.vi-login-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(26, 26, 46, 0.07);
}

.vi-login-card__brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.vi-login-card__brand img {
  margin: 0 auto 0.5rem;
  max-height: 48px;
  width: auto;
}

.vi-login-card__logo-text {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1a1a2e;
  margin-bottom: 0.25rem;
}

.vi-login-card__tagline {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0;
}

.vi-login-card__title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 1.25rem;
}

/* Error banner */
.vi-login-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* Form */
.vi-login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.vi-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.vi-form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vi-form-group__forgot {
  font-size: 0.8rem;
  font-weight: 400;
  color: #6b7280;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.vi-form-group__forgot:hover {
  color: #1a1a2e;
}

.vi-form-group input[type="text"],
.vi-form-group input[type="password"],
.vi-form-group input[type="email"] {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  color: #1a1a2e;
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.vi-form-group input:focus {
  border-color: #1a1a2e;
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.08);
}

/* Remember me */
.vi-login-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #4b5563;
  cursor: pointer;
}

.vi-login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #1a1a2e;
  cursor: pointer;
}

/* Divider */
.vi-login-card__divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  color: #9ca3af;
  font-size: 0.8rem;
}

.vi-login-card__divider::before,
.vi-login-card__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

/* CTA links */
.vi-login-card__ctas {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* ── Responsive login ─────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .vi-login-card {
    padding: 2rem 1.25rem;
    border-radius: 12px;
  }
}

/* ── Page content wrapper (for pages without .vi-main) ───────────────────── */
/*
 * Elementor Theme Builder replaces get_header() and get_footer() entirely,
 * removing the .vi-main wrapper.  Shortcodes that need max-width + padding
 * use this wrapper div instead.
 */
.vi-page-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Page title suppression (safety net) ──────────────────────────────────── */
/*
 * Hide any auto-rendered WordPress page/post title elements.
 * Page titles must be placed intentionally via Elementor or custom templates.
 * These classes are output by WordPress core, classic themes, and some
 * plugins — but NOT by Elementor heading widgets (which use .elementor-heading-title).
 */
.entry-title,
.page-title,
.post-title,
.wp-block-post-title,
h1.entry-title,
h2.entry-title {
  display: none !important;
}

