/* ═══════════════════════════════════════════════════════════════
   سامانه قاسمی گروپ — Premium Enhancement Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── Foundational Animations ── */

@keyframes fadeInUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeInDown {
  from {
    transform: translateY(-18px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeInScale {
  from {
    transform: scale(0.92);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(40px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }

  100% {
    background-position: calc(200px + 100%) 0;
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes glowPulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.15);
  }

  50% {
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.3);
  }
}

@keyframes unreadPulse {

  0%,
  100% {
    border-color: var(--primary-solid);
  }

  50% {
    border-color: transparent;
  }
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-16px) rotate(180deg);
  }
}

@keyframes bounce {

  0%,
  20%,
  53%,
  80%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  40%,
  43% {
    transform: translate3d(0, -24px, 0);
  }

  70% {
    transform: translate3d(0, -12px, 0);
  }

  90% {
    transform: translate3d(0, -4px, 0);
  }
}

@keyframes borderGlow {

  0%,
  100% {
    border-color: rgba(99, 102, 241, 0.15);
  }

  50% {
    border-color: rgba(99, 102, 241, 0.4);
  }
}

/* ── Page Load: Staggered Content Entrance ── */

.container {
  animation: fadeInUp 0.5s ease both;
}

.card {
  animation: fadeInScale 0.45s ease both;
}

.card:nth-child(1) {
  animation-delay: 0.05s;
}

.card:nth-child(2) {
  animation-delay: 0.12s;
}

.card:nth-child(3) {
  animation-delay: 0.19s;
}

.card:nth-child(4) {
  animation-delay: 0.26s;
}

.stat:nth-child(1) {
  animation: slideInRight 0.5s ease both;
  animation-delay: 0.08s;
}

.stat:nth-child(2) {
  animation: slideInRight 0.5s ease both;
  animation-delay: 0.16s;
}

.stat:nth-child(3) {
  animation: slideInRight 0.5s ease both;
  animation-delay: 0.24s;
}

.stat:nth-child(4) {
  animation: slideInRight 0.5s ease both;
  animation-delay: 0.32s;
}

.stat:nth-child(5) {
  animation: slideInRight 0.5s ease both;
  animation-delay: 0.40s;
}

/* ── Card Hover: 3D Lift ── */

.card {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3),
    0 8px 20px rgba(99, 102, 241, 0.12);
}

/* ── Stat-Cards: Premium Hover ── */

.stat-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -60%;
  right: -60%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 24px 48px rgba(99, 102, 241, 0.14),
    0 8px 20px rgba(0, 0, 0, 0.08);
}

.stat-card:hover::after {
  opacity: 1;
}

/* Staggered stat-card entrance */
.stats-grid .stat-card:nth-child(1) {
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.08s;
}

.stats-grid .stat-card:nth-child(2) {
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.16s;
}

.stats-grid .stat-card:nth-child(3) {
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.24s;
}

.stats-grid .stat-card:nth-child(4) {
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.32s;
}

.stats-grid .stat-card:nth-child(5) {
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.40s;
}

.stats-grid .stat-card:nth-child(6) {
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.48s;
}

/* ── Buttons: Ripple Effect ── */

.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.35);
}

.btn-danger:hover {
  box-shadow: 0 8px 28px rgba(239, 68, 68, 0.3);
}

.btn:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.5);
  outline-offset: 2px;
}

/* ── Form Inputs: Glow Focus ── */

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
select,
textarea {
  transition: border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.2s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):focus,
select:focus,
textarea:focus {
  border-color: var(--primary-solid) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2),
    0 4px 16px rgba(99, 102, 241, 0.08) !important;
  transform: scale(1.01);
}

/* ── Tables: Premium Style ── */

.table-wrap {
  position: relative;
  transition: box-shadow 0.3s ease;
}

.table-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-solid), var(--primary-strong), var(--primary-solid));
  background-size: 200% 100%;
  animation: gradientFlow 4s ease infinite;
  z-index: 2;
  border-radius: 4px 4px 0 0;
}

.table-wrap:hover {
  box-shadow: 0 24px 48px rgba(99, 102, 241, 0.1);
}

tbody tr {
  transition: all 0.25s ease;
}

tbody tr:hover {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.04), rgba(99, 102, 241, 0.08));
}

/* Stagger table rows */
tbody tr:nth-child(1) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.03s;
}

tbody tr:nth-child(2) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.06s;
}

tbody tr:nth-child(3) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.09s;
}

tbody tr:nth-child(4) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.12s;
}

tbody tr:nth-child(5) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.15s;
}

tbody tr:nth-child(6) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.18s;
}

tbody tr:nth-child(7) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.21s;
}

tbody tr:nth-child(8) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.24s;
}

