/* super-ui.css - Bản nâng cấp tối thượng từ CTO & PhongBan */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-dark: #0f172a;
  --bg-dark-glass: rgba(15, 23, 42, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #ec4899;
  --success: #10b981;
  --sidebar-width: 260px;
  --sidebar-collapsed: 90px;
  --bg-card: #1e293b;
  --bg-modal: rgba(15, 23, 42, 0.95);
  --input-bg: rgba(0, 0, 0, 0.3);
  --input-border: rgba(255, 255, 255, 0.2);
  --table-border: rgba(255, 255, 255, 0.05);
  --table-hover: rgba(99, 102, 241, 0.05);
}

[data-color-scheme="light"] {
  --bg-dark: #ffffff;
  --bg-dark-glass: rgba(248, 250, 252, 0.85);
  --glass-border: rgba(0, 0, 0, 0.15);
  --text-main: #0f172a;
  --text-muted: #475569;
  --bg-card: #ffffff;
  --bg-modal: rgba(255, 255, 255, 0.95);
  --input-bg: rgba(0, 0, 0, 0.05);
  --input-border: rgba(0, 0, 0, 0.2);
  --table-border: rgba(0, 0, 0, 0.1);
  --table-hover: rgba(99, 102, 241, 0.08);
}

body {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  background: var(--bg-dark) !important;
  color: var(--text-main);
  overflow-x: hidden;
  transition: background-color 0.5s ease;
  /* cursor: none; Magic Cursor takes over */
}

/* Magic Cursor */
#magic-cursor-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s;
}

#magic-cursor-outline {
  position: fixed;
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, border-color 0.2s;
  box-sizing: border-box;
}

.hover-effect:hover ~ #magic-cursor-dot,
a:hover ~ #magic-cursor-dot,
button:hover ~ #magic-cursor-dot {
  width: 12px;
  height: 12px;
  background: var(--accent);
}

.hover-effect:hover ~ #magic-cursor-outline,
a:hover ~ #magic-cursor-outline,
button:hover ~ #magic-cursor-outline {
  width: 60px;
  height: 60px;
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

/* Glassmorphism & Layout */
.super-glass {
  background: var(--bg-dark-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 var(--input-bg);
}

.admin-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar Ma thuật */
.super-sidebar {
  width: var(--sidebar-width);
  transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid var(--glass-border);
  overflow-x: hidden;
}

.super-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo {
  padding: 24px;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  overflow: hidden;
}

.super-sidebar.collapsed .sidebar-logo {
  opacity: 0;
}

.super-nav {
  flex: 1;
  padding: 20px 0;
  overflow-y: auto;
  overflow-x: hidden !important;
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
.super-nav::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.3s ease;
  margin: 4px 12px;
  border-radius: 12px;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  transform: translateX(5px);
}

.super-sidebar.collapsed .nav-link {
  padding: 12px;
  justify-content: center;
  margin: 4px;
}

.nav-icon {
  font-size: 1.2rem;
  margin-right: 16px;
  transition: transform 0.3s;
}

.super-sidebar.collapsed .nav-icon {
  margin-right: 0;
  font-size: 1.5rem;
}

.nav-link:hover .nav-icon {
  transform: scale(1.2) rotate(5deg);
}

.super-sidebar.collapsed .nav-text {
  display: none;
}

/* Header & Split Screen */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.super-header {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--glass-border);
  z-index: 10;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 20px;
}

.neo-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.3s;
}

.neo-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Split content */
.split-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 20px;
  gap: 20px;
}

.module-container {
  flex: 1;
  overflow-y: auto;
  border-radius: 16px;
  padding: 24px;
}

.details-panel {
  width: 350px;
  border-radius: 16px;
  padding: 24px;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: none;
}

.details-panel.active {
  display: block;
  transform: translateX(0);
}

/* 3D Parallax Tilt (Đã bỏ theo lệnh Sếp) */
/* .tilt-card {
  transform-style: preserve-3d;
  transform: perspective(1000px);
  transition: transform 0.1s;
} */

/* Skeleton Loading */
.skeleton-box {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shine 1.5s infinite;
  border-radius: 8px;
}

[data-color-scheme="light"] .skeleton-box {
  background: linear-gradient(90deg, rgba(0,0,0,0.05) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.05) 75%);
  background-size: 200% 100%;
}

@keyframes shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Command Palette */
#command-palette {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  width: 500px;
  border-radius: 16px;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2000;
}

#command-palette.active {
  transform: translateX(-50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

#cmd-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--primary);
  color: var(--text-main);
  font-size: 1.5rem;
  padding: 10px 0;
  outline: none;
  font-family: inherit;
}

/* Toast */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.super-toast {
  padding: 16px 24px;
  border-radius: 8px;
  border-left: 4px solid var(--success);
  transform: translateX(120%);
  animation: slideIn 0.3s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideIn {
  to { transform: translateX(0); }
}

/* AI Agent Widget */
#ai-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.3s, border-radius 0.3s;
}

#ai-widget:hover {
  transform: scale(1.1);
  border-radius: 16px;
}

#editPluginModalOverlay {
  display: flex !important;
}

