/* ============================================================
   STYLE.CSS — Global Styles & Layout
   Hydrogel Film Business POS
   ============================================================ */

/* ─── Reset & Base ──────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  color: var(--text-primary);
  background-color: var(--bg-app);
  line-height: var(--leading-normal);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography ────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

h4 {
  font-size: var(--text-md);
}

h5 {
  font-size: var(--text-base);
}

h6 {
  font-size: var(--text-sm);
}

p {
  line-height: var(--leading-relaxed);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul,
ol {
  list-style: none;
}

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

button {
  cursor: pointer;
  font-family: var(--font-family);
}

input,
textarea,
select {
  font-family: var(--font-family);
}

/* ─── App Shell ──────────────────────────────────────────── */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Page Layout ────────────────────────────────────────── */
.page {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--nav-bottom-height);
}

.page.active {
  display: flex;
}

/* ─── App Header ─────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
}

.app-header .header-title {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.app-header .header-left,
.app-header .header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ─── Bottom Navigation ──────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  height: var(--nav-bottom-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-2) var(--space-1);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: var(--weight-medium);
  font-family: var(--font-family);
  text-decoration: none;
  transition: color var(--transition-fast);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav .nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
  transition: transform var(--transition-bounce);
}

.bottom-nav .nav-item.active {
  color: var(--primary);
}

.bottom-nav .nav-item.active svg {
  transform: scale(1.1);
}

.bottom-nav .nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.bottom-nav .nav-item.active::before {
  opacity: 1;
}

/* ─── Sidebar (Admin Desktop) ────────────────────────────── */
.admin-layout {
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: var(--z-nav);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-base);
}

.sidebar-logo {
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-700), var(--primary-500));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-purple);
  flex-shrink: 0;
}

.sidebar-logo-icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.sidebar-logo-text {
  flex: 1;
}

.sidebar-logo-text h1 {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  color: var(--primary);
}

.sidebar-logo-text span {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: var(--space-4);
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 var(--space-3) var(--space-2);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

.sidebar-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: var(--weight-semibold);
}

.sidebar-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-item .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
}

.main-content {
  flex: 1;
  min-height: 100vh;
}

/* ─── Content Area ───────────────────────────────────────── */
.content-area {
  padding: var(--space-4);
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

/* ─── Grid Systems ───────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ─── Flex Utilities ─────────────────────────────────────── */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

/* ─── Spacing Utilities ──────────────────────────────────── */
.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.p-4 {
  padding: var(--space-4);
}

/* ─── Text Utilities ──────────────────────────────────────── */
.text-xs {
  font-size: var(--text-xs);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-base {
  font-size: var(--text-base);
}

.text-lg {
  font-size: var(--text-lg);
}

.text-xl {
  font-size: var(--text-xl);
}

.text-muted {
  color: var(--text-muted);
}

.text-primary-color {
  color: var(--primary);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.font-bold {
  font-weight: var(--weight-bold);
}

.font-medium {
  font-weight: var(--weight-medium);
}

.font-semibold {
  font-weight: var(--weight-semibold);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* ─── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-4) 0;
}

/* ─── Section Header ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

/* ─── Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  background: var(--gray-100);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.empty-state-icon svg {
  width: 32px;
  height: 32px;
  color: var(--gray-400);
}

.empty-state h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 280px;
}

/* ─── Scrollable Areas ───────────────────────────────────── */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.scroll-y {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ─── Safe Area Support ──────────────────────────────────── */
.safe-top {
  padding-top: env(safe-area-inset-top, 0);
}

.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ─── Hidden/Show Utilities ──────────────────────────────── */
.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ─── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #0F172A 0%, #070A12 70%, #030509 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 180, 255, 0.2) 0%, rgba(0, 136, 255, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  border: 1.5px solid rgba(0, 210, 255, 0.3);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 180, 255, 0.2);
  padding: 36px 28px;
  animation: slideUp 0.5s var(--transition-bounce);
  position: relative;
  z-index: 2;
  color: #F8FAFC;
  box-sizing: border-box;
}

.login-card .form-label {
  color: #CBD5E1 !important;
}

.login-card .form-control {
  background: #0B0F19 !important;
  color: #FFFFFF !important;
  border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 12px !important;
}

.login-card .form-control:focus {
  border-color: #00D2FF !important;
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.4) !important;
}

.login-card .btn-primary {
  background: linear-gradient(135deg, #0088FF 0%, #00D2FF 100%) !important;
  color: #000000 !important;
  font-weight: 900 !important;
  font-size: 16px !important;
  border: none !important;
  border-radius: 12px !important;
  box-shadow: 0 6px 25px rgba(0, 200, 255, 0.45) !important;
  height: 48px;
}

.login-card .btn-primary:hover {
  box-shadow: 0 8px 30px rgba(0, 200, 255, 0.7) !important;
  transform: translateY(-1px);
}

.login-subtitle {
  font-size: var(--text-sm);
  color: #94A3B8;
  margin-bottom: var(--space-6);
  text-align: center;
}