/* ═══════════════════════════════════════════════════════════
   NoorInvest — Application Stylesheet
   Dark Luxury Islamic-Inspired Design
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ── CSS Variables ──────────────────────────────────────── */
:root {
  --ni-bg:           #0A0C0F;
  --ni-surface:      #111318;
  --ni-card:         #161A22;
  --ni-border:       #1E2530;
  --ni-border-light: #2A3040;
  --ni-gold:         #C9A84C;
  --ni-gold-light:   #E8C97A;
  --ni-gold-dim:     #8A6E2F;
  --ni-gold-bg:      rgba(201,168,76,0.08);
  --ni-emerald:      #1DB87A;
  --ni-emerald-bg:   rgba(29,184,122,0.08);
  --ni-ruby:         #E0483C;
  --ni-ruby-bg:      rgba(224,72,60,0.08);
  --ni-sky:          #3A8FD9;
  --ni-sky-bg:       rgba(58,143,217,0.08);
  --ni-text:         #EAE6DC;
  --ni-text-muted:   #7A8494;
  --ni-sidebar-w:    240px;
  --ni-topbar-h:     60px;
  --ni-radius:       14px;
  --ni-radius-sm:    8px;
  --ni-shadow:       0 4px 24px rgba(0,0,0,0.5);
  --ni-shadow-gold:  0 4px 24px rgba(201,168,76,0.15);
  --transition:      all 0.2s ease;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

.ni-body {
  background: var(--ni-bg);
  color: var(--ni-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Islamic Geometric Pattern (background) ─────────────── */
.ni-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpolygon points='40,0 80,20 80,60 40,80 0,60 0,20' fill='none' stroke='%23C9A84C' stroke-width='0.3' opacity='0.06'/%3E%3Ccircle cx='40' cy='40' r='8' fill='none' stroke='%23C9A84C' stroke-width='0.2' opacity='0.06'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--ni-bg); }
::-webkit-scrollbar-thumb { background: var(--ni-border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ni-gold-dim); }

/* ── Sidebar ────────────────────────────────────────────── */
.ni-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--ni-sidebar-w);
  background: var(--ni-surface);
  border-right: 1px solid var(--ni-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.ni-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--ni-border);
  min-height: var(--ni-topbar-h);
}

.ni-logo-mark {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--ni-gold), var(--ni-gold-dim));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--ni-bg);
  font-weight: 900;
  flex-shrink: 0;
  box-shadow: var(--ni-shadow-gold);
}

.ni-logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ni-gold);
  line-height: 1.1;
}

.ni-logo-sub {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--ni-text-muted);
  font-family: monospace;
  margin-top: 2px;
}

.ni-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ni-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--ni-text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: var(--transition);
}
.ni-nav-link i { font-size: 16px; flex-shrink: 0; }
.ni-nav-link:hover {
  background: var(--ni-gold-bg);
  color: var(--ni-gold);
  border-color: rgba(201,168,76,0.2);
}
.ni-nav-link.active {
  background: var(--ni-gold-bg);
  color: var(--ni-gold);
  border-color: rgba(201,168,76,0.3);
  font-weight: 600;
}

.ni-sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--ni-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ni-user-chip {
  flex: 1;
  background: var(--ni-card);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.ni-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--ni-gold), var(--ni-gold-dim));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--ni-bg);
  flex-shrink: 0;
}

.ni-user-name { font-size: 12px; font-weight: 600; color: var(--ni-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ni-user-role { font-size: 10px; color: var(--ni-text-muted); font-family: monospace; letter-spacing: 0.5px; }

.ni-logout-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ni-card);
  border: 1px solid var(--ni-border);
  border-radius: 10px;
  color: var(--ni-text-muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: var(--transition);
}
.ni-logout-btn:hover { background: var(--ni-ruby-bg); color: var(--ni-ruby); border-color: var(--ni-ruby); }

/* ── Main Content ───────────────────────────────────────── */
.ni-main {
  margin-left: var(--ni-sidebar-w);
  min-height: 100vh;
  position: relative;
  /* z-index removed — was blocking Bootstrap modal backdrop interaction */
}

.ni-topbar {
  height: var(--ni-topbar-h);
  background: var(--ni-surface);
  border-bottom: 1px solid var(--ni-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 500;
  gap: 16px;
}

.ni-sidebar-toggle {
  background: var(--ni-card);
  border: 1px solid var(--ni-border);
  color: var(--ni-text-muted);
  width: 36px; height: 36px;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

.ni-topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.ni-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--ni-emerald-bg);
  border: 1px solid rgba(29,184,122,0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ni-emerald);
  letter-spacing: 0.5px;
}

.ni-pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ni-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.3); }
}

