/* ================================================
   Admin Portal Styles
   Shared styles for all admin pages
   ================================================ */

/* Smooth page transitions */
@view-transition {
  navigation: auto;
}
html {
  background: #f5f3ef;
}

/* Fade in main content to avoid pop-in on navigation */
.admin-main {
  animation: adminFadeIn 0.15s ease-out;
}
@keyframes adminFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Admin Layout with Sidebar */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 70px);
}

/* Sidebar Navigation */
.admin-sidebar {
  width: 260px;
  background: var(--dark-blue);
  color: var(--white);
  flex-shrink: 0;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}

.admin-sidebar-header {
  padding: 25px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: var(--white);
}

.admin-sidebar-header span {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

/* Org Switcher (super-admin only) */
.org-switcher {
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.org-switcher select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.org-switcher select:hover,
.org-switcher select:focus {
  border-color: var(--brand-primary);
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.org-switcher select option {
  background: var(--dark-blue);
  color: var(--white);
}

/* Back to Site Link */
.back-to-site {
  display: block;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.back-to-site:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.back-to-site span {
  margin-right: 8px;
}

/* Sidebar Navigation Links */
.admin-nav {
  padding: 15px 0;
}

.admin-nav-section {
  padding: 0 15px;
  margin-bottom: 20px;
}

.admin-nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  padding: 10px 10px 8px;
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.admin-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  text-decoration: none;
}

.admin-nav-link.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0 8px 8px 0;
  padding-left: 12px;
}

.admin-nav-link .nav-icon {
  width: 22px;
  text-align: center;
  font-size: 1.1rem;
}

.admin-nav-link .nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}

/* Tier-locked nav items */
.admin-nav-link.tier-locked {
  opacity: 0.5;
}
.admin-nav-link.tier-locked:hover {
  opacity: 0.7;
}
.admin-nav-link .nav-lock {
  margin-left: auto;
  opacity: 0.6;
}

/* Sidebar Footer */
.admin-sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

.admin-sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.admin-sidebar-footer .user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  color: var(--white);
}

.admin-sidebar-footer .user-details {
  flex: 1;
  min-width: 0;
}

.admin-sidebar-footer .user-name {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-sidebar-footer .user-role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: capitalize;
}

.admin-sidebar-footer .btn-logout {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.admin-sidebar-footer .btn-logout:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Main Content Area */
.admin-main {
  flex: 1;
  padding: 30px;
  background: var(--light-bg);
  overflow-x: hidden;
}

/* Mobile Menu Toggle */
.admin-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: var(--dark-blue);
  color: var(--white);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.admin-mobile-toggle:hover {
  background: var(--darker-blue);
}

/* Mobile Overlay */
.admin-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
}

/* ================================================
   Admin Header (Simplified for sidebar layout)
   ================================================ */
.admin-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.admin-page-header h1 {
  color: var(--dark-blue);
  margin: 0;
  font-size: 1.8rem;
}

.admin-page-actions {
  display: flex;
  gap: 10px;
}

/* ================================================
   Breadcrumb
   ================================================ */
.admin-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.admin-breadcrumb a {
  color: var(--text-gray);
  text-decoration: none;
}

.admin-breadcrumb a:hover {
  color: var(--brand-primary);
}

.admin-breadcrumb span {
  color: var(--text-light);
}

.admin-breadcrumb .current {
  color: var(--dark-blue);
  font-weight: 500;
}

/* ================================================
   Stats Cards (Dashboard)
   ================================================ */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.admin-stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 25px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 15px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

a.admin-stat-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

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

.admin-stat-card .stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.admin-stat-card .stat-icon.green {
  background: rgba(14, 168, 94, 0.15);
}

.admin-stat-card .stat-icon.blue {
  background: rgba(35, 50, 82, 0.1);
}

.admin-stat-card .stat-icon.orange {
  background: rgba(253, 126, 20, 0.15);
}

.admin-stat-card .stat-icon.purple {
  background: rgba(111, 66, 193, 0.15);
}

.admin-stat-card .stat-icon.teal {
  background: rgba(20, 184, 166, 0.15);
}

.admin-stat-card .stat-icon.amber {
  background: rgba(245, 158, 11, 0.15);
}

