/* ==========================================================================
   PORTAL DASHBOARDS & SCHEDULE CSS
   Admin, Instructor, Customer Workspaces & Live Customizer
   ========================================================================== */

/* Portal App Container */
.portal-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-main);
}

/* Portal Sidebar */
.portal-sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  align-self: flex-start;
  z-index: 90;
}

.portal-sidebar::-webkit-scrollbar {
  width: 4px;
}

.portal-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.portal-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.portal-user-badge {
  padding: 1rem;
  background-color: var(--bg-alt);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar-sm {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.user-info-text {
  overflow: hidden;
}

.user-info-name {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-info-role {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brand-primary);
}

.portal-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.portal-menu-item a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.portal-menu-item a:hover {
  background-color: var(--bg-alt);
  color: var(--text-primary);
}

.portal-menu-item.active a {
  background-color: var(--brand-primary-light);
  color: var(--brand-secondary);
  font-weight: 600;
}

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

/* Portal Main Content Area */
.portal-main {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 2.25rem;
  max-width: 100%;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.portal-title-area h1 {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  color: var(--text-primary);
  line-height: 1.2;
}

.portal-title-area p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

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

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 4px;
  background: var(--card-color, var(--brand-primary));
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-card-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-weight: 500;
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--card-bg, var(--brand-primary-light));
  color: var(--card-color, var(--brand-primary));
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Filter & Search Bar */
.filter-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-alt);
  padding: 0.35rem;
  border-radius: var(--radius-md);
}

.filter-tab-btn {
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Data Tables & Responsive Overflow Wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0;
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: var(--bg-alt);
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--brand-primary);
}

.data-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 2rem;
}

.data-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.data-card-header h2, .data-card-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.data-table th {
  padding: 0.875rem 1.25rem;
  background-color: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.925rem;
  vertical-align: middle;
}

.data-table td.actions-cell,
.data-table td:last-child {
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background-color: var(--bg-alt);
}

/* Action Button Group */
.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Attendance Toggle Controls */
.attendance-toggle-group {
  display: inline-flex;
  background: var(--bg-alt);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 2px;
}

.att-btn {
  border: none;
  background: transparent;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-muted);
}

.att-btn.active-attended {
  background: var(--color-success);
  color: #ffffff;
}

.att-btn.active-absent {
  background: var(--color-danger);
  color: #ffffff;
}

.att-btn.active-pending {
  background: var(--color-warning);
  color: #ffffff;
}

/* Live Studio Branding Customizer */
.branding-customizer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.theme-preset-card {
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-surface);
}

.theme-preset-card:hover {
  border-color: var(--border-medium);
}

.theme-preset-card.active {
  border-color: var(--brand-primary);
  background-color: var(--brand-primary-light);
}

.color-swatches-preview {
  display: flex;
  gap: 4px;
}

.swatch-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.live-preview-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: sticky;
  top: 100px;
}

/* Capacity Indicator */
.capacity-progress-wrap {
  width: 100%;
  max-width: 120px;
}

.capacity-progress-bar {
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}

.capacity-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
}

.capacity-fill.high {
  background: var(--color-danger);
}

/* Quick Demo Login Switcher Bar */
.demo-switcher-bar {
  background: #1e293b;
  color: #cbd5e1;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.demo-btn-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.demo-role-btn {
  background: #334155;
  color: #ffffff;
  border: 1px solid #475569;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.demo-role-btn:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

@media (max-width: 1200px) {
  .portal-main {
    padding: 1.75rem;
  }
}

@media (max-width: 900px) {
  .portal-layout {
    flex-direction: column;
  }
  .portal-sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .portal-main {
    padding: 1.5rem 1.25rem;
    width: 100%;
  }
  .portal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .portal-header > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
  }
  .branding-customizer-grid {
    grid-template-columns: 1fr;
  }
  .live-preview-box {
    position: static;
  }
}

@media (max-width: 600px) {
  .portal-main {
    padding: 1rem 0.75rem;
  }
  .portal-title-area h1 {
    font-size: 1.45rem;
  }
  .filter-bar {
    padding: 1rem;
  }
  .filter-group {
    min-width: 100%;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  .stat-card {
    padding: 1rem;
  }
  .stat-card-value {
    font-size: 1.5rem;
  }
  .data-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
  }
  .data-table th, .data-table td {
    padding: 0.75rem 0.85rem;
    font-size: 0.85rem;
  }
}

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

/* Rounded Red Modal Close Button */
.modal-close,
.modal-close-btn {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  border: none !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.15rem !important;
  font-weight: bold !important;
  line-height: 1 !important;
  cursor: pointer !important;
  padding: 0 !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35) !important;
  text-decoration: none !important;
  outline: none !important;
}

.modal-close:hover,
.modal-close-btn:hover {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  cursor: pointer !important;
  transform: scale(1.12) !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.5) !important;
}

.modal-close:active,
.modal-close-btn:active {
  transform: scale(0.95) !important;
}

.modal-close svg,
.modal-close-btn svg {
  stroke: #ffffff !important;
  fill: none !important;
  width: 16px !important;
  height: 16px !important;
}
