﻿@import 'theme.css';

/* =========================================================   MiConnect — Global Base Styles   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Base typography — safe to keep on body in the Blazor host shell.   Page-specific backgrounds/layouts must NOT go here. */
body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
}

a {
  color: var(--text-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* =========================================================   Shared Utilities   ========================================================= */
.text-accent {
  color: var(--color-accent) !important;
}

.text-primary-brand {
  color: var(--color-primary) !important;
}

.btn-accent {
  background: linear-gradient(135deg, var(--color-accent-light) 0%, var(--color-accent) 100%);
  border: none;
  color: #fff;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 700;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  box-shadow: 0 4px 14px rgba(216, 27, 122, 0.30);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(216, 27, 122, 0.38);
  color: #fff;
}

/*------------PAGE WRAPPER------------*/
.page-wrapper {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background-color: var(--bg-page);
  overflow: hidden;
  position: relative;
}

.page-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

.page-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../images/bg.png');
  background-repeat: repeat;
  background-size: 500px;
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
}

.page-wrapper > * {
  position: relative;
  /* z-index: 1; */
}
/*--------------------------------------------*/

/* =========================================================   Product List Page   ========================================================= */
/* ── Navbar ─────────────────────────────────────────────── */
.app-navbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  height: var(--navbar-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo {
  width: 44px;
  height: 44px;
}

.nav-week-info {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  white-space: nowrap;
}

.nav-week-label {
  font-family: var(--font-heading);
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
}

.nav-week-range {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Week dropdown ──────────────────────────────────────── */
.nav-week-dropdown {
  position: relative;
}

.nav-week-chip {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  background: none;
  border: none;
  padding: 3px 5px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.nav-week-chip:hover {
  background: rgba(21, 101, 192, 0.06);
}

.nav-week-caret {
  font-size: 0.72rem;
  color: var(--text-muted);
  align-self: center;
  transition: transform 0.18s ease;
}

.nav-week-chip[aria-expanded="true"] .nav-week-caret {
  transform: rotate(180deg);
}

.nav-week-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  border: 1px solid var(--border-light);
  z-index: 400;
  padding: 6px 0;
}

.nav-week-menu.open {
  display: block;
}

.nav-week-menu-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 7px 14px;
  cursor: pointer;
  gap: 2px;
}

.nav-week-menu-item:hover {
  background: #F3F4F6;
}

.nav-week-menu-item--active {
  background: rgba(21, 101, 192, 0.07);
}

.nav-week-menu-item--active:hover {
  background: rgba(21, 101, 192, 0.12);
}

.nwmi-no {
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--text-primary);
}

.nwmi-range {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.nav-btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Icon button — default (neutral) ───────────────────── */
.nav-icon-btn {
  background: none;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  /* rounded square, not circular */
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}

.nav-icon-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ── Icon button — accent (pink file icon) ──────────────── */
/* Rounded-square shape, very-light pink fill, pink border ~30% opacity, pink icon */
.nav-icon-btn--accent {
  border-color: rgba(216, 27, 122, 0.30);
  /* ~1.5px pink border, low opacity */
  color: var(--color-accent);
  background: rgba(216, 27, 122, 0.07);
  /* very light pink tint */
}

.nav-icon-btn--accent:hover {
  border-color: var(--color-accent);
  background: rgba(216, 27, 122, 0.13);
  color: var(--color-accent);
}

/* ── Text + icon nav button ─────────────────────────────── */
.nav-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  background: none;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.nav-text-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.nav-text-btn--mi-orders {
  border-color: rgba(15, 103, 183, 0.35);
  color: #0F67B7;
  background: rgba(15, 103, 183, 0.06);
}

.nav-text-btn--mi-orders:hover {
  border-color: #0F67B7;
  background: rgba(15, 103, 183, 0.12);
  color: #0F67B7;
}

.nav-text-btn--accent {
  border-color: rgba(216, 27, 122, 0.30);
  color: var(--color-accent);
  background: rgba(216, 27, 122, 0.07);
}

.nav-text-btn--accent:hover {
  border-color: var(--color-accent);
  background: rgba(216, 27, 122, 0.13);
}

/* ── User / MIID dropdown ───────────────────────────────── */
.nav-user-dropdown {
  position: relative;
}

/* Chip: no border, no background — just avatar icon + MIID text + caret inline */
.nav-user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  /* gap between avatar, number, caret */
  padding: 3px 6px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  background: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.nav-user-chip:hover {
  background: rgba(21, 101, 192, 0.06);
}

/* Avatar: outlined circle style, blue */
.nav-user-avatar-circle {
  font-size: 1.1rem;
  color: var(--color-primary);
  line-height: 1;
  flex-shrink: 0;
}

/* MIID number: dark, semibold */
.nav-user-miid {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}

/* Chevron: small, muted grey */
.nav-user-caret {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.nav-user-chip[aria-expanded="true"] .nav-user-caret {
  transform: rotate(180deg);
}

/* ── Dropdown menu ──────────────────────────────────────── */
/* White, 16px radius, soft shadow, ≥200px wide, right-aligned below chip */
.nav-user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
  z-index: 200;
  overflow: hidden;
}

.nav-user-menu.open {
  display: block;
}

/* ── Menu header section ────────────────────────────────── */
.nav-user-menu-header {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* "MIID :4183484977" — bold, dark, ~0.9rem */
.num-miid-label {
  font-size: 0.875rem;
  /* ~0.9rem */
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.5;
}

/* "Brundhakrishnan" — normal weight, muted */
.num-user-name {
  font-size: 0.825rem;
  /* ~0.85rem */
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.5;
}

/* "(884410491)" — smaller, muted */
.num-user-phone {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

/* "Credit Balance: 1500" — accent pink */
.num-credit-balance {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #E3378C;
  line-height: 1.5;
}

/* ── Single divider between header and menu items ───────── */
/* Appears ONCE — placed in HTML between .nav-user-menu-header and the items */
.nav-user-menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0 16px;
}

/* ── Menu items (Help, Logout) ──────────────────────────── */
.nav-user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  /* Help: grey */
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
  font-family: var(--font-body);
}

/* Help hover: light grey background */
.nav-user-menu-item:hover {
  background: #F3F4F6;
}

/* Logout: pink/accent icon + text */
.nav-user-menu-item--logout {
  color: var(--color-accent);
}

/* Logout hover: very light pink background */
.nav-user-menu-item--logout:hover {
  background: rgba(216, 27, 122, 0.06);
}

/* =========================================================
   ro-header — shared page header used by review-order and order-receipt
   ========================================================= */

.ro-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  height: var(--navbar-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.ro-header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}

.ro-header-logo {
  width: 32px;
  height: 32px;
}

.ro-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* =========================================================   Responsive — Shared (Navbar / Layout)   ========================================================= */
@media (max-width: 991.98px) {
  .app-navbar {
    z-index: 290;
  }

  .nav-week-info {
    display: none;
  }
}

@media (max-width: 767.98px) {
  .app-navbar {
    padding: 0 var(--space-4);
  }

  .nav-text-btn span {
    display: none;
  }

  .nav-text-btn {
    padding: 0 8px;
  }

  .ro-header {
    padding: 0 var(--space-4);
  }

  .ro-header-actions .nav-text-btn span {
    display: none;
  }

  .nav-week-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .nav-week-range {
    font-size: 0.65rem;
    line-height: 1.2;
    white-space: nowrap;
  }

  .nav-user-miid {
    display: none;
  }

  .ro-header-actions .nav-text-btn {
    padding: 0 8px;
  }
}