.admin-stat-card .stat-content {
  flex: 1;
}

.admin-stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark-blue);
  line-height: 1.2;
}

.admin-stat-card .stat-label {
  color: var(--text-gray);
  font-size: 0.9rem;
  margin-top: 5px;
}

.admin-stat-card .stat-change {
  font-size: 0.8rem;
  margin-top: 8px;
}

.admin-stat-card .stat-change.positive {
  color: var(--brand-primary);
}

.admin-stat-card .stat-change.negative {
  color: #dc3545;
}

/* ================================================
   Content Cards
   ================================================ */
.admin-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 25px;
}

.admin-card-header {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-card-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--dark-blue);
}

.admin-card-body {
  padding: 25px;
}

.admin-card-footer {
  padding: 15px 25px;
  border-top: 1px solid var(--border-light);
  background: var(--lighter-bg);
  border-radius: 0 0 12px 12px;
}

/* ================================================
   Quick Actions (Dashboard)
   ================================================ */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background: var(--lighter-bg);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.quick-action-btn:hover {
  border-color: var(--brand-primary);
  background: rgba(14, 168, 94, 0.05);
  text-decoration: none;
}

.quick-action-btn .action-icon {
  font-size: 1.8rem;
}

.quick-action-btn .action-text h4 {
  margin: 0 0 3px 0;
  color: var(--dark-blue);
  font-size: 1rem;
}

.quick-action-btn .action-text p {
  margin: 0;
  color: var(--text-gray);
  font-size: 0.85rem;
}

/* ================================================
   Stats Row Labels (Dashboard)
   ================================================ */
.stats-row-label {
  color: var(--text-gray);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px 0;
  font-weight: 600;
}

.stats-row-label + .admin-stats-grid {
  margin-bottom: 20px;
}

/* ================================================
   Charts Section (Dashboard)
   ================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
  margin-bottom: 30px;
}

.charts-grid .chart-full-width {
  grid-column: 1 / -1;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-container-small {
  height: 260px;
  max-width: 300px;
  margin: 0 auto;
}

/* ================================================
   Recent Activity (Dashboard)
   ================================================ */
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item .activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.activity-item .activity-icon.signup {
  background: rgba(14, 168, 94, 0.15);
}

.activity-item .activity-icon.cancel {
  background: rgba(220, 53, 69, 0.15);
}

.activity-item .activity-icon.client {
  background: rgba(35, 50, 82, 0.1);
}

.activity-item .activity-icon.volunteer {
  background: rgba(111, 66, 193, 0.15);
}

.activity-item .activity-content {
  flex: 1;
}

.activity-item .activity-text {
  color: var(--text-dark);
  font-size: 0.95rem;
  margin-bottom: 3px;
}

.activity-item .activity-text strong {
  color: var(--dark-blue);
}

.activity-item .activity-time {
  color: var(--text-light);
  font-size: 0.8rem;
}

/* ================================================
   Responsive Design
   ================================================ */
@media (max-width: 1024px) {
  .admin-sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100vh;
    z-index: 1200;
    transition: left 0.3s ease;
  }

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

  .admin-sidebar-overlay.show {
    display: block;
  }

  .admin-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .admin-main {
    padding: 20px;
  }

  .admin-layout {
    min-height: calc(100vh - 60px);
  }
}

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

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

  .chart-container {
    height: 250px;
  }

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

  .admin-page-actions {
    width: 100%;
  }

  .admin-page-actions .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .admin-stats-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-main {
    padding: 15px;
  }
}

/* ================================================
   Access Denied (in-layout)
   ================================================ */
.access-denied-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 40px 20px;
}

.access-denied-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 48px 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.access-denied-card .denied-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(220, 53, 69, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #dc3545;
}

.access-denied-card h2 {
  color: var(--dark-blue);
  margin: 0 0 12px;
  font-size: 1.5rem;
}

.access-denied-card .denied-message {
  color: var(--text-gray);
  margin: 0 0 20px;
  line-height: 1.6;
}

.access-denied-card .denied-role {
  display: inline-block;
  background: var(--lighter-bg);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-gray);
  margin-bottom: 24px;
}

.access-denied-card .denied-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
