:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.1);
  --danger: #ef4444;
  --success: #10b981;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
}

/* --- LOGIN PAGE --- */
.login-page {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at top left, #1e1b4b 0%, #0f172a 100%);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.logo-area {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.logo-area h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.logo-area p {
  color: var(--text-muted);
  font-size: 14px;
}

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

.form-group label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: white;
  font-size: 15px;
  transition: all 0.3s ease;
  outline: none;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

button {
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  border: none;
  border-radius: 12px;
}

.modal-buttons:has(.btn-cancel),
.modal-buttons:has(.btn-save) {
  justify-content: center;
  min-height: 35px;
}
  
.btn-cancel { flex: 1; width: 100%; align-items: center; max-width: 150px; background: rgba(255, 255, 255, 0.05); color: white; }
.btn-save { flex: 1; width: 100%; align-items: center; max-width: 150px; }

button.primary, #login-btn, .btn-save {
  padding: 14px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

button.primary:hover, #login-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.error-msg {
  color: var(--danger);
  font-size: 14px;
  margin-top: 16px;
  text-align: center;
}

/* --- DASHBOARD --- */
.dashboard-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.main-header {
  height: 70px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar {
  width: 280px;
  background: rgba(15, 23, 42, 0.8);
  border-right: 1px solid var(--border);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
  padding: 0 12px;
}

.nav-links {
  list-style: none;
  flex: 1;
}

.nav-links li {
  margin-bottom: 8px;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.3s;
}

.nav-links li.active a, .nav-links a:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.sidebar-footer {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.sidebar-footer p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

#logout-btn {
  width: 100%;
  padding: 10px;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

#logout-btn:hover {
  background: var(--danger);
  color: white;
}

.content {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.header-logo .logo-icon {
  font-size: 32px;
  line-height: 1;
  display: flex;
  align-items: center;
  transform: translateY(2px);
}

.header-breadcrumb {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.user-menu-container {
  position: relative;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 14px;
  transition: all 0.3s;
}

.user-profile:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.user-role {
  font-size: 12px;
  color: var(--text-muted);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.chevron-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 220px;
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  padding: 8px;
  animation: slideDownFade 0.3s ease;
  z-index: 1000;
}

@keyframes slideDownFade {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dropdown-links {
  list-style: none;
}

.dropdown-links a, .logout-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  border-radius: 10px;
  transition: all 0.2s;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}

.dropdown-links a:hover, .logout-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary);
}

.logout-link:hover {
  color: var(--danger);
}

.dropdown-links .divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.content-body {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.actions {
  display: flex;
  gap: 12px;
}

.actions button {
  padding: 10px 20px;
}

button.secondary {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 16px 24px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 18px 24px;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-admin { background: rgba(99, 102, 241, 0.2); color: var(--primary); }
.badge-user { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }

.btn-action {
  padding: 6px 12px;
  font-size: 13px;
  margin-right: 4px;
}

.btn-delete { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn-delete:hover { background: var(--danger); color: white; }

.hidden { display: none !important; }

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

.modal-content {
  width: 100%;
  max-width: 600px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  animation: popIn 0.2s ease-out;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
}

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

.modal-header-with-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-shrink: 0;
}

.modal-header-with-actions h3 {
  margin-bottom: 0 !important;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px; /* Space for scrollbar */
}

.modal-body.no-padding {
  padding: 0;
}

.modal-split-layout {
  display: flex;
  gap: 0;
  height: 100%;
  min-height: 400px;
}

.modal-col-left {
  flex: 1;
  padding: 24px;
  border-right: 1px solid var(--border);
}

.modal-col-right {
  flex: 1.2;
  padding: 24px;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.modal-col-right h4 {
  margin-bottom: 8px;
  font-size: 16px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-group input { width: auto; }
.checkbox-group label { margin-bottom: 0; }

.radio-group {
  display: flex;
  gap: 20px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 0;
  color: var(--text-main);
}

.radio-group input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

#tool-file-input {
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.section-card {
  padding: 32px;
  max-width: 600px;
}

.section-desc {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

.no-margin {
  margin-top: 10px !important;
}

/* --- STATUS BADGE (IN-TABLE) --- */
.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
}

.status-badge.status-active {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.status-badge.status-inactive {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: none;
}

/* --- BUTTONS & ACTIONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1;
}

.btn i, .btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: white;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-icon.delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.btn-icon i, .btn-icon svg {
  width: 14px;
  height: 14px;
}

/* --- FILTER BAR --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  position: relative;
  z-index: 10;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-input {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  min-width: 200px;
}

.filter-input:focus {
  border-color: var(--primary);
  outline: none;
  background: rgba(15, 23, 42, 0.6);
}

.filter-select {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* --- DROPDOWN FILTER --- */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.filter-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  padding: 20px;
  z-index: 1000;
  animation: slideDownFade 0.2s ease-out;
  display: block;
}

.filter-dropdown.hidden {
  display: none !important;
}

.filter-dropdown h4 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text-main);
}

.action-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.data-table td:last-child {
  white-space: nowrap;
  width: 1%;
}

/* Updated older button class aliases for backward compatibility */
button.primary, .button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: white;
  border: none;
}

button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
}

.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding: 16px 8px 0;
  border-top: 1px solid var(--border);
}

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