/* Menu Dropdown Commands AI */
.cmd-item {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s;
  color: var(--text-muted);
}
.cmd-item:hover {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-main);
  transform: translateX(3px);
}
.ai-command-menu button:hover {
  color: #6366f1 !important;
}
/* Modern Stat Cards */
.modern-stat-card {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  background: var(--bg-card) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  border-radius: 16px !important;
  padding: 1.5rem !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2) !important;
  text-decoration: none;
  transition: all 0.3s ease !important;
  backdrop-filter: none !important;
}
.modern-stat-card:hover {
  background: var(--bg-card) !important;
  transform: translateY(-4px) !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important;
  border-color: var(--glass-border) !important;
}
.modern-stat-card .stat-content {
  display: flex;
  flex-direction: column;
}
.modern-stat-card .stat-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.modern-stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 8px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.modern-stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.modern-stat-card .stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.modern-stat-card:hover .stat-icon-wrapper {
  transform: scale(1.1);
}

/* Beautiful Modern Table Styles */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 1rem;
  background: transparent;
}
.data-table thead th {
  background: var(--bg-modal);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--table-border);
  backdrop-filter: blur(10px);
}
.data-table thead th:first-child {
  border-top-left-radius: 12px;
}
.data-table thead th:last-child {
  border-top-right-radius: 12px;
}
.data-table tbody tr {
  transition: all 0.2s ease;
  background: var(--input-bg);
}
.data-table tbody tr:hover {
  background: var(--table-hover);
  transform: translateY(-1px);
}
.data-table tbody td {
  padding: 1rem 1.25rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--table-border);
  font-size: 0.95rem;
  vertical-align: middle;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 12px;
}
.data-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 12px;
}

/* Pagination Adjustments */
.pagination {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.pagination button {
  background: var(--bg-card);
  border: 1px solid #334155;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.pagination button:hover:not(:disabled) {
  background: #3b82f6;
  border-color: #3b82f6;
  color: var(--text-main);
}
.pagination span {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

/* AI Chat Widget */
.ai-chat-window {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 350px;
  height: 450px;
  background: var(--bg-modal);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  overflow: hidden;
}
.ai-chat-window.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.ai-chat-header {
  padding: 1rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-chat-title {
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ai-chat-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  transition: color 0.2s;
}
.ai-chat-close:hover {
  color: var(--text-main);
}
.ai-chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.ai-msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  animation: modalOpen 0.2s ease-out;
}
.ai-msg.system {
  background: rgba(59, 130, 246, 0.15);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-msg.user {
  background: #3b82f6;
  color: var(--text-main);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-chat-input-area {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 0.5rem;
}
.ai-chat-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  color: var(--text-main);
  font-size: 0.9rem;
}
.ai-chat-input:focus {
  outline: none;
  border-color: #3b82f6;
}
.ai-chat-send {
  background: #3b82f6;
  color: var(--text-main);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
}
.ai-chat-send:hover {
  transform: scale(1.1);
}

/* Nút Danger (Đỏ) */
button.danger {
  background: linear-gradient(45deg, #ef4444, #be123c);
  color: var(--text-main);
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}
button.danger:hover {
  background: linear-gradient(45deg, #f87171, #e11d48);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.6);
  transform: translateY(-2px);
}

/* iOS Style Toggle Switch */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  margin: 0;
}
.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.ios-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--glass-border);
  transition: .3s;
  border-radius: 26px;
  border: 1px solid var(--input-border);
}
.ios-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-main);
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .ios-slider {
  background-color: #3b82f6; /* Xanh Apple thay cho màu xanh lá */
  border-color: #3b82f6;
}
input:focus + .ios-slider {
  box-shadow: 0 0 1px #3b82f6;
}
input:checked + .ios-slider:before {
  transform: translateX(22px);
}
/* Tùy chỉnh Scrollbar (Ẩn nhưng vẫn cuộn được mượt mà) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
/* Firefox scrollbar ẩn nhẹ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

/* CSS Cho Dropdown chọn Group (Select) */
.quick-group-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
  border: 1px solid #334155 !important;
  padding: 6px 32px 6px 12px !important;
  border-radius: 8px !important;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px top 50% !important;
  background-size: 10px auto !important;
}
.quick-group-select:hover {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.quick-group-select:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}

/* ------------------------------------- */
/* CTO COST CALCULATOR PLUGIN (NEW) */
/* ------------------------------------- */

.cost-calc-glass {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px;
  min-width: 280px;
  font-family: 'Outfit', sans-serif;
  transition: all 0.3s;
}

.cost-calc-glass:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.cost-calc-formula {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.8;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.inline-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 0 4px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.inline-input-wrapper:hover,
.inline-input-wrapper:focus-within {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.calc-inline-input {
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: bold;
  font-family: inherit;
  font-size: 0.95rem;
  width: 50px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.calc-inline-input::-webkit-outer-spin-button,
.calc-inline-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.undo-btn {
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  transition: color 0.2s;
}

.undo-btn:hover {
  color: var(--primary);
}

.cost-calc-footer {
  display: flex;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}

.demo-txt {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.demo-total-text {
  font-size: 1.1rem;
  transition: color 0.3s;
}

.mini-progress-chart {
  margin-top: 10px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  display: flex;
  overflow: hidden;
}

.mini-progress-chart .bar-t2v {
  background: linear-gradient(90deg, #ec4899, #f43f5e);
  transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mini-progress-chart .bar-up {
  background: linear-gradient(90deg, #3b82f6, #0ea5e9);
  transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tooltip-smart-help {
  position: relative;
  cursor: help;
}

.tooltip-smart-help::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-modal);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  border: 1px solid var(--primary);
  z-index: 10;
}

.tooltip-smart-help:hover::after {
  opacity: 1;
}