.ni-content {
  padding: 28px 28px 40px;
}

/* ── Page Header ────────────────────────────────────────── */
.ni-page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.ni-page-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--ni-text);
  margin: 0;
  line-height: 1.2;
}

.ni-page-subtitle {
  color: var(--ni-text-muted);
  font-size: 13.5px;
  margin-top: 4px;
}

/* ── Cards ──────────────────────────────────────────────── */
.ni-card {
  background: var(--ni-card);
  border: 1px solid var(--ni-border);
  border-radius: var(--ni-radius);
  overflow: hidden;
  position: relative;
}

.ni-card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--ni-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ni-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ni-text);
  margin: 0;
}

.ni-card-body { padding: 22px; }

/* ── Stat Cards ─────────────────────────────────────────── */
.ni-stat-card {
  background: var(--ni-card);
  border: 1px solid var(--ni-border);
  border-radius: var(--ni-radius);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.ni-stat-card:hover {
  border-color: var(--ni-gold-dim);
  transform: translateY(-2px);
  box-shadow: var(--ni-shadow-gold);
}
.ni-stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ni-gold), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.ni-stat-card:hover::after { opacity: 1; }

.ni-stat-icon {
  position: absolute;
  top: -10px; right: -10px;
  font-size: 80px;
  opacity: 0.04;
  line-height: 1;
  pointer-events: none;
}

.ni-stat-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ni-text-muted);
  font-family: monospace;
  margin-bottom: 8px;
}

.ni-stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--ni-gold);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.ni-stat-sub {
  font-size: 12px;
  color: var(--ni-text-muted);
  margin-top: 6px;
}

.ni-stat-card.emerald .ni-stat-value { color: var(--ni-emerald); }
.ni-stat-card.ruby    .ni-stat-value { color: var(--ni-ruby); }
.ni-stat-card.sky     .ni-stat-value { color: var(--ni-sky); }

/* ── Buttons ────────────────────────────────────────────── */
.btn-ni-gold {
  background: var(--ni-gold);
  color: var(--ni-bg);
  border: 1px solid var(--ni-gold);
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 20px;
  transition: var(--transition);
  font-family: 'DM Sans', sans-serif;
}
.btn-ni-gold:hover {
  background: var(--ni-gold-light);
  border-color: var(--ni-gold-light);
  color: var(--ni-bg);
  box-shadow: 0 4px 20px rgba(201,168,76,0.4);
}

.btn-ni-outline {
  background: transparent;
  color: var(--ni-gold);
  border: 1px solid var(--ni-gold);
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 20px;
  transition: var(--transition);
}
.btn-ni-outline:hover {
  background: var(--ni-gold-bg);
  color: var(--ni-gold);
  box-shadow: 0 4px 20px rgba(201,168,76,0.2);
}