.pagination {
  display: flex;
  list-style: none;
  gap: 8px;
}

.pagination-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

.pagination-link:hover:not(.disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.pagination-link.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.pagination-link.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  animation: slideInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
  color: white;
}

.toast-success {
  background: rgba(16, 185, 129, 0.9);
  border-left: 4px solid #059669;
}

.toast-error {
  background: rgba(239, 68, 68, 0.9);
  border-left: 4px solid #b91c1c;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-message .close-btn {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
  line-height: 1;
}

.toast-message .close-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

.hide-toast {
  animation: slideOutRight 0.5s ease forwards !important;
}

/* --- ACE EDITOR --- */
.ace-editor-container {
  width: 100%;
  height: 100%;
  min-height: 750px; /* Tăng từ 650px */
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 16px; /* Tăng từ 15px */
}

.editor-hidden-textarea {
  display: none !important;
}

/* --- LARGE MODALS --- */
.modal-xxl {
  max-width: 1700px !important; /* Tăng từ 1400px */
  width: 98vw;
}

.tool-form-grid {
  display: grid;
  grid-template-columns: 280px 1fr; /* Thu hẹp thêm cột trái */
  gap: 30px;
  height: 100%;
  align-items: start;
}

@media (max-width: 1024px) {
  .tool-form-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .ace-editor-container {
    height: 500px;
  }
}

.tool-metadata-side {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.tool-editor-side {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 750px;
}

.tool-editor-side .form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tool-editor-side label {
  margin-bottom: 10px;
}

.btn-guide {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
}

.btn-guide:hover {
  background: var(--primary);
  color: white;
}

.guide-content {
  max-height: 700px;
  overflow-y: auto;
  padding-right: 15px;
}

.guide-content h4 {
  margin: 20px 0 10px;
  color: var(--primary);
}

.guide-content p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 10px;
}

code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: #fca5a5;
}

.sample-code {
  background: #1e1e1e;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  font-size: 13px;
  overflow-x: auto;
}

/* Specific height for View Code modal to be extra large */
#view-code-modal .modal-content {
  min-height: 90vh;
}

#view-code-modal .ace-editor-container {
  min-height: 80vh;
}

/* --- PREMIUM UPLOAD ZONE --- */
.file-upload-zone {
  width: 100%;
  height: 100%;
  min-height: 650px;
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed var(--border);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.file-upload-zone:hover {
  background: rgba(99, 102, 241, 0.05);
  border-color: var(--primary);
  transform: scale(0.995);
}

.upload-content {
  text-align: center;
  pointer-events: none;
}

.upload-icon-wrapper {
  width: 80px;
  height: 80px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  transition: all 0.3s;
}

.file-upload-zone:hover .upload-icon-wrapper {
  transform: translateY(-5px);
  background: var(--primary);
  color: white;
}

.upload-icon {
  width: 40px;
  height: 40px;
  color: var(--primary);
  transition: all 0.3s;
}

.file-upload-zone:hover .upload-icon {
  color: white;
}

.file-upload-zone h4 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text-main);
}

