/* =============================================================================
   techiemuthuraj Files - Admin Dashboard Stylesheet
   Modern SaaS Control Panel with Sidebar, KPIs, Data Tables, & Modals
   ============================================================================= */

.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform var(--transition-normal);
}

.sidebar-brand {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  font-weight: 600;
  border-left: 3px solid var(--accent-cyan);
}

.nav-icon {
  font-size: 1.15rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

/* Main Content Viewport */
.admin-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  height: 68px;
  background: rgba(14, 21, 36, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-content {
  padding: 2rem;
  flex: 1;
}

/* View Sections */
.admin-tab {
  display: none;
}

.admin-tab.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Metric Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.6rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: all var(--transition-bounce);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #00f2fe, #a855f7);
  opacity: 0.8;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 242, 254, 0.4);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 242, 254, 0.2);
}

.stat-card-info h4 {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card-val {
  font-size: 2.2rem;
  font-weight: 900;
  font-family: var(--font-hero);
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.icon-cyan {
  background: rgba(0, 242, 254, 0.12);
  color: var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
  border-color: rgba(0, 242, 254, 0.3);
}

.icon-indigo {
  background: rgba(168, 85, 247, 0.12);
  color: var(--neon-purple);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
  border-color: rgba(168, 85, 247, 0.3);
}

.icon-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: var(--neon-emerald);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  border-color: rgba(16, 185, 129, 0.3);
}

.icon-rose {
  background: rgba(244, 63, 94, 0.12);
  color: var(--neon-pink);
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.3);
  border-color: rgba(244, 63, 94, 0.3);
}

/* Tables */
.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-top: 1.25rem;
}

.table-toolbar {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
  flex-wrap: wrap;
}

.table-search-input {
  max-width: 320px;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.85rem 1.25rem;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Chips */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-revoked {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.status-expired {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-exhausted {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Token Generation Output Box */
.token-output-area {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: pre-wrap;
  user-select: all;
  margin-top: 1rem;
}

/* Responsive Admin Navigation & Layout Engine */
.admin-mobile-toggle {
  display: none;
  font-size: 1.2rem;
  padding: 0.45rem 0.75rem;
}

.admin-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 199;
}

.admin-sidebar-backdrop.active {
  display: block;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .admin-mobile-toggle {
    display: inline-flex !important;
  }
  .admin-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px !important;
    z-index: 200 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.85);
  }
  .admin-sidebar.open {
    transform: translateX(0) !important;
  }
  .admin-main {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .admin-topbar {
    padding: 0.85rem 1.15rem;
  }
  .admin-content {
    padding: 1.25rem 1rem;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  .batch-action-bar {
    left: 0.85rem !important;
    right: 0.85rem !important;
    transform: none !important;
    width: auto !important;
    flex-wrap: wrap !important;
    gap: 0.65rem;
    padding: 0.75rem 1rem !important;
    bottom: 1rem !important;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .topbar-right .social-icon-btn span {
    display: none;
  }
  .topbar-right > div {
    display: none;
  }
}

/* =============================================================================
   ADMIN AUTHENTICATION GATEWAY MODAL & ENTER UX STYLING
   ============================================================================= */
.admin-auth-box {
  max-width: 480px !important;
  background: linear-gradient(180deg, rgba(14, 21, 38, 0.98) 0%, rgba(7, 11, 20, 0.99) 100%) !important;
  border: 1px solid rgba(0, 242, 254, 0.28) !important;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85), 0 0 50px rgba(0, 242, 254, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--radius-xl) !important;
  overflow: hidden;
  position: relative;
}

.admin-auth-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-primary);
  background-size: 200% 200%;
  animation: btnGradientShift 4s ease infinite;
}

.admin-auth-header {
  padding: 2rem 1.85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(0, 242, 254, 0.05) 0%, transparent 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.auth-shield-emblem {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.18), rgba(168, 85, 247, 0.25));
  border: 1px solid rgba(0, 242, 254, 0.45);
  box-shadow: 0 0 35px var(--neon-cyan-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  animation: neonPulse 3s ease-in-out infinite;
}

.auth-title-wrap h3 {
  font-family: var(--font-hero);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.auth-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.8rem;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-auth-body {
  padding: 1.85rem;
}

.admin-auth-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-security-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--neon-cyan);
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: var(--radius-full);
  padding: 0.15rem 0.6rem;
  letter-spacing: 0.02em;
}

