/* ===== Base & Fonts ===== */
body {
  font-family: 'Vazirmatn', Tahoma, Geneva, sans-serif;
  background: #f0f2f5;
  overflow-x: hidden;
  font-size: 0.95rem;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== Page Content Animation ===== */
main {
  animation: fadeIn 0.4s ease-out;
}

/* ===== Navbar ===== */
.navbar {
  background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 50%, #084298 100%) !important;
  box-shadow: 0 2px 15px rgba(13, 110, 253, 0.3);
  backdrop-filter: blur(10px);
}

.navbar-brand strong {
  letter-spacing: -0.5px;
}

.navbar .nav-link {
  transition: all 0.3s ease;
  border-radius: 6px;
  padding: 0.5rem 0.75rem !important;
}

.navbar .nav-link:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}

.navbar .dropdown-menu {
  border: none;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  border-radius: 10px;
  animation: fadeIn 0.2s ease-out;
  padding: 0.5rem;
}

.navbar .dropdown-item {
  border-radius: 6px;
  padding: 0.5rem 1rem;
  transition: all 0.2s;
}

.navbar .dropdown-item:hover {
  background: #f0f6ff;
  padding-right: 1.3rem;
}

/* ===== Sidebar ===== */
.sidebar {
  min-height: calc(100vh - 56px);
  background: linear-gradient(180deg, #1a1f36 0%, #0f1429 100%) !important;
  border: none !important;
  position: relative;
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(13, 110, 253, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.sidebar .position-sticky {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
}

/* Brand */
.sidebar-brand {
  position: relative;
  z-index: 1;
}

.sidebar-brand .brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #0d6efd, #3d8bfd);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

.sidebar-brand .brand-title {
  color: #fff;
  font-size: 1.1rem;
  letter-spacing: -0.3px;
}

.sidebar-brand .brand-subtitle {
  color: #8b9bb4;
  font-size: 0.75rem;
}

/* Menu */
.sidebar-menu {
  position: relative;
  z-index: 1;
}

.sidebar-menu .nav-link {
  font-weight: 500;
  color: #8b9bb4;
  padding: 0.85rem 0 0.85rem 0.5rem;
  border-radius: 10px;
  transition: all 0.3s ease;
  position: relative;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  font-size: 0.95rem;
}

.sidebar-menu .nav-icon {
  width: 28px;
  display: inline-block;
  text-align: center;
  font-size: 1.1rem;
  margin-left: 6px;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.sidebar-menu .nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-menu .nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  transform: translateX(4px);
}

.sidebar-menu .nav-link:hover .nav-icon {
  transform: scale(1.2);
}

.sidebar-menu .nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, #0d6efd, #0b5ed7);
  box-shadow: 0 4px 15px rgba(13, 110, 253, 0.35);
}

.sidebar-menu .nav-link.active .nav-icon {
  transform: scale(1.1);
}

.sidebar-menu .nav-item:nth-child(1) .nav-link { animation: slideInRight 0.3s ease-out 0.05s both; }
.sidebar-menu .nav-item:nth-child(2) .nav-link { animation: slideInRight 0.3s ease-out 0.1s both; }
.sidebar-menu .nav-item:nth-child(3) .nav-link { animation: slideInRight 0.3s ease-out 0.15s both; }

/* Sidebar Footer */
.sidebar-footer {
  color: #5a6a85;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.sidebar-footer::before {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  margin-bottom: 1rem;
}

/* ===== Cards ===== */
.card {
  border: none;
  border-radius: 12px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.card.shadow-sm {
  box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
}

.card.shadow-sm:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
  transform: translateY(-2px);
}

/* Stat Cards */
.card.bg-primary,
.card.bg-success,
.card.bg-warning,
.card.bg-danger {
  border-radius: 14px;
  transition: all 0.35s ease;
  position: relative;
  overflow: hidden;
}

.card.bg-primary { background: linear-gradient(135deg, #0d6efd, #3d8bfd) !important; }
.card.bg-success { background: linear-gradient(135deg, #198754, #2ea66e) !important; }
.card.bg-warning { background: linear-gradient(135deg, #e8a317, #ffc107) !important; }
.card.bg-danger  { background: linear-gradient(135deg, #dc3545, #e8686e) !important; }

.card.bg-primary:hover,
.card.bg-success:hover,
.card.bg-warning:hover,
.card.bg-danger:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

.card.bg-primary .fs-1,
.card.bg-success .fs-1,
.card.bg-warning .fs-1,
.card.bg-danger .fs-1 {
  animation: float 3s ease-in-out infinite;
}

/* Stat Card Icons */
.stat-icon {
  font-size: 2.5rem;
  opacity: 0.4;
  animation: float 3s ease-in-out infinite;
  filter: grayscale(20%);
}

.stat-card {
  position: relative;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.card.bg-primary { animation: fadeIn 0.4s ease-out 0.1s both; }
.card.bg-success { animation: fadeIn 0.4s ease-out 0.2s both; }
.card.bg-warning { animation: fadeIn 0.4s ease-out 0.3s both; }
.card.bg-danger  { animation: fadeIn 0.4s ease-out 0.4s both; }

.card-header {
  background: transparent;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 600;
}

/* ===== Login Page ===== */
.login-bg {
  background: linear-gradient(135deg, #0d6efd 0%, #6610f2 50%, #6f42c1 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  min-height: 100vh;
  position: relative;
}

.login-bg::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 40%),
    radial-gradient(circle at 60% 80%, rgba(255,255,255,0.04) 0%, transparent 40%);
}

.login-card {
  border-radius: 20px !important;
  animation: scaleIn 0.5s ease-out;
  backdrop-filter: blur(20px);
}

.login-card .card-header {
  border-radius: 20px 20px 0 0 !important;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05)) !important;
  backdrop-filter: blur(10px);
  padding: 2rem !important;
}

.login-card .card-body {
  padding: 2rem !important;
}

/* ===== Forms ===== */
.form-control,
.form-select {
  border-radius: 10px;
  border: 1.5px solid #e0e0e0;
  padding: 0.6rem 1rem;
  transition: all 0.3s ease;
  background: #fafbfc;
}

.form-control:focus,
.form-select:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
  background: #fff;
  transform: translateY(-1px);
}

.form-label {
  font-weight: 500;
  color: #444;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.form-check-input:checked {
  background-color: #0d6efd;
  border-color: #0d6efd;
}

/* ===== Buttons ===== */
.btn {
  border-radius: 10px;
  padding: 0.5rem 1.2rem;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, #0d6efd, #0b5ed7);
  border: none;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0b5ed7, #0a58ca);
  box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
  transform: translateY(-2px);
}

.btn-success {
  box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(25, 135, 84, 0.4);
}

.btn-outline-primary:hover {
  transform: translateY(-1px);
}

.btn-outline-danger:hover {
  transform: translateY(-1px);
}

/* ===== Tables ===== */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  border-top: none;
  color: #555;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.9rem 0.75rem;
}

.table tbody tr {
  transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
  background-color: #f0f6ff !important;
  transform: scale(1.005);
}

.table tbody td {
  vertical-align: middle;
  padding: 0.85rem 0.75rem;
}

/* ===== Badges ===== */
.badge {
  border-radius: 8px;
  padding: 0.4em 0.7em;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.badge.bg-success {
  background: linear-gradient(135deg, #198754, #2ea66e) !important;
}

.badge.bg-danger {
  background: linear-gradient(135deg, #dc3545, #e8686e) !important;
}

.badge.bg-warning {
  background: linear-gradient(135deg, #e8a317, #ffc107) !important;
}

.badge.bg-secondary {
  background: linear-gradient(135deg, #6c757d, #8a929a) !important;
}

/* ===== Alerts ===== */
.alert {
  border-radius: 12px;
  border: none;
  animation: fadeIn 0.3s ease-out;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.alert-success { background: linear-gradient(135deg, #d1e7dd, #badbcc); color: #0a3622; }
.alert-danger  { background: linear-gradient(135deg, #f8d7da, #f5c2c7); color: #58151c; }
.alert-info    { background: linear-gradient(135deg, #cfe2ff, #b6d4fe); color: #084298; }
.alert-warning { background: linear-gradient(135deg, #fff3cd, #ffe69c); color: #664d03; }

/* ===== Code ===== */
code {
  font-size: 0.85em;
  direction: ltr;
  display: inline-block;
  background: #f0f2f5;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #e8eaed;
  color: #d63384;
  font-family: 'Fira Code', 'Consolas', monospace;
}

/* ===== Borders & Dividers ===== */
.border {
  border-radius: 12px !important;
  border-color: #e8eaed !important;
}

.border-bottom {
  border-color: #e8eaed !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* ===== Chart Canvas ===== */
.chart-container {
  position: relative;
  width: 100%;
}

/* ===== Utilities ===== */
.min-vh-100 {
  min-height: 100vh;
}

.text-muted {
  color: #888 !important;
}

/* ===== Staggered Animations ===== */
.animate-stagger > *:nth-child(1) { animation: fadeIn 0.4s ease-out 0.05s both; }
.animate-stagger > *:nth-child(2) { animation: fadeIn 0.4s ease-out 0.1s both; }
.animate-stagger > *:nth-child(3) { animation: fadeIn 0.4s ease-out 0.15s both; }
.animate-stagger > *:nth-child(4) { animation: fadeIn 0.4s ease-out 0.2s both; }
.animate-stagger > *:nth-child(5) { animation: fadeIn 0.4s ease-out 0.25s both; }
.animate-stagger > *:nth-child(6) { animation: fadeIn 0.4s ease-out 0.3s both; }

/* ===== Responsive ===== */
@media (max-width: 767.98px) {
  .sidebar {
    min-height: auto;
  }
  .card.bg-primary:hover,
  .card.bg-success:hover,
  .card.bg-warning:hover,
  .card.bg-danger:hover {
    transform: translateY(-2px) scale(1.01);
  }
}

/* ===== Buyer Searchable Dropdown ===== */
.buyer-dropdown {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  top: 100%;
  margin-top: 2px;
}
.buyer-dropdown .list-group-item {
  text-align: right;
  border-radius: 0 !important;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}
.buyer-dropdown .list-group-item:hover {
  background-color: #e9f0ff;
}
