/* ==============================================================================
   VIDYAPANT ACADEMY — UI COMPONENTS CSS
   ============================================================================== */

/* Layout Shell */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-700), var(--primary-900));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.15rem;
}

.brand-text h1 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-900);
  line-height: 1.1;
}

.brand-text p {
  font-size: 0.68rem;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-600);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration: none;
}

.nav-item:hover {
  background-color: var(--slate-100);
  color: var(--primary-800);
}

.nav-item.active {
  background-color: var(--primary-50);
  color: var(--primary-800);
  font-weight: 600;
}

.nav-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-badge-soon {
  margin-left: auto;
  font-size: 0.65rem;
  background-color: var(--slate-200);
  color: var(--slate-600);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

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

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s ease;
}

/* Header */
.top-header {
  height: var(--header-height);
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

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

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--slate-700);
  cursor: pointer;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background-color: var(--primary-100);
  color: var(--primary-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  overflow: hidden;
  border: 1px solid var(--primary-200);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-body {
  padding: 1.5rem;
  flex: 1;
}

/* Overview Stat Cards Grid */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background-color: var(--primary-50);
  color: var(--primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.stat-card-subtitle {
  font-size: 0.8125rem;
  color: var(--slate-500);
}

/* Modern Card Box */
.card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--slate-800);
}

.card-body {
  padding: 1.25rem;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  background-color: var(--slate-50);
  color: var(--slate-600);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: var(--slate-50);
}

/* Search and Filters Bar */
.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-input-wrapper {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-input-wrapper input {
  padding-left: 2.25rem;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
}

/* Tabs */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.tab-btn {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  color: var(--primary-700);
  border-bottom-color: var(--primary-700);
  font-weight: 600;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--slate-400);
}
.modal-close:hover {
  color: var(--slate-700);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: var(--slate-50);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* OTP 6-box input */
.otp-container {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.otp-digit {
  width: 48px;
  height: 56px;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--slate-300);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.otp-digit:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Bottom Navigation Bar (Mobile) */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  z-index: 95;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.68rem;
  color: var(--slate-500);
  text-decoration: none;
  gap: 0.2rem;
  padding: 0.35rem 0.5rem;
}

.bottom-bar-item.active {
  color: var(--primary-700);
  font-weight: 600;
}

.bottom-bar-icon {
  font-size: 1.25rem;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--slate-300);
  margin-bottom: 0.75rem;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 0.25rem;
}

.empty-state-text {
  font-size: 0.875rem;
  color: var(--slate-500);
  margin-bottom: 1.25rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 280px;
  max-width: 400px;
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-success { border-left: 4px solid var(--success-primary); }
.toast-error { border-left: 4px solid var(--danger-primary); }
.toast-info { border-left: 4px solid var(--info-primary); }

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 1024px) {
  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .main-content {
    margin-left: 0;
    padding-bottom: calc(var(--bottom-bar-height) + 1rem);
  }

  .menu-toggle-btn {
    display: block;
  }

  .mobile-bottom-bar {
    display: flex;
  }

  .stat-cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 0.875rem;
  }

  .stat-card-value {
    font-size: 1.35rem;
  }

  /* Table to Card Transformation on Mobile */
  .table-responsive {
    overflow-x: visible;
  }

  .mobile-card-table thead {
    display: none;
  }

  .mobile-card-table, 
  .mobile-card-table tbody, 
  .mobile-card-table tr, 
  .mobile-card-table td {
    display: block;
    width: 100%;
  }

  .mobile-card-table tr {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.875rem;
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
  }

  .mobile-card-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--slate-100);
    font-size: 0.8125rem;
  }

  .mobile-card-table td:last-child {
    border-bottom: none;
  }

  .mobile-card-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--slate-500);
    text-transform: uppercase;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .stat-cards-grid {
    grid-template-columns: 1fr;
  }
  .top-header {
    padding: 0 1rem;
  }
  .page-body {
    padding: 1rem 0.75rem;
  }
}
