:root {
  --sidebar-width: 260px;
  --bg: #f8fafc;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --accent: #7c3aed;
  --accent-light: #ddd6fe;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --radius: 20px;
  --border-width: 3px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Noto Sans TC', sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

#console-app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  padding: 0 24px;
  margin-bottom: 40px;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.brand-name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.brand-tag {
  font-size: 11px;
  opacity: 0.6;
  text-transform: uppercase;
}

.nav-menu {
  flex: 1;
  padding: 0 12px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  padding: 16px 16px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
  color: #94a3b8;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: white;
}

.nav-item.active {
  background-color: var(--accent);
  color: white;
}

.nav-icon {
  font-size: 20px;
}

.nav-text {
  font-weight: 600;
  font-size: 14px;
}

.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.05);
  padding: 10px;
  border-radius: var(--radius);
}

.avatar {
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
}

.user-role {
  font-size: 11px;
  opacity: 0.6;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-header {
  height: 70px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
}

.content-header h1 {
  font-size: 20px;
  font-weight: 800;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

#content-body {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* Common Components */
.card {
  background: var(--card-bg);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0,0,0,0.05);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  padding: 24px;
  background: white;
  border-radius: var(--radius);
  border: var(--border-width) solid var(--border);
}

.stat-val {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: #f1f5f9;
}

.btn-icon:active {
  transform: scale(0.9);
}

/* Generator UI Specifics */
.gen-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.control-group {
  margin-bottom: 20px;
}

.control-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

select, input {
  width: 100%;
  padding: 12px 16px;
  border: var(--border-width) solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
}

select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

select:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.primary-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

.primary-btn:active {
  transform: scale(0.98);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.primary-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.secondary-btn {
  background: white;
  color: var(--text-muted);
  border: 2px solid var(--border);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.2s, color 0.2s;
}

.secondary-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
  background: #f8fafc;
}

.secondary-btn:active {
  transform: scale(0.98);
}

.secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn:focus-visible {
  outline: 2px solid var(--text-muted);
  outline-offset: 3px;
}

.danger-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.2s, opacity 0.2s;
}

.danger-btn:hover {
  background-color: #dc2626;
}

.danger-btn:active {
  transform: scale(0.98);
}

.danger-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.danger-btn:focus-visible {
  outline: 2px solid #ef4444;
  outline-offset: 3px;
}

/* Table Enhancements */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-row-hover:hover {
  background-color: #f8fafc !important;
}

.data-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 12px;
  border-bottom: 2px solid #e2e8f0;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  padding: 32px;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 500px;
  width: 90%;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.9; }
}

@keyframes popUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes skeletonShimmer {
  0% { opacity: 1; }
  50% { opacity: 0.45; }
  100% { opacity: 1; }
}

.skeleton-pulse {
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}