.btn-ni-danger {
  background: var(--ni-ruby);
  color: #fff;
  border: 1px solid var(--ni-ruby);
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 20px;
}
.btn-ni-danger:hover { background: #c03228; color: #fff; }

.btn-ni-success {
  background: var(--ni-emerald);
  color: var(--ni-bg);
  border: 1px solid var(--ni-emerald);
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 20px;
}

/* ── Tables ─────────────────────────────────────────────── */
.ni-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.ni-table thead tr {
  border-bottom: 1px solid var(--ni-border);
}
.ni-table thead th {
  padding: 12px 16px;
  text-align: left;
  color: var(--ni-text-muted);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: monospace;
  font-weight: 400;
  white-space: nowrap;
}
.ni-table tbody tr {
  border-bottom: 1px solid var(--ni-border);
  transition: background 0.15s;
}
.ni-table tbody tr:hover { background: rgba(201,168,76,0.04); }
.ni-table tbody td {
  padding: 13px 16px;
  vertical-align: middle;
}
.ni-table tbody tr:last-child { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────── */
.ni-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-family: monospace;
  border: 1px solid;
  white-space: nowrap;
}
.ni-badge-gold    { background: rgba(201,168,76,0.12);  color: var(--ni-gold);    border-color: rgba(201,168,76,0.3); }
.ni-badge-green   { background: rgba(29,184,122,0.12); color: var(--ni-emerald); border-color: rgba(29,184,122,0.3); }
.ni-badge-red     { background: rgba(224,72,60,0.12);  color: var(--ni-ruby);    border-color: rgba(224,72,60,0.3); }
.ni-badge-blue    { background: rgba(58,143,217,0.12); color: var(--ni-sky);     border-color: rgba(58,143,217,0.3); }
.ni-badge-muted   { background: rgba(122,132,148,0.12);color: var(--ni-text-muted); border-color: rgba(122,132,148,0.3); }

/* ── Forms ──────────────────────────────────────────────── */
.ni-form-label {
  display: block;
  color: var(--ni-text-muted);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: monospace;
  margin-bottom: 6px;
}

.ni-form-control {
  width: 100%;
  background: var(--ni-surface);
  border: 1px solid var(--ni-border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--ni-text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.ni-form-control:focus {
  border-color: var(--ni-gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}
.ni-form-control::placeholder { color: var(--ni-text-muted); }

select.ni-form-control option { background: var(--ni-card); color: var(--ni-text); }

.ni-input-group {
  position: relative;
}
.ni-input-group .ni-input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--ni-gold-dim);
  font-size: 15px;
  pointer-events: none;
}
.ni-input-group .ni-form-control { padding-left: 40px; }

/* ── Countdown Timer ────────────────────────────────────── */
.ni-timer {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}
.ni-timer-unit {
  text-align: center;
}
.ni-timer-block {
  background: var(--ni-surface);
  border: 1px solid var(--ni-border);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 64px;
}
.ni-timer-value {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--ni-gold);
  display: block;
  line-height: 1;
}
.ni-timer-label {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ni-text-muted);
  margin-top: 6px;
  font-family: monospace;
}

/* ── Progress Bar ───────────────────────────────────────── */
.ni-progress {
  background: var(--ni-surface);
  border-radius: 10px;
  height: 6px;
  overflow: hidden;
}
.ni-progress-bar {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--ni-gold), var(--ni-gold-light));
  box-shadow: 0 0 8px rgba(201,168,76,0.5);
  transition: width 1s ease;
}
.ni-progress-bar.emerald {
  background: linear-gradient(90deg, var(--ni-emerald), #22d68f);
  box-shadow: 0 0 8px rgba(29,184,122,0.5);
}
.ni-progress-bar.ruby {
  background: linear-gradient(90deg, var(--ni-ruby), #ff5a4d);
  box-shadow: 0 0 8px rgba(224,72,60,0.5);
}

/* ── Alert box ──────────────────────────────────────────── */
.ni-info-box {
  background: var(--ni-gold-bg);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--ni-gold-light);
  font-size: 13px;
}
.ni-info-box.danger {
  background: var(--ni-ruby-bg);
  border-color: rgba(224,72,60,0.25);
  color: #ff8880;
}
.ni-info-box.success {
  background: var(--ni-emerald-bg);
  border-color: rgba(29,184,122,0.25);
  color: #5ee8b0;
}

/* ── Auth Pages ─────────────────────────────────────────── */
.ni-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--ni-bg);
  position: relative;
}
.ni-auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(201,168,76,0.06) 0%, transparent 60%);
  pointer-events: none;
}

.ni-auth-box {
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
}

.ni-auth-brand {
  text-align: center;
  margin-bottom: 36px;
}
.ni-auth-brand .ni-logo-mark {
  width: 64px; height: 64px;
  font-size: 28px;
  margin: 0 auto 14px;
}
.ni-auth-brand h1 {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  color: var(--ni-gold);
  margin: 0;
  letter-spacing: 1px;
}
.ni-auth-brand p {
  color: var(--ni-text-muted);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: monospace;
  margin: 6px 0 0;
}