tbody tr:nth-child(9) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.27s;
}

tbody tr:nth-child(10) {
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.30s;
}

/* ── Pagination: Pill Style ── */

.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 16px 20px;
  flex-wrap: wrap;
}

.pagination .btn {
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination .btn.active,
.pagination .meta-chip {
  background: var(--primary-solid);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ── Status Badges: Enhanced ── */

.status-badge,
.type-tag,
.status-tag {
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

.status-badge:hover,
.type-tag:hover,
.status-tag:hover {
  transform: scale(1.06);
}

.status-approved,
.status-tag.status-active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-color: transparent;
}

.status-returned {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border-color: transparent;
}

.status-submitted {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  border-color: transparent;
}

.status-inactive {
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Company Type Tags ── */

.type-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  min-width: 80px;
  color: #fff !important;
  /* Ensure text is readable */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.type-foreign_company {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
  border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

.type-mother {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

.type-provincial {
  background: linear-gradient(135deg, #14b8a6, #0d9488) !important;
  border: 1px solid rgba(20, 184, 166, 0.3) !important;
}

.type-representative {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

/* ── Empty State: Premium ── */

.empty-state {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 2px dashed rgba(99, 102, 241, 0.2);
  border-radius: var(--radius);
  padding: 60px 40px;
  text-align: center;
  animation: fadeInUp 0.6s ease both;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 600;
}

.empty-state::before {
  content: "📋";
  display: block;
  font-size: 4rem;
  margin-bottom: 20px;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* ── Notification Items: Enhanced ── */

.notification-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-item:hover {
  transform: translateX(-4px);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
}

.notification-item.unread {
  animation: glowPulse 2.5s ease-in-out infinite;
  border-right: 4px solid var(--primary-solid);
}

/* ── Actions Buttons: Ripple ── */

.actions .btn {
  position: relative;
  overflow: hidden;
}

.actions .btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
  pointer-events: none;
}

.actions .btn:hover::before {
  width: 300px;
  height: 300px;
}

/* ── Custom Scrollbar ── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-solid), var(--primary-strong));
  border-radius: 10px;
  border: 1px solid transparent;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-strong);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-solid) transparent;
}

/* ── Logo Pulse ── */

.brand-mark {
  animation: pulse 4s ease-in-out infinite;
  transition: transform 0.3s ease;
}

.brand-mark:hover {
  animation-play-state: paused;
  transform: rotate(5deg) scale(1.12);
}

/* ── Filter Buttons ── */

.list-filters .btn {
  transition: all 0.3s ease;
}

.list-filters .btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
  transform: scale(1.02);
}

/* ── Form Sections ── */

.form-section {
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.form-section::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-solid), var(--primary-strong));
  transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-section:hover::before,
.form-section:focus-within::before {
  left: 0;
}

/* ── Save Button: Shine Effect ── */

.btn-save {
  position: relative;
  overflow: hidden;
}

.btn-save::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.btn-save:hover::before {
  left: 120%;
}

/* ── Alert Messages: Premium Toast ── */

.messages {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 420px;
}

.messages .alert {
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 16px 22px;
  margin-bottom: 10px;
  animation: slideInRight 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.messages .alert::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 4px;
}

.messages .alert-success::before {
  background: linear-gradient(180deg, #10b981, #059669);
}

.messages .alert-error::before {
  background: linear-gradient(180deg, #ef4444, #dc2626);
}

.messages .alert-warning::before {
  background: linear-gradient(180deg, #f59e0b, #d97706);
}

/* Default dark text colors for alerts */
.messages .alert-success {
  color: #34d399;
}

.messages .alert-error {
  color: #f87171;
}

.messages .alert-warning {
  color: #fbbf24;
}

/* Light theme overrides */
body.theme-light .messages .alert {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

body.theme-light .messages .alert-success {
  color: #065f46;
}

body.theme-light .messages .alert-error {
  color: #991b1b;
}

body.theme-light .messages .alert-warning {
  color: #92400e;
}

body.theme-light .card {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.4);
}

body.theme-light tbody tr:hover {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.04), rgba(99, 102, 241, 0.08));
}

/* ── Responsive: Mobile Adjustments ── */

@media (max-width: 768px) {
  .actions {
    flex-direction: column;
    width: 100%;
  }

  .actions .btn {
    width: 100%;
    justify-content: center;
  }

  .pagination {
    justify-content: center;
  }

  .pagination .btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .messages {
    left: 10px;
    right: 10px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .form-card {
    padding: 15px;
  }

  .form-header {
    padding: 15px;
    margin: -15px -15px 20px -15px;
  }

  .section-content {
    padding: 15px;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .dashboard-title {
    font-size: 1.8rem;
  }
}

/* ── Reduced Motion ── */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}