﻿/* ============================================================
   EcoWorld Official Brand Fonts
   Source: https://ecoworld.my/about-ecoworld/our-story/ecoworldtypeface/
   ============================================================ */
@font-face {
  font-family: 'EcoWorld Serif';
  src: url('../fonts/EcoWorld Serif/EcoWorldSerif-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'EcoWorld Serif';
  src: url('../fonts/EcoWorld Serif/EcoWorldSerif-Italic.otf') format('opentype');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'EcoWorld Serif';
  src: url('../fonts/EcoWorld Serif/EcoWorldSerif-Bold.otf') format('opentype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'EcoWorld Serif';
  src: url('../fonts/EcoWorld Serif/EcoWorldSerif-BoldItalic.otf') format('opentype');
  font-weight: 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'EcoWorld Sans';
  src: url('../fonts/EcoWorld Sans/EcoWorldSans_v1-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'EcoWorld Sans';
  src: url('../fonts/EcoWorld Sans/EcoWorldSans_v1-Italic.otf') format('opentype');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'EcoWorld Sans';
  src: url('../fonts/EcoWorld Sans/EcoWorldSans_v1-Bold.otf') format('opentype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'EcoWorld Sans';
  src: url('../fonts/EcoWorld Sans/EcoWorldSans_v1-BoldItalic.otf') format('opentype');
  font-weight: 700; font-style: italic; font-display: swap;
}

/* ============================================================
   EcoWorld Prestige Brand Theme — ewp_ui.md
   Primary: Prestige Gold #C9973A | Black #231F20 | Green #007B38 (heritage)
   ============================================================ */
:root {
  /* EcoWorld Prestige palette */
  --ewp-gold:         #C9973A;   /* Prestige Gold — primary */
  --ewp-gold-dark:    #8B6914;   /* Deep Bronze */
  --ewp-gold-light:   #E8D7B8;   /* Champagne light */
  --ewp-gold-shimmer: #E8C885;
  --ewp-black:        #231F20;   /* World Black */
  --ewp-charcoal:     #3A3A3A;
  --ewp-green:        #007B38;   /* Heritage accent only */
  --ewp-platinum:     #D4D6D8;
  --ewp-champagne:    #F8F4ED;   /* Page background */
  --ewp-white:        #FFFFFF;

  /* Gradients */
  --gradient-gold-shimmer: linear-gradient(to right, #8B6914 0%, #C9973A 30%, #E8C885 60%, #F5E5C8 85%, #E8C885 100%);
  --gradient-dark-luxury:  linear-gradient(to right, #0a0a0a 0%, #231F20 40%, #1a1a1a 100%);
  --gradient-gold-bar:     linear-gradient(to right, #8B6914 0%, #C9973A 50%, #8B6914 100%);

  /* Semantic aliases used throughout the app */
  --ew-primary:       #C9973A;   /* Gold replaces green as primary */
  --ew-primary-dark:  #8B6914;
  --ew-primary-light: #E8D7B8;
  --ew-secondary:     #007B38;   /* Green as heritage secondary */
  --ew-background:    #FFFFFF;
  --ew-page-bg:       #F8F4ED;   /* Champagne */
  --ew-light-grey:    #F8F4ED;
  --ew-light:         #F8F4ED;
  --ew-text:          #231F20;   /* World Black */
  --ew-text-light:    #8A8C8E;
  --ew-border:        rgba(201,151,58,0.18);  /* Gold-tinted border */
  --ew-error:         #C9302C;
  --ew-success:       #007B38;
  --ew-hover:         #8B6914;
  --ew-sidebar-bg:    #231F20;   /* Dark luxury sidebar */
  --ew-sidebar-text:  #FFFFFF;
  --ew-table-header:  #F8F4ED;
  --ew-input-border:  rgba(35,31,32,0.2);
  --ew-shadow-sm:     0 1px 3px rgba(35,31,32,0.08), 0 1px 2px rgba(35,31,32,0.04);
  --ew-shadow-md:     0 4px 6px rgba(35,31,32,0.07), 0 2px 4px rgba(35,31,32,0.05);
  --ew-shadow-lg:     0 10px 15px rgba(35,31,32,0.08), 0 4px 6px rgba(35,31,32,0.04);
  --shadow-gold:      0 4px 20px rgba(201,151,58,0.25);

  /* EcoWorld brand fonts */
  --font-heading:     'EcoWorld Serif', Georgia, 'Times New Roman', serif;
  --font-body:        'EcoWorld Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-display:     'EcoWorld Serif', Georgia, 'Times New Roman', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background-color: var(--ew-page-bg);
  color: var(--ew-text);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--ew-text);
}

/* ============================================================
   Layout
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* ============================================================
   Sidebar — Dark Luxury (ewp_ui.md: dark gradient background)
   ============================================================ */
.sidebar {
  width: 220px;
  background: var(--gradient-dark-luxury);
  color: var(--ew-sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  z-index: 10;
  border-right: 1px solid rgba(201,151,58,0.15);
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(201,151,58,0.2);
  margin-bottom: 8px;
}

.sidebar-brand-logo {
  display: block;
  width: 140px;
  height: auto;
  margin-bottom: 4px;
}

.sidebar-brand-sub {
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  color: rgba(201,151,58,0.6);
  text-transform: uppercase;
  font-weight: 400;
  margin-top: 2px;
  font-family: var(--font-body);
}

.sidebar-nav {
  flex: 1;
  padding: 4px 12px;
  overflow-y: auto;
}

.sidebar-section {
  padding: 14px 8px 4px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(201,151,58,0.5);
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 4px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s ease;
  margin-bottom: 1px;
  white-space: nowrap;
}

.sidebar-link:hover {
  background-color: rgba(201,151,58,0.12);
  color: #C9973A;
}

.sidebar-link.active {
  background: var(--gradient-gold-shimmer);
  color: #231F20;
  font-weight: 700;
  box-shadow: var(--shadow-gold);
}

/* Fix: constrain SVG icons inside sidebar links */
.sidebar-link svg {
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(201,151,58,0.2);
}

.sidebar-user-name {
  font-size: 0.78rem;
  color: rgba(201,151,58,0.9);
  font-weight: 600;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.4);
  margin-bottom: 10px;
}

/* ============================================================
   Main content area
   ============================================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  background-color: var(--ew-page-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.main-header-left .portal-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ew-text-light);
  margin-bottom: 2px;
}

.main-header-left .welcome-msg {
  font-size: 1rem;
  font-weight: 500;
  color: var(--ew-text);
}

.main-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--ew-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--ew-shadow-sm);
  transition: box-shadow 0.2s;
}

.main-header-avatar:hover { box-shadow: var(--ew-shadow-md); }

/* Push footer to bottom */
.page-body {
  flex: 1;
}

/* ============================================================
   Page title
   ============================================================ */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ew-text);
  margin-bottom: 24px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

/* ============================================================
   Cards — champagne bg, sharp corners, gold accent border
   ============================================================ */
.card {
  background: #fff;
  border: 1px solid rgba(201,151,58,0.15);
  border-top: 2px solid transparent;
  border-image: var(--gradient-gold-shimmer) 1 0 0 0;
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--ew-shadow-sm);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ew-text);
  margin-bottom: 16px;
}

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ew-text);
}

.form-input {
  width: 100%;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid var(--ew-input-border);
  border-radius: 4px;   /* Sharp corners */
  font-size: 0.9rem;
  font-family: var(--font-body);
  background: #fff;
  color: var(--ew-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: #C9973A;
  box-shadow: 0 0 0 3px rgba(201,151,58,0.18);
}

.form-input-full { max-width: 100%; }

/* ============================================================
   Buttons — sharp corners per ew_ui.md, uppercase CTA text
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: 4px;   /* Sharp corners — ew_ui.md: no pill buttons */
  font-size: 0.875rem;
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.btn-primary {
  background: #af783e;
  color: #fff;
  box-shadow: var(--shadow-gold);
}

.btn-primary:hover {
  background: #8B6914;
  box-shadow: 0 6px 24px rgba(175,120,62,0.35);
}
.btn-primary:disabled { background: #D4D6D8; color: #fff; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  background-color: #007B38;
  color: #fff;
  box-shadow: var(--ew-shadow-sm);
}

.btn-secondary:hover { opacity: 0.9; }

.btn-outline {
  background-color: transparent;
  color: #C9973A;
  border: 1.5px solid #C9973A;
}

.btn-outline:hover { background-color: rgba(201,151,58,0.08); }

.btn-danger { background-color: var(--ew-error); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 12px 32px; font-size: 1rem; }

/* ============================================================
   Tables
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--ew-border);
  font-size: 0.875rem;
}

.data-table th {
  background-color: var(--ew-table-header);
  font-weight: 600;
  color: var(--ew-text-light);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tr:hover td { background-color: #F9FAFB; }

.table-wrapper {
  background: #fff;
  border: 1px solid var(--ew-border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--ew-shadow-sm);
}

/* ============================================================
   Badges / Tags
   ============================================================ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green  { background: #DCFCE7; color: #166534; }
.badge-teal   { background: #CCFBF1; color: #0F766E; }
.badge-grey   { background: #F3F4F6; color: #374151; }
.badge-dark   { background: #E5E7EB; color: #111827; font-weight: 700; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-step   { background: #DCFCE7; color: #166534; }

/* ============================================================
   Messages
   ============================================================ */
.error-msg   { color: var(--ew-error);   font-size: 0.85rem; margin-top: 8px; }
.success-msg { color: var(--ew-success); font-size: 0.85rem; margin-top: 8px; }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-error   { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.alert-success { background: #F0FDF4; border: 1px solid #BBF7D0; color: #166534; }
.alert-info    { background: #F0FDFA; border: 1px solid #99F6E4; color: #0F766E; }

/* ============================================================
   Stepper (Point Transfer flow)
   ============================================================ */
.stepper { display: flex; gap: 8px; margin-bottom: 28px; }

.step {
  flex: 1;
  padding: 10px 12px;
  text-align: center;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #E5E7EB;
  color: var(--ew-text-light);
}

.step.active    { background: var(--gradient-gold-shimmer); color: #231F20; }
.step.completed { background: #007B38; color: #fff; }

/* ============================================================
   Balance display
   ============================================================ */
.balance-display {
  font-size: 2.25rem;
  font-weight: 700;
  color: #C9973A;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

/* ============================================================
   Login page
   ============================================================ */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--ew-page-bg);
}

.login-card {
  background: #fff;
  border-radius: 4px;
  padding: 48px 40px;
  width: 420px;
  box-shadow: var(--ew-shadow-lg);
  text-align: center;
}

.login-card h1 {
  font-size: 1.75rem;
  margin-bottom: 6px;
  color: var(--ewp-gold, #C9973A);
}

.login-card .login-subtitle {
  color: var(--ew-text-light);
  font-size: 0.875rem;
  margin-bottom: 32px;
}

/* ============================================================
   Toggle switch
   ============================================================ */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #D1D5DB;
  border-radius: 24px;
  transition: 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider { background-color: var(--ew-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   Secret / code display
   ============================================================ */
.secret-display {
  background: #F9FAFB;
  border: 1px solid var(--ew-border);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  word-break: break-all;
  margin: 12px 0;
  color: var(--ew-text);
}

/* ============================================================
   Inline edit
   ============================================================ */
.inline-input {
  padding: 5px 10px;
  border: 1px solid var(--ew-input-border);
  border-radius: 6px;
  font-size: 0.85rem;
  width: 130px;
  font-family: var(--font-body);
}

/* ============================================================
   Footer — always at bottom of main content
   ============================================================ */
.main-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--ew-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--ew-text-light);
  font-weight: 500;
}

.main-footer a {
  color: var(--ew-text-light);
  text-decoration: none;
  transition: color 0.15s;
}

.main-footer a:hover { color: var(--ew-primary); }

.footer-links { display: flex; gap: 20px; }
