/* ============================================
   DASHBOARD STYLES
   ============================================ */

/* Main Layout */

.dashboard-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
  background: #f5f5f7;
  position: relative;
}

/* Sidebar */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 280px;
  background: rgba(247, 247, 250, 0.96);
  border-right: 1px solid rgba(148, 163, 184, 0.24);
  padding: 18px 16px 18px;
  overflow: hidden;
  z-index: 110;
  transition: width 0.28s ease, padding 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 rgba(15, 23, 42, 0);
}

.sidebar:not(.is-expanded) {
  width: 90px;
  padding-left: 12px;
  padding-right: 12px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  margin-bottom: 18px;
  padding: 2px 6px 0;
}

.sidebar:not(.is-expanded) .sidebar-header {
  justify-content: center;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 2.1rem;
  font-weight: 800;
  color: #1f2937;
  letter-spacing: -0.04em;
  white-space: nowrap;
  line-height: 1;
  transition: all 0.2s ease;
}

.sidebar:not(.is-expanded) .sidebar-logo {
  font-size: 0;
  gap: 0;
}

.sidebar:not(.is-expanded) .theme-toggle {
  display: none;
}

.sidebar-logo::before {
  content: 'N';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.22);
}

.sidebar:not(.is-expanded) .sidebar-logo::before {
  width: 34px;
  height: 34px;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  color: #4b5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.sidebar-nav-item {
  margin: 0;
}

.sidebar-nav-item:last-child {
  margin-top: auto;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 14px;
  color: #1f2937;
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.sidebar:not(.is-expanded) .sidebar-nav-link {
  justify-content: center;
  padding: 0;
  font-size: 0;
}

.sidebar:not(.is-expanded) .sidebar-nav-link .sidebar-nav-icon {
  margin-right: 0;
}

.sidebar-nav-link:hover,
.sidebar-nav-link.active {
  background: rgba(91, 76, 242, 0.12);
  color: #4f46e5;
  border-color: rgba(91, 76, 242, 0.06);
}

.sidebar-nav-link.active {
  background: rgba(91, 76, 242, 0.11);
}

.sidebar-nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.15rem;
}

.sidebar-logout-link {
  margin-top: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  padding-top: 12px;
  padding-bottom: 12px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  display: block;
  background: rgba(17, 24, 39, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 90;
}

body.desktop-sidebar-expanded .sidebar-backdrop,
body.mobile-sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.mobile-sidebar-open {
  overflow: hidden;
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  margin-left: 280px;
  padding: 28px 34px 52px;
  transition: margin-left 0.25s ease, padding 0.25s ease;
}

.sidebar:not(.is-expanded) ~ .dashboard-main {
  margin-left: 90px;
}

/* Navbar */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-2xl);
  padding: var(--spacing-lg) var(--spacing-xl);
  background: rgba(26, 31, 58, 0.4);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar-title {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.navbar-search {
  position: relative;
  width: 200px;
}

.navbar-search input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  padding-left: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-primary);
}

.navbar-search input::placeholder {
  color: var(--color-text-tertiary);
}

.navbar-search input:focus {
  outline: none;
  border-color: var(--color-neon-blue);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

.navbar-search::before {
  content: '🔍';
  position: absolute;
  left: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  pointer-events: none;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding-left: var(--spacing-lg);
  border-left: 1px solid var(--color-border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: var(--font-lg);
  cursor: pointer;
}

.user-menu {
  position: relative;
}

.user-menu-button {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: var(--font-xl);
  transition: color var(--transition-fast);
}

.user-menu-button:hover {
  color: var(--color-text-primary);
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: var(--spacing-md);
  background: rgba(26, 31, 58, 0.9);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.user-dropdown.hidden {
  display: none;
}

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  text-align: left;
  cursor: pointer;
  font-size: var(--font-base);
  transition: all var(--transition-fast);
}

.user-dropdown-item:hover {
  background: rgba(168, 85, 247, 0.1);
  color: var(--color-text-primary);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--spacing-xs) 0;
}

/* Dashboard Header */

.dashboard-header {
  margin-bottom: var(--spacing-2xl);
  animation: slide-up 0.6s ease-out;
}

.dashboard-header h1 {
  font-size: var(--font-4xl);
  margin-bottom: var(--spacing-md);
}

.dashboard-header p {
  color: var(--color-text-secondary);
  font-size: var(--font-lg);
}

/* Dashboard Grid */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-2xl);
}

/* Welcome Card */

.welcome-card {
  grid-column: span 2;
  background: var(--gradient-primary);
  background-size: 400% 400%;
  border-radius: var(--radius-lg);
  padding: var(--spacing-2xl);
  color: white;
  position: relative;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.welcome-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: float 8s ease-in-out infinite;
}