.admin-auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.admin-key-input {
  font-family: var(--font-mono) !important;
  letter-spacing: 0.06em;
  font-size: 0.98rem !important;
}

.pwd-toggle-btn {
  font-size: 1.1rem;
  user-select: none;
}

.admin-auth-submit-btn {
  width: 100%;
  padding: 0.95rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  position: relative;
  cursor: pointer;
  margin-top: 0.5rem;
}

.admin-auth-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.enter-kbd-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.04em;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.5);
  margin-left: auto;
}

.enter-shortcut-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.15rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.enter-shortcut-hint .kbd-mini {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--neon-cyan);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  animation: neonPulse 2s infinite;
}

/* Auth Error Alert */
.admin-auth-error-banner {
  padding: 0.85rem 1.1rem;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: var(--radius-md);
  color: #fb7185;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.2);
  animation: fadeIn 0.25s ease-out;
}

/* Shake Animation on Wrong Secret Key */
@keyframes shakeBox {
  0%, 100% { transform: scale(1) translateY(0) translateX(0); }
  20%, 60% { transform: scale(1) translateY(0) translateX(-8px); }
  40%, 80% { transform: scale(1) translateY(0) translateX(8px); }
}

.shake-error {
  animation: shakeBox 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both !important;
}

/* Multi-Select Floating Batch Actions Bar */
.batch-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.4rem;
  background: linear-gradient(135deg, rgba(14, 21, 38, 0.98), rgba(19, 27, 46, 0.99));
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 25px var(--neon-cyan-glow);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
  animation: toastSlideIn 0.25s var(--transition-bounce) forwards;
}

.batch-count-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--neon-cyan);
}

.custom-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--neon-cyan);
  cursor: pointer;
  border-radius: 4px;
  margin: 0;
  vertical-align: middle;
}

/* =============================================================================
   ADMIN MOBILE RESPONSIVE SUITE & OFF-CANVAS DRAWER
   ============================================================================= */
.admin-mobile-toggle {
  display: none;
}

.admin-sidebar-backdrop {
  display: none;
}

@media (max-width: 992px) {
  .admin-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: auto;
    width: 100%;
    overflow-x: hidden;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -290px;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
  }

  .admin-sidebar.open {
    left: 0 !important;
  }

  .admin-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 15, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .admin-sidebar-backdrop.active {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .admin-mobile-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 1.25rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
  }

  .admin-topbar {
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
  }

  .admin-topbar .topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .admin-topbar .social-icon-btn {
    display: none !important;
  }

  .admin-main {
    padding: 1rem 0.85rem;
    width: 100%;
    overflow-x: hidden;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 0.85rem !important;
  }

  .stat-card {
    padding: 1.15rem 1rem !important;
    text-align: center;
    align-items: center;
  }

  .stat-icon {
    margin: 0 auto 0.5rem !important;
  }

  /* Table Responsive Scrolling on Mobile */
  .table-container,
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 1rem;
    border-radius: var(--radius-lg);
  }

  .glass-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 580px;
  }

  /* Dual Grid in Overview Tab */
  .admin-tab > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Control Bars on Mobile */
  .table-toolbar,
  .batch-action-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
    padding: 0.85rem 1rem !important;
  }

  .table-search-input {
    max-width: 100% !important;
    width: 100% !important;
  }
}

@media (max-width: 540px) {
  .admin-topbar .page-title {
    font-size: 1.15rem;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.65rem !important;
  }
  .stat-card {
    padding: 0.85rem 0.65rem !important;
  }
  .stat-card-val {
    font-size: 1.45rem !important;
  }
  .stat-card-info h4 {
    font-size: 0.75rem !important;
  }
}

