@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-hover: #19243d;
  --bg-input: #1a233a;
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(59, 130, 246, 0.3);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #60a5fa;
  text-decoration: none;
  transition: all 0.2s ease;
}
a:hover {
  color: #93c5fd;
}

/* Navbar */
.navbar-custom {
  background: rgba(19, 27, 46, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.65rem 0;
  z-index: 1030;
}
.navbar-brand {
  font-weight: 800;
  font-size: 1.15rem;
  background: linear-gradient(135deg, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.navbar-brand .badge {
  -webkit-text-fill-color: #ffffff !important;
  color: #ffffff !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
}

.text-primary {
  color: #60a5fa !important;
}

.badge.border-primary,
.badge.bg-primary.bg-opacity-20,
.badge.bg-primary.bg-opacity-25 {
  color: #93c5fd !important;
}
.nav-link {
  color: #cbd5e1 !important;
  font-weight: 500;
  padding: 0.5rem 0.85rem !important;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.nav-link:hover, .nav-link.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.06);
}

/* Cards */
.card-custom {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card-custom:hover {
  border-color: var(--border-glow);
}
.card-custom-interactive:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.15);
}

/* Hero Section */
.hero-gradient {
  background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.05) 50%, transparent 80%);
  padding: 3.5rem 0 2rem;
}

/* Buttons */
.btn-primary-custom {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
  padding: 0.55rem 1.25rem;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.28);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.btn-primary-custom:hover {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4);
  color: #fff;
  transform: translateY(-1px);
}
.btn-outline-custom {
  border: 1px solid var(--border-color);
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.btn-outline-custom:hover {
  border-color: var(--primary);
  color: #fff;
  background: rgba(59, 130, 246, 0.1);
}

/* Forms */
.form-control, .form-select {
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  color: #fff !important;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22) !important;
}
.form-control::placeholder {
  color: #64748b;
}

/* Sidebar for Desktop */
.sidebar-wrapper {
  background-color: var(--bg-card);
  border-left: 1px solid var(--border-color);
  min-height: calc(100vh - 65px);
  padding: 1.25rem 0.85rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  color: #94a3b8;
  border-radius: 10px;
  font-weight: 500;
  margin-bottom: 0.25rem;
  font-size: 0.92rem;
  transition: all 0.2s ease;
  text-decoration: none;
}
.sidebar-link:hover, .sidebar-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(99, 102, 241, 0.16));
  border-right: 3px solid var(--primary);
}