.file-upload-zone p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.hidden-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-info-card {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid var(--primary);
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: popIn 0.3s ease-out;
}

.file-info-card span {
  font-weight: 600;
  color: var(--primary);
}

.animate-in {
  animation: slideUp 0.4s ease-out;
}

/* --- TABS NAVIGATION --- */
.tabs-container {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1.5rem;
  position: relative;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.75rem 0.5rem;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.tab-btn i {
  width: 18px;
  height: 18px;
}

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

.tab-btn.active {
  color: var(--primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
  box-shadow: 0 -2px 10px rgba(99, 102, 241, 0.4);
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- REFINED BADGES --- */
.status-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-trusted {
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-dynamic {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-override {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.section-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.badge-public {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-private {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* --- PREMIUM TOOLTIPS --- */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.95);
  color: white;
  font-size: 12px;
  border-radius: 8px;
  white-space: pre-wrap;
  width: max-content;
  max-width: 400px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  pointer-events: none;
  text-align: center;
}

[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* --- EMPTY STATES --- */
.empty-state {
  text-align: center;
  padding: 80px 20px !important;
}

.empty-state-icon {
  width: 54px;
  height: 54px;
  color: var(--border);
  margin-bottom: 16px;
  display: inline-block;
  opacity: 0.6;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0;
}

/* === SEARCHABLE SELECT COMPONENT === */
.ss-wrapper {
  position: relative;
  width: 100%;
}

.ss-display {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: white;
  font-size: 15px;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
  box-sizing: border-box;
  min-height: 44px;
}

.ss-display:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.ss-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-dropdown {
  position: fixed;
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  animation: popIn 0.15s ease-out;
}

.ss-search {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  border-bottom: 1px solid var(--border);
  color: white;
  font-size: 14px;
  outline: none;
  border-radius: 0;
}

.ss-search::placeholder {
  color: var(--text-muted);
}

.ss-options {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.ss-option {
  padding: 9px 14px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-main);
  transition: background 0.15s;
  word-break: break-word;
}

.ss-option:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
}

.ss-option.ss-selected {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
  font-weight: 600;
}

.ss-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.ss-options::-webkit-scrollbar {
  width: 6px;
}

.ss-options::-webkit-scrollbar-track {
  background: transparent;
}

.ss-options::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
/* --- TOOL FORM & EDITOR LAYOUT --- */
.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.editor-toolbar label {
  margin-bottom: 0 !important;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

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

.param-chips-container {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  margin-bottom: 8px;
  height: 38px;
  min-height: 38px;
  padding: 4px 6px;
  background: transparent;
  border: none;
  align-items: center;
}

.param-chips-container::-webkit-scrollbar {
  height: 3px;
}

.param-chips-container::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 3px;
}

.param-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(99, 102, 241, 0.2);
  font-family: var(--font-mono);
}

.param-chip:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.param-chip.inherited {
  background: rgba(148, 163, 184, 0.05);
  color: #94a3b8;
  border: 1px dashed rgba(148, 163, 184, 0.4);
}

.param-chip.inherited:hover {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: none;
}

.param-key-error {
  border-color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.05) !important;
  color: #ff8080 !important;
}

.param-error-msg {
  color: var(--danger);
  font-size: 11px;
  margin-top: 4px;
  font-weight: 500;
}

.ace-editor-container {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 15px;
}

.modal-lg {
  max-width: 900px !important;
}

.modal-xxl {
  max-width: 1600px !important;
  width: 95vw;
}

.tool-form-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  height: 100%;
  min-height: 700px;
}

.tool-metadata-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-editor-side {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.param-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr 80px;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  align-items: end;
}

/* Hide Number Arrows (Spin Buttons) */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}

/* Password Input Styling */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  width: 100%;
  padding-right: 40px !important; /* Chừa chỗ cho icon mắt */
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: all 0.2s;
  z-index: 5;
}

.password-toggle-btn:hover {
  color: var(--primary);
}

.password-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-slide-in 0.3s ease-out forwards;
  color: white;
}

.toast.warning {
  border-left: 4px solid var(--warning);
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.info {
  border-left: 4px solid var(--primary);
}

.toast-content {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.toast-close {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toast-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-slide-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}
