/* ============================================================
   GEI-USA ERP — Application Stylesheet
   Brand: #36bdf6 (primary cyan), #212121 (dark), Open Sans
   ============================================================ */

:root {
  --brand-primary:   #36bdf6;
  --brand-secondary: #7ebec5;
  --brand-dark:      #0d9bd4;
  --sidebar-bg:      #1a1f2e;
  --sidebar-hover:   #252d42;
  --sidebar-active:  rgba(54,189,246,0.15);
  --sidebar-width:   260px;
  --topbar-h:        64px;
  --text-primary:    #212121;
  --text-secondary:  #555555;
  --text-muted:      #888;
  --border:          #e4e8ef;
  --card-bg:         #fff;
  --page-bg:         #f4f6fb;
  --success:         #22c55e;
  --warning:         #f59e0b;
  --danger:          #ef4444;
  --radius:          12px;
  --radius-sm:       8px;
  --shadow:          0 2px 16px rgba(0,0,0,0.07);
  --shadow-lg:       0 8px 32px rgba(0,0,0,0.12);
  --transition:      0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--page-bg);
  line-height: 1.6;
}

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1f2e 0%, #0d1321 50%, #1a2a3a 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2336bdf6' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(54,189,246,0.12) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  pointer-events: none;
}

.login-card {
  background: rgba(255,255,255,0.97);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 8px;
}

.login-logo img {
  max-width: 160px;
  max-height: 60px;
  object-fit: contain;
}

.login-logo-fallback {
  font-size: 28px;
  font-weight: 800;
  color: var(--brand-primary);
  letter-spacing: -0.5px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 32px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.form-floating label { color: var(--text-muted); }
.form-control {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(54,189,246,0.18);
}

.btn-primary-brand {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-dark));
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  width: 100%;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}
.btn-primary-brand:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(54,189,246,0.4);
  color: #fff;
}
.btn-primary-brand:active { transform: translateY(0); }

.btn-passkey {
  background: #1a1f2e;
  border: 1.5px solid #2d3550;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  width: 100%;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-passkey:hover {
  background: #252d42;
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.passkey-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── ERP Layout ───────────────────────────────────────────── */
.erp-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2d3550 transparent;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo {
  height: 36px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.sidebar-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--brand-primary);
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: all var(--transition);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  cursor: pointer;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
}

.nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: rgba(54,189,246,0.4);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--brand-primary);
  border-left-color: var(--brand-primary);
  font-weight: 600;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 16px 20px 6px;
}

.sidebar-footer {
  padding: 12px 0 8px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 11px;
  cursor: pointer;
}

.user-info .user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.user-info .user-role {
  font-size: 11px;
  color: var(--brand-primary);
  text-transform: capitalize;
}

.logout-btn {
  color: rgba(255,255,255,0.5) !important;
}
.logout-btn:hover {
  color: #ef4444 !important;
  border-left-color: #ef4444 !important;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 6px;
}
.sidebar-toggle:hover { background: var(--page-bg); }

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon {
  position: relative;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 8px;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--page-bg); color: var(--text-primary); }

.badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}

.content-area {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header-brand {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-dark));
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px 20px;
  font-weight: 700;
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: rgba(54,189,246,0.12); color: var(--brand-primary); }
.stat-icon.green  { background: rgba(34,197,94,0.12);  color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,0.12);  color: var(--danger); }
.stat-icon.teal   { background: rgba(126,190,197,0.15);color: var(--brand-secondary); }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Dashboard Grid ───────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── Tables ───────────────────────────────────────────────── */
.table-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
}

.table-card-header .btn-sm-brand {
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 6px;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.table { margin: 0; }
.table th {
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}
.table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-color: var(--border);
  font-size: 13.5px;
}
.table tbody tr:hover { background: #fafbfd; }

/* Status badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-active   { background: rgba(34,197,94,0.12);  color: var(--success); }
.badge-pending  { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-complete { background: rgba(54,189,246,0.12); color: var(--brand-primary); }
.badge-inactive { background: rgba(148,163,184,0.15);color: #94a3b8; }

/* Progress bars */
.progress-brand {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}
.progress-brand .progress-bar {
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-dark));
  border-radius: 3px;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 14px;
}
.form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(54,189,246,0.18);
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-header-brand {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-dark));
  color: #fff;
  border-bottom: none;
}
.modal-header-brand .btn-close { filter: invert(1); }

/* ── Alerts ───────────────────────────────────────────────── */
.alert-brand {
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13.5px;
  padding: 12px 16px;
}

/* ── Activity Feed ────────────────────────────────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #fafbfd; }

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.activity-text { font-size: 13px; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: block;
  }
  .content-area {
    padding: 16px;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .login-card {
    margin: 16px;
    padding: 32px 24px;
  }
}

/* ── Spinner ──────────────────────────────────────────────── */
.spinner-brand {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── User Admin ───────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.role-admin    { background: rgba(239,68,68,0.1);   color: #ef4444; }
.role-manager  { background: rgba(245,158,11,0.1);  color: var(--warning); }
.role-employee { background: rgba(54,189,246,0.12); color: var(--brand-primary); }
.role-readonly { background: rgba(148,163,184,0.15);color: #94a3b8; }

/* ── Page Coming Soon ─────────────────────────────────────── */
.coming-soon {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.coming-soon i { font-size: 64px; margin-bottom: 16px; color: var(--border); }
.coming-soon h2 { font-size: 22px; color: var(--text-secondary); margin-bottom: 8px; }

/* ── Accounting ──────────────────────────────────────── */
.hover-lift {
    transition: transform .15s ease, box-shadow .15s ease;
    cursor: pointer;
}
.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