.welcome-card-content {
  position: relative;
  z-index: 1;
}

.welcome-card h2 {
  font-size: var(--font-3xl);
  margin-bottom: var(--spacing-md);
}

.welcome-card p {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--spacing-lg);
}

.welcome-card-actions {
  display: flex;
  gap: var(--spacing-md);
}

.welcome-card .btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
}

.welcome-card .btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Stats Card */

.stats-card {
  background: var(--glass-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  transition: all var(--transition-normal);
}

.stats-card:hover {
  border-color: rgba(168, 85, 247, 0.3);
  box-shadow: 0 8px 32px rgba(168, 85, 247, 0.2);
  transform: translateY(-4px);
}

.stats-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-2xl);
  flex-shrink: 0;
}

.stats-content {
  flex: 1;
}

.stats-label {
  color: var(--color-text-secondary);
  font-size: var(--font-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-xs);
}

.stats-value {
  font-size: var(--font-3xl);
  font-weight: 700;
  color: var(--color-text-primary);
}

.stats-change {
  font-size: var(--font-sm);
  color: #86efac;
  margin-top: var(--spacing-xs);
}

.stats-change.negative {
  color: #fca5a5;
}

/* History Section */

.history-section {
  margin-bottom: var(--spacing-2xl);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.section-title {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
}

.section-link {
  color: var(--color-neon-blue);
  font-size: var(--font-base);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.section-link:hover {
  color: var(--color-neon-cyan);
}

/* History Table */

.history-table {
  border-collapse: collapse;
  /* background: rgba(26, 31, 58, 0.4); */
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.history-section{
    overflow-x:auto;
}

.history-table{
    width:100%;
}

.history-table thead {
  /* background: rgba(26, 31, 58, 0.8); */
}

.history-table th {
  padding: var(--spacing-lg);
  text-align: left;
  color: var(--color-text-secondary);
  font-size: var(--font-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
}

.history-table td {
  padding: var(--spacing-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--color-text-primary);
}

.history-table tbody tr:hover {
  background: rgba(168, 85, 247, 0.05);
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

.table-status {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(0, 212, 255, 0.1);
  color: var(--color-neon-blue);
  border-radius: var(--radius-full);
  font-size: var(--font-sm);
  font-weight: 600;
}

.table-status.completed {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

.table-status.pending {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

.table-status.failed {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

/* Quick Actions */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-2xl);
}

.action-card {
  /* background: rgba(26, 31, 58, 0.4); */
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.action-card:hover {
  border-color: var(--color-neon-blue);
  background: rgba(0, 212, 255, 0.05);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 212, 255, 0.2);
}

.action-icon {
  font-size: var(--font-4xl);
  margin-bottom: var(--spacing-md);
}

.action-title {
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.action-description {
  color: var(--color-text-secondary);
  font-size: var(--font-sm);
}

/* Responsive Design */

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

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: var(--spacing-lg);
    flex-wrap: wrap;
  }

  .sidebar-nav {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: 0;
  }

  .sidebar-nav-item {
    margin-bottom: 0;
  }

  .dashboard-main {
    grid-column: 1;
  }
}

@media (max-width: 900px) {
  .dashboard-layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    width: 280px;
    max-width: 82vw;
    height: 100vh;
    z-index: 120;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    background: rgba(248, 249, 252, 0.98);
  }

  .sidebar.is-expanded {
    transform: translateX(0);
  }

  .sidebar:not(.is-expanded) {
    width: 280px;
    transform: translateX(-100%);
    padding-left: 16px;
    padding-right: 16px;
  }

  .sidebar:not(.is-expanded) .sidebar-nav-link {
    opacity: 1;
    max-height: 220px;
    font-size: 1.02rem;
    padding: 0 14px;
    justify-content: flex-start;
  }

  body.mobile-sidebar-open {
    overflow: hidden;
  }

  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 115;
  }

  body.mobile-sidebar-open .sidebar-backdrop,
  body.desktop-sidebar-expanded .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .dashboard-main {
    margin-left: 0;
    padding: 28px 20px 52px;
  }

  .mobile-sidebar-toggle {
    position: fixed;
    left: 16px;
    top: 18px;
    z-index: 130;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-sidebar-toggle-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 18px;
  }

  .mobile-sidebar-toggle-icon span {
    display: block;
    height: 2px;
    background: #1f2937;
    border-radius: 999px;
  }
}

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

  .welcome-card {
    grid-column: span 1;
  }

  .navbar {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .navbar-search {
    width: 100%;
  }

  .navbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .dashboard-main {
    padding: var(--spacing-lg);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .sidebar {
    overflow-x: auto;
  }

  .sidebar-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .history-table {
    font-size: var(--font-sm);
  }

  .history-table th,
  .history-table td {
    padding: var(--spacing-md);
  }
}