/* ==========================================================================
   SAAS-STYLE ADMIN PANEL CONTROL STYLESHEET
   Project: Dynamic CMS Portfolio SaaS Redesign
   Aesthetic: Premium Developer SaaS Console (Vercel & Supabase inspired)
   ========================================================================== */

/* Administrative Layout Settings */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --topbar-height: 70px;
  --transition-speed: 0.3s;
}

/* Scrollbar Customization for modern administrative scroll areas */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Global Reset overrides for layout grid consistency */
body {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
}

/* Master Layout Framework */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  padding: 24px 16px;
  overflow-y: auto;
}

.admin-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-primary);
  transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 10;
}

/* Collapsed Sidebar overrides */
body.sidebar-collapsed .admin-sidebar {
  width: var(--sidebar-collapsed-width);
  padding: 24px 10px;
}

body.sidebar-collapsed .admin-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* Brand Header Block */
.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 28px;
  padding-left: 8px;
  white-space: nowrap;
  overflow: hidden;
}

.admin-brand i {
  font-size: 1.3rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.sidebar-collapsed .admin-brand span {
  display: none;
}

/* Collapsible Sidebar Toggle Button in top bar */
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

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

/* Grouped Navigation Subtitles */
.admin-menu-group {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  margin-top: 24px;
  margin-bottom: 8px;
  padding-left: 8px;
  transition: all 0.2s;
}

body.sidebar-collapsed .admin-menu-group {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

/* Menu Navigation Elements */
.admin-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-menu-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
}

.admin-menu-item a i {
  width: 20px;
  font-size: 1.05rem;
  text-align: center;
  color: var(--text-muted);
  transition: color 0.2s;
}

/* Hover and Active highlights */
.admin-menu-item a:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.admin-menu-item a:hover i {
  color: var(--text-primary);
}

.admin-menu-item.active a {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.admin-menu-item.active a i {
  color: var(--accent);
}

/* Sidebar collapsed tooltips and styles */
body.sidebar-collapsed .admin-menu-item a {
  justify-content: center;
  padding: 12px 0;
}

body.sidebar-collapsed .admin-menu-item a span {
  display: none;
}

/* Responsive Top Bar Header */
.admin-topbar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-light);
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

/* Breadcrumb Styling */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover {
  color: var(--text-primary);
}

.breadcrumbs-separator {
  color: var(--border-light);
}

.breadcrumbs-current {
  color: var(--text-primary);
  font-weight: 700;
}

/* Header Utilities */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-btn {
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.topbar-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Content Container Body */
.admin-body {
  padding: 40px 48px;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Visual SaaS Cards */
.admin-saas-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.02), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
  margin-bottom: 28px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

body.dark .admin-saas-card {
  background: var(--bg-secondary);
}

.admin-saas-card:hover {
  border-color: rgba(var(--accent-rgb), 0.3);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Stats Widgets Row Styling */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
  transition: transform 0.2s;
}

body.dark .metric-card {
  background: var(--bg-secondary);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.metric-info h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin: 0 0 6px 0;
}

.metric-info h3 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* Dynamic CSS Charts Layout */
.chart-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chart-bar-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  width: 80px;
}

.chart-bar-wrapper {
  flex: 1;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

body.dark .chart-bar-wrapper {
  background: var(--bg-tertiary);
}

.chart-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 99px;
  width: 0;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-bar-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  width: 60px;
  text-align: right;
}

/* Premium Form Elements & focus states */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.saas-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.saas-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}

body.dark .saas-input {
  background-color: var(--bg-primary);
}

.saas-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.saas-input:disabled {
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Buttons System */
.saas-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  outline: none;
}

.saas-btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 1px 2px 0 rgba(var(--accent-rgb), 0.1);
}

.saas-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(var(--accent-rgb), 0.2);
}

.saas-btn-secondary {
  background: var(--bg-secondary);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.saas-btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.saas-btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.saas-btn-danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* Styled Table System */
.saas-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-primary);
  margin-top: 16px;
}

body.dark .saas-table-container {
  background: var(--bg-secondary);
}

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

.saas-table th, .saas-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}

.saas-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.dark .saas-table th {
  background: var(--bg-tertiary);
}

.saas-table td {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.saas-table tr:last-child td {
  border-bottom: none;
}

.saas-table tr:hover {
  background: rgba(0,0,0,0.01);
}
body.dark .saas-table tr:hover {
  background: rgba(255,255,255,0.01);
}

/* Beautiful Empty state widgets */
.saas-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 40px;
  background: rgba(0,0,0,0.01);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  margin: 20px 0;
}

.saas-empty-icon {
  font-size: 2.8rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  opacity: 0.7;
}

.saas-empty-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 6px 0;
}

.saas-empty-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 20px 0;
  max-width: 320px;
  line-height: 1.5;
}

/* Tabs Navigation for settings lists */
.saas-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 28px;
  overflow-x: auto;
}

.saas-tab {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.saas-tab:hover {
  color: var(--text-primary);
}

.saas-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.saas-tab-content {
  display: none;
}

.saas-tab-content.active {
  display: block;
}

/* Search bar utilities row */
.table-utilities {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search-box-wrapper {
  position: relative;
  min-width: 240px;
}

.search-box-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-box-wrapper input {
  padding-left: 36px;
}

/* Styled pagination indicators */
.saas-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  gap: 6px;
}

/* Touch friendly mobile layout drawers */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 0px;
  }
  
  .admin-sidebar {
    transform: translateX(-100%);
    width: 260px !important;
  }
  
  .admin-sidebar.active {
    transform: translateX(0);
  }
  
  .admin-content {
    margin-left: 0 !important;
  }
  
  .admin-topbar {
    padding: 0 20px;
  }
  
  .admin-body {
    padding: 24px 20px;
  }
}

/* Custom Admin Switch Toggle */
.admin-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.admin-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.admin-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-light);
  border: 1px solid var(--border-light);
  transition: 0.25s ease;
  border-radius: 34px;
}
.admin-switch-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: 0.25s ease;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.admin-switch input:checked + .admin-switch-slider {
  background-color: var(--accent);
  border-color: var(--accent);
}
.admin-switch input:checked + .admin-switch-slider:before {
  transform: translateX(22px);
}
