/* ============================================================
   ব্লুমিং ফ্লাওয়ার ইন্টারন্যাশনাল কলেজ
   Admin Dashboard Styles
   ============================================================ */

/* Premium Dashboard Specific Styles */
body {
  background-color: var(--color-surface-base);
  color: var(--color-text-primary);
}

.admin-wrapper {
  max-width: 1320px;
  margin: 20px auto 40px auto;
  padding: 0 20px;
}

/* Login Glassmorphism */
.login-container {
  max-width: 450px;
  margin: 100px auto;
  background: var(--color-surface-card);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: all 0.3s;
}

.login-header {
  background: linear-gradient(135deg, #1c69b5, #0077b6);
  color: #fff;
  padding: 30px;
  text-align: center;
}

.login-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.login-form {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Sticky Top Bar for Admin */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

/* Prevent login/dashboard UI flashing on load */
#login-container, #dashboard-grid {
  display: none;
}
.admin-logged-out #login-container {
  display: block;
}
.admin-logged-in #dashboard-grid {
  display: grid;
}
@media (max-width: 768px) {
  .admin-logged-in #dashboard-grid {
    display: block !important;
  }
}

/* Dashboard Layout */
.dashboard-grid {
  grid-template-columns: 260px 1fr;
  gap: 30px;
  margin-top: 0;
}

.db-sidebar {
  background: var(--color-surface-card);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 24px 16px;
  position: fixed;
  top: 90px;
  left: 20px;
  width: 260px;
  height: calc(100vh - 110px);
  overflow-y: auto;
  /* Hide scrollbar but keep scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  border: 1px solid var(--color-border-light);
  z-index: 100;
}

@media (min-width: 1320px) {
  .db-sidebar {
    left: calc((100vw - 1320px) / 2 + 20px);
  }
}

.db-sidebar::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.db-user-info {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

.db-menu-btn {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s;
  margin-bottom: 8px;
}

.db-menu-btn:hover,
.db-menu-btn.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.db-content {
  background: var(--color-surface-card);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
  padding: 30px;
  color: var(--color-text-primary);
  grid-column: 1 / -1;
  margin-left: 290px;
}

.db-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--color-border-light);
}

.db-title {
  font-size: 1.4rem;
  color: var(--color-primary);
  margin: 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Forms in Dashboard */
.db-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.db-form-full {
  grid-column: 1 / -1;
}

/* List grids inside Dashboard */
.manager-list {
  margin-top: 30px;
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
}

.manager-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  margin-bottom: 10px;
  transition: all 0.3s;
  color: var(--color-text-primary);
}

.manager-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--color-primary);
}

.manager-item__title {
  font-weight: bold;
  color: var(--color-text-primary);
}