.ni-auth-card {
  background: var(--ni-card);
  border: 1px solid var(--ni-border);
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.ni-auth-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--ni-text);
  margin: 0 0 22px;
}

/* ── Step progress (register) ───────────────────────────── */
.ni-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 26px;
}
.ni-step-bar {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--ni-border);
  transition: background 0.3s;
}
.ni-step-bar.active { background: var(--ni-gold); }

/* ── Marketplace Slot Card ──────────────────────────────── */
.ni-slot-card {
  background: var(--ni-card);
  border: 1px solid var(--ni-border);
  border-radius: var(--ni-radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.ni-slot-card:hover {
  border-color: var(--ni-gold-dim);
  transform: translateY(-3px);
  box-shadow: var(--ni-shadow-gold);
}
.ni-slot-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,168,76,0.06), transparent);
}

/* ── Withdrawal Options ─────────────────────────────────── */
.ni-withdrawal-option {
  background: var(--ni-surface);
  border: 2px solid var(--ni-border);
  border-radius: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
}
.ni-withdrawal-option:hover,
.ni-withdrawal-option.selected {
  border-color: var(--ni-gold);
  background: var(--ni-gold-bg);
}
.ni-withdrawal-option .ni-wd-icon {
  width: 40px; height: 40px;
  background: var(--ni-gold-bg);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ni-gold);
  font-size: 18px;
  flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .ni-sidebar {
    transform: translateX(-100%);
  }
  .ni-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,0.5);
  }
  .ni-main { margin-left: 0; }
  .ni-sidebar-toggle { display: flex; }
  .ni-stat-value { font-size: 22px; }
}

@media (max-width: 575.98px) {
  .ni-content { padding: 16px 14px 32px; }
  .ni-auth-card { padding: 24px 20px; }
  .ni-timer-block { min-width: 54px; padding: 10px 12px; }
  .ni-timer-value { font-size: 24px; }
}

/* ── Misc Utilities ─────────────────────────────────────── */
.text-gold    { color: var(--ni-gold)    !important; }
.text-emerald { color: var(--ni-emerald) !important; }
.text-ruby    { color: var(--ni-ruby)    !important; }
.text-sky     { color: var(--ni-sky)     !important; }
.text-muted   { color: var(--ni-text-muted) !important; }

.font-playfair { font-family: 'Playfair Display', serif; }
.font-mono     { font-family: monospace; }

.ni-divider {
  border: none;
  border-top: 1px solid var(--ni-border);
  margin: 20px 0;
}

.ni-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ni-text-muted);
}
.ni-empty-state i { font-size: 48px; margin-bottom: 12px; display: block; opacity: 0.3; }

/* Bootstrap override for dark theme */
.modal-content  { background: var(--ni-card); border: 1px solid var(--ni-border); border-radius: var(--ni-radius); }
.modal-header   { border-bottom: 1px solid var(--ni-border); }
.modal-footer   { border-top: 1px solid var(--ni-border); }
.modal-title    { font-family: 'Playfair Display', serif; color: var(--ni-gold); }

.form-check-input { background-color: var(--ni-surface); border-color: var(--ni-border-light); }
.form-check-input:checked { background-color: var(--ni-gold); border-color: var(--ni-gold); }

.alert-success { background: var(--ni-emerald-bg); border-color: rgba(29,184,122,0.3); color: #5ee8b0; }
.alert-danger  { background: var(--ni-ruby-bg);    border-color: rgba(224,72,60,0.3);  color: #ff8880; }
.alert-warning { background: var(--ni-gold-bg);    border-color: rgba(201,168,76,0.3); color: var(--ni-gold-light); }

.dropdown-menu { background: var(--ni-card); border: 1px solid var(--ni-border); }
.dropdown-item { color: var(--ni-text); }
.dropdown-item:hover { background: var(--ni-gold-bg); color: var(--ni-gold); }

/* ── Modal fixes (Bootstrap stacking context) ───────────── */
.modal { z-index: 1055 !important; }
.modal-backdrop { z-index: 1050 !important; }
.modal-dialog { z-index: 1056 !important; }
.modal-content { position: relative; z-index: 1056 !important; }
.modal-content input,
.modal-content select,
.modal-content textarea {
  position: relative;
  z-index: 1057 !important;
  pointer-events: auto !important;
}