/* Offcanvas Sidebar for Mobile */
.offcanvas-custom {
  background-color: #0e1424 !important;
  color: #fff;
  border-left: 1px solid var(--border-color);
  max-width: 82vw;
  width: 310px;
}
.offcanvas-custom .offcanvas-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
}
.offcanvas-custom .sidebar-link {
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

/* Progress bar */
.progress-custom {
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  display: flex;
  width: 100%;
}
.progress-bar-custom {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 0;
}
.progress-bar-custom.bg-danger {
  background: linear-gradient(90deg, #ef4444, #dc2626) !important;
}
.progress-bar-custom.bg-warning {
  background: linear-gradient(90deg, #f59e0b, #d97706) !important;
}
.progress-bar-custom.bg-success {
  background: linear-gradient(90deg, #10b981, #059669) !important;
}

/* Badges */
.badge-active { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-expired { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }

/* Tables Responsive */
.table-responsive {
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.3) rgba(255, 255, 255, 0.05);
}
.table-responsive::-webkit-scrollbar {
  height: 6px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.35);
  border-radius: 4px;
}

.table-custom {
  color: var(--text-main);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin-bottom: 0;
  min-width: 620px;
}
.table-custom th {
  background-color: rgba(255, 255, 255, 0.035);
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.table-custom td {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-size: 0.9rem;
}
.table-custom tr:last-child td {
  border-bottom: none;
}
.table-custom tr:hover td {
  background-color: rgba(255, 255, 255, 0.025);
}

/* Toast Notification */
.toast-copied {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: #fff;
  padding: 0.6rem 1.4rem;
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  font-weight: 600;
  z-index: 9999;
  display: none;
}

/* Mobile Bottom Action / Navigation Bar */
.mobile-bottom-nav {
  display: none;
}

/* ========================================================
   Responsive Breakpoints & Mobile Optimization
   ======================================================== */
@media (max-width: 991.98px) {
  .hero-gradient {
    padding: 2.5rem 0 1.5rem;
  }
  .hero-gradient h1 {
    font-size: 1.85rem !important;
  }

  .card-custom {
    border-radius: 12px;
  }

  /* Padding adjustments */
  .p-md-5 {
    padding: 1.25rem !important;
  }
  .card-custom.p-4 {
    padding: 1.15rem !important;
  }
  .card-custom.p-5 {
    padding: 1.35rem !important;
  }

  /* Admin Header compact */
  .navbar-brand span.fs-6 {
    font-size: 0.88rem !important;
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .navbar-custom .container-fluid {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  /* Quick action buttons on mobile */
  .btn-sm-mobile {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.82rem !important;
  }

  /* Tables */
  .table-custom th, .table-custom td {
    padding: 0.75rem 0.65rem;
    font-size: 0.84rem;
  }

  /* Modals */
  .modal-dialog {
    margin: 0.75rem;
  }
  .modal-content {
    border-radius: 14px;
  }
  .modal-body {
    padding: 1rem;
    max-height: 75vh;
    overflow-y: auto;
  }

  /* QR code responsiveness */
  #qrcodeContainer canvas {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Filter buttons row */
  .d-flex.gap-2.flex-wrap, .d-flex.gap-1.flex-wrap {
    gap: 0.35rem !important;
  }
}

@media (max-width: 575.98px) {
  body {
    font-size: 0.9rem;
    padding-bottom: 50px;
  }

  .container, .container-fluid {
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }

  .display-4 {
    font-size: 1.65rem !important;
  }
  .display-5 {
    font-size: 1.5rem !important;
  }
  .display-6 {
    font-size: 1.35rem !important;
  }

  .card-custom.p-4, .card-custom.p-3 {
    padding: 0.95rem !important;
  }

  /* Form labels */
  .form-label {
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
  }

  /* Buttons */
  .btn-primary-custom, .btn-outline-custom {
    padding: 0.5rem 0.95rem;
    font-size: 0.88rem;
  }

  /* Breadcrumb & Top Bar */
  .d-flex.justify-content-between.align-items-center.flex-wrap {
    gap: 0.65rem !important;
  }

  /* Bottom quick navbar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(14, 20, 36, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    z-index: 1040;
    align-items: center;
    justify-content: space-around;
    padding: 0.25rem 0.5rem;
  }
  .mobile-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 500;
    flex: 1;
    padding: 0.2rem 0;
    transition: color 0.15s ease;
  }
  .mobile-bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.15rem;
  }
  .mobile-bottom-nav-item.active, .mobile-bottom-nav-item:hover {
    color: var(--primary);
  }
}

/* Force text wrapping and prevent any horizontal blowout */
p, span, div, li, td, th, a, label, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.badge {
  white-space: normal !important;
  text-align: right;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}


/* Floating Telegram Support Button */
.floating-support-btn {
  position: fixed;
  bottom: 25px;
  left: 25px;
  z-index: 1050;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff !important;
  text-decoration: none !important;
  padding: 0.65rem 1.1rem;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.35);
  transition: all 0.25s ease-in-out;
}

.floating-support-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 28px rgba(14, 165, 233, 0.5);
  background: linear-gradient(135deg, #0369a1, #0284c7);
  color: #ffffff !important;
}

@media (max-width: 768px) {
  .floating-support-btn {
    bottom: 70px;
    left: 15px;
    padding: 0.6rem 0.8rem;
  }
}