.manager-item__meta {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.btn-delete {
  background: #e74c3c;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.3s;
}

.btn-delete:hover {
  background: #c0392b;
}

.btn-logout {
  background: #e74c3c;
  color: #fff !important;
  border: none;
  width: 100%;
  margin-top: 40px;
  justify-content: center;
  font-weight: bold;
}

.btn-logout:hover {
  background: #c0392b;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Dashboard Quick Action Buttons */
.db-action-btn {
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.3;
  text-align: center;
  border: 1px solid var(--color-border-light);
  background: var(--color-surface-raised);
  color: var(--color-primary);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  min-height: 80px;
}

.db-action-btn span:last-child {
  display: block;
  word-break: keep-all;
}

.db-action-btn:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* Stack the bottom overview grid on mobile */
@media (max-width: 768px) {
  .overview-bottom-grid {
    grid-template-columns: 1fr !important;
  }
}


/* Loader spinner styles */
.loader-spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* ============================================================
   MOBILE RESPONSIVENESS — HAMBURGER SIDEBAR APPROACH
   ============================================================ */

/* Hamburger toggle button — hidden on desktop */
.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  color: #fff;
  flex-direction: column;
  gap: 5px;
  margin-right: 8px;
  transition: background 0.2s;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.sidebar-toggle-btn span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s;
}

/* Overlay backdrop — for closing sidebar by tapping outside */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

/* ============================================================
   MOBILE LAYOUT — keep sidebar fixed on left, content scrollable
   ============================================================ */
@media (max-width: 768px) {
  .top-bar {
    position: relative !important;
  }

  /* Prevent horizontal overflow on mobile body */
  body, html {
    overflow-x: hidden;
    width: 100%;
  }

  /* Make top-bar container a grid for 2 rows */
  .top-bar .container {
    display: grid !important;
    grid-template-areas:
      "logo info"
      "toggle right";
    grid-template-columns: auto 1fr;
    gap: 12px 10px;
    align-items: start;
    width: 100%;
    flex-wrap: nowrap !important;
  }

  /* Break the top-bar__left wrapper so its children become direct grid items */
  .top-bar__left {
    display: contents !important;
  }

  /* Assign grid areas to children */
  .top-bar__logo {
    grid-area: logo;
    width: 44px !important;
    height: 44px !important;
    flex-shrink: 0;
    align-self: start;
  }

  .top-bar__info {
    grid-area: info;
    min-width: 0;
    overflow: visible;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start !important;
    text-align: left !important;
    align-self: start;
  }

  .top-bar__info a {
    display: block;
    min-width: 0;
    overflow: visible;
    text-align: left !important;
  }

  .top-bar__title {
    font-size: 1.05rem !important;
    white-space: normal !important; /* Allow wrapping */
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.35 !important;
    font-weight: 800;
    display: block;
    text-align: left !important;
  }

  .top-bar__subtitle {
    font-size: 0.72rem !important;
    white-space: normal !important; /* Allow wrapping */
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.3 !important;
    display: block;
    margin-top: 2px;
    text-align: left !important;
  }

  /* Hamburger button sits on bottom left */
  .sidebar-toggle-btn {
    grid-area: toggle;
    display: flex !important;
    justify-self: start;
    align-self: center;
  }

  .top-bar__right {
    grid-area: right;
    justify-self: end;
    margin-left: auto;
    align-self: center;
  }

  /* return home page button pill shaped inside the grid container */
  .top-bar__right .btn {
    width: auto !important;
    height: auto !important;
    padding: 8px 14px !important;
    border-radius: 30px !important;
    white-space: nowrap !important;
    font-size: 0.82rem !important;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    overflow: visible !important;
  }

  /* Compact admin wrapper */
  .admin-wrapper {
    margin: 10px auto;
    padding: 0 8px;
  }

  /* Login card adjustment */
  .login-container {
    margin: 40px auto;
    width: 92%;
    max-width: 420px;
  }

  /* Dashboard grid: full width, no sidebar column */
  .dashboard-grid {
    display: block !important;
    margin-top: 10px;
  }

  /* Sidebar: fixed overlay on the left */
  .db-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    overflow-y: auto;
    border-radius: 0 12px 12px 0;
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    padding: 24px 16px;
    transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--color-surface-card);
  }

  /* Sidebar open state */
  .db-sidebar.sidebar-open {
    left: 0;
  }

  /* Main content takes full width */
  .db-content {
    width: 100%;
    padding: 20px 15px;
    border-radius: 12px;
    margin-left: 0 !important;
    grid-column: auto !important;
  }

  /* Compact user info in sidebar */
  .db-user-info {
    margin-bottom: 15px;
    padding-bottom: 12px;
  }

  .db-user-info div {
    font-size: 2.2rem !important;
  }

  /* Logout button spacing */
  .btn-logout {
    margin-top: 20px;
  }

  /* Form grids — single column on tablet/mobile */
  .db-form-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
  }

  /* Collapse teacher list columns on tablet/mobile */
  #admin-teachers-list {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }

  /* List management cards stack on tablet/mobile */
  .manager-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 15px;
  }

  .manager-item>div {
    width: 100%;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .manager-item__meta {
    margin-bottom: 6px;
  }

  .manager-item div[style*="display: flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100%;
  }

  .manager-item div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .manager-item button,
  .manager-item .btn,
  .manager-item .btn-delete {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 10px !important;
    margin-left: 0 !important;
  }

  .manager-item div[style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  /* Reduce padding of overview bottom grid cards to prevent horizontal overflow */
  .overview-bottom-grid > div {
    padding: 16px !important;
    min-width: 0 !important;
  }

  /* Make Quick Actions grid items look clean on mobile */
  .db-action-btn {
    padding: 12px 6px !important;
    font-size: 0.78rem !important;
    min-height: 70px !important;
    gap: 4px !important;
  }

  /* Make sure recent activity feed items stretch correctly and never overflow */
  .feed-item {
    padding: 12px 10px !important;
    gap: 8px !important;
  }

  /* Make filter buttons responsive and stretch to fill rows on mobile */
  .db-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .db-header div[style*="display: flex"] {
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .db-header .filter-btn {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    flex-grow: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
  }
}

/* Very small screens */
@media (max-width: 420px) {
  .top-bar__subtitle {
    display: none;
  }

  .top-bar__title {
    font-size: 0.98rem !important;
  }

  .top-bar__logo {
    width: 38px !important;
    height: 38px !important;
  }

  .admin-wrapper {
    padding: 0 6px;
  }

  .db-content {
    padding: 14px 10px;
  }
}

/* Stats grid layout card columns on small screens */
@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
}

/* ============================================================
   DARK MODE OVERRIDES (OVERRIDING INLINE STYLES & GRADIENTS)
   ============================================================ */
[data-theme="dark"] {
  /* Override inline text colors */
  [style*="color: #333"],
  [style*="color:#333"],
  [style*="color: rgb(51, 51, 51)"] {
    color: var(--color-text-primary) !important;
  }

  [style*="color: #555"],
  [style*="color:#555"],
  [style*="color: #666"],
  [style*="color:#666"],
  [style*="color: #777"],
  [style*="color:#777"] {
    color: var(--color-text-secondary) !important;
  }

  /* Override inline backgrounds */
  [style*="background: #fff"],
  [style*="background:#fff"],
  [style*="background-color: #fff"],
  [style*="background-color:#fff"],
  [style*="background: #fdfdfd"],
  [style*="background:#fdfdfd"],
  [style*="background: rgb(255, 255, 255)"],
  div[style*="background: #fdfefe"],
  div[style*="background:#fdfefe"] {
    background: var(--color-surface-card) !important;
    background-color: var(--color-surface-card) !important;
  }

  /* Override inline borders */
  [style*="border-bottom: 2px solid #f4f7f6"],
  [style*="border-bottom:2px solid #f4f7f6"],
  [style*="border-bottom: 2px solid #eee"],
  [style*="border-bottom:2px solid #eee"] {
    border-bottom: 2px solid var(--color-border-light) !important;
  }

  [style*="border: 1px solid #eee"],
  [style*="border:1px solid #eee"],
  [style*="border: 1px solid #f0f0f0"],
  [style*="border:1px solid #f0f0f0"] {
    border: 1px solid var(--color-border-light) !important;
  }

  /* Dashboard overview stats cards styling in Dark Mode */
  .overview-card {
    border-radius: 12px !important;
    box-shadow: var(--shadow-md) !important;
  }

  /* Target specific overview cards via nth-child selectors and give them modern glowing mesh gradients in dark mode */
  /* Card 1: Notices (Blue) */
  .stats-grid > div:nth-child(1) {
    background: linear-gradient(135deg, rgba(79, 143, 247, 0.12), rgba(79, 143, 247, 0.02)) !important;
    border-color: rgba(79, 143, 247, 0.25) !important;
  }
  .stats-grid > div:nth-child(1):hover {
    border-color: rgba(79, 143, 247, 0.65) !important;
  }
  .stats-grid > div:nth-child(1) h4 { color: #93c5fd !important; }
  .stats-grid > div:nth-child(1) div { color: #3b82f6 !important; }

  /* Card 2: Teachers (Green) */
  .stats-grid > div:nth-child(2) {
    background: linear-gradient(135deg, rgba(47, 176, 92, 0.12), rgba(47, 176, 92, 0.02)) !important;
    border-color: rgba(47, 176, 92, 0.25) !important;
  }
  .stats-grid > div:nth-child(2):hover {
    border-color: rgba(47, 176, 92, 0.65) !important;
  }
  .stats-grid > div:nth-child(2) h4 { color: #a7f3d0 !important; }
  .stats-grid > div:nth-child(2) div { color: #2fb05c !important; }

  /* Card 3: Results (Purple) */
  .stats-grid > div:nth-child(3) {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(168, 85, 247, 0.02)) !important;
    border-color: rgba(168, 85, 247, 0.25) !important;
  }
  .stats-grid > div:nth-child(3):hover {
    border-color: rgba(168, 85, 247, 0.65) !important;
  }
  .stats-grid > div:nth-child(3) h4 { color: #e9d5ff !important; }
  .stats-grid > div:nth-child(3) div { color: #a855f7 !important; }

  /* Card 4: Gallery (Rose) */
  .stats-grid > div:nth-child(4) {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.12), rgba(244, 63, 94, 0.02)) !important;
    border-color: rgba(244, 63, 94, 0.25) !important;
  }
  .stats-grid > div:nth-child(4):hover {
    border-color: rgba(244, 63, 94, 0.65) !important;
  }
  .stats-grid > div:nth-child(4) h4 { color: #fecdd3 !important; }
  .stats-grid > div:nth-child(4) div { color: #f43f5e !important; }

  /* Card 5: Registrations (Amber) */
  .stats-grid > div:nth-child(5) {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.02)) !important;
    border-color: rgba(245, 158, 11, 0.25) !important;
  }
  .stats-grid > div:nth-child(5):hover {
    border-color: rgba(245, 158, 11, 0.65) !important;
  }
  .stats-grid > div:nth-child(5) h4 { color: #fde68a !important; }
  .stats-grid > div:nth-child(5) div { color: #f59e0b !important; }

  /* Card 6: Inbox (Teal) */
  .stats-grid > div:nth-child(6) {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(20, 184, 166, 0.02)) !important;
    border-color: rgba(20, 184, 166, 0.25) !important;
  }
  .stats-grid > div:nth-child(6):hover {
    border-color: rgba(20, 184, 166, 0.65) !important;
  }
  .stats-grid > div:nth-child(6) h4 { color: #99f6e4 !important; }
  .stats-grid > div:nth-child(6) div { color: #2084a6 !important; }

  /* Feed item detail colors */
  .feed-item {
    border-color: var(--color-border-light) !important;
  }
  .feed-item div[style*="color: #333"] {
    color: var(--color-text-primary) !important;
  }
  .feed-item div[style*="color: #666"] {
    color: var(--color-text-secondary) !important;
  }
}