/* ==============================================================================
   External Dev - Web Management Dashboard (Dark Luxury Blue Edition)
   Matching the aesthetic of Customer Script Portal (Cinematic Esports AAA)
   Follows strict FiveM UI guidelines: Outfit & Kanit typography, no blur, #0890ea/#47b4fd
   ============================================================================== */

:root {
  --bg-main: rgba(15, 15, 15, 0.96);
  --bg-deep: #0b0c0e;
  --bg-card: rgba(22, 24, 28, 0.95);
  --bg-card-hover: rgba(26, 30, 36, 0.98);
  --bg-input: rgba(12, 13, 16, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(8, 144, 234, 0.5);
  --primary: #0890ea;
  --primary-hover: #0779c4;
  --accent: #47b4fd;
  --accent-glow: rgba(71, 180, 253, 0.25);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --font-content: 'Kanit', sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-card: 18px;
  --radius-pill: 8px;
  --radius-sm: 8px;
}

/* Reset & Setup */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

*::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

/* Remove number input spinners (stepper arrows) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

body {
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(8, 144, 234, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(71, 180, 253, 0.06) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-content);
  height: 100vh;
  overflow: hidden;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

/* Ambient Glows & Grid (Matching Customer Portal) */
.ambient-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
}

.ambient-glow.top-left {
  top: -150px;
  left: -150px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.ambient-glow.bottom-right {
  bottom: -150px;
  right: -150px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
}

.grid-overlay {
  position: fixed;
  inset: 0;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  pointer-events: none;
  z-index: 0;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 24px;
  max-width: 1680px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Animations */
.fade-in {
  animation: fadeInAnim 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInAnim {
  0% { opacity: 0; transform: scale(0.96) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ==============================================================================
   1. FLOATING HEADER (DARK LUXURY)
   ============================================================================== */
.floating-header {
  background: rgba(18, 20, 24, 0.95);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: default;
  user-select: none;
}

.brand-section.is-authenticated {
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.brand-section.is-authenticated:hover {
  opacity: 0.85;
}

.brand-logo-ring {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(8, 144, 234, 0.2), rgba(71, 180, 253, 0.05));
  border: 1px solid rgba(8, 144, 234, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  color: #ffffff;
  display: block;
  line-height: 1.1;
}

.brand-accent {
  color: var(--primary);
  text-shadow: 0 0 12px rgba(8, 144, 234, 0.5);
}

.brand-subtitle {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  display: block;
}

.btn-portal-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 0 16px;
  height: 38px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-portal-shortcut i {
  color: var(--accent);
  font-size: 0.88rem;
  transition: color 0.2s ease;
}

.btn-portal-shortcut:hover {
  background: rgba(8, 144, 234, 0.08);
  border-color: rgba(8, 144, 234, 0.35);
  color: #ffffff;
}

.btn-portal-shortcut:hover i {
  color: #ffffff;
}

.btn-add-script {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #0890ea 0%, #0284c7 100%);
  border: 1px solid rgba(71, 180, 253, 0.4);
  color: #ffffff;
  padding: 0 18px;
  height: 38px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-add-script:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: rgba(71, 180, 253, 0.6);
  color: #ffffff;
}

.btn-header-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 0 14px;
  height: 38px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-header-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ffffff;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 38px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.status-text {
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--success);
}

/* ==============================================================================
   2. MAIN STAGE & VIEWS
   ============================================================================== */
.main-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
}

.loader-container .spinner-border {
  color: var(--primary);
  width: 2.8rem;
  height: 2.8rem;
}

.spinner-border-sm {
  width: 1rem !important;
  height: 1rem !important;
  border-width: 2px !important;
  display: inline-block;
  vertical-align: -0.125em;
}

.loading-text {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ==============================================================================
   3. LOGIN VIEW
   ============================================================================== */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo-wrap {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(8, 144, 234, 0.2) 0%, rgba(71, 180, 253, 0.05) 100%);
  border: 1px solid rgba(8, 144, 234, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.login-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.login-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.6rem;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.form-group-modern {
  text-align: left;
  margin-bottom: 16px;
}

.form-label-modern {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-modern {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-content);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-modern:focus {
  outline: none;
  background: rgba(18, 20, 25, 0.95);
}

.login-card button[type="submit"] {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  width: 100%;
}

.btn-primary-glow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  background: linear-gradient(135deg, #0890ea 0%, #0284c7 100%);
  color: #ffffff !important;
  border: 1px solid rgba(71, 180, 253, 0.4);
  padding: 0 20px;
  height: 38px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary-glow:hover:not(:disabled) {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: rgba(71, 180, 253, 0.6);
  color: #ffffff !important;
}

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

.login-error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 14px;
  line-height: 1.4;
}

/* ==============================================================================
   4. HOME VIEW (WORKSPACE SELECTION)
   ============================================================================== */
.home-view {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 20px 0;
}

.home-head {
  text-align: center;
  margin-bottom: 36px;
}

.home-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 2.2rem;
  color: #ffffff;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.home-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 30px 24px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.home-card:hover {
  background: var(--bg-card-hover);
}

.home-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-card-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(8, 144, 234, 0.2) 0%, rgba(71, 180, 253, 0.05) 100%);
  border: 1px solid rgba(8, 144, 234, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1.6rem;
  margin-bottom: 18px;
}

.home-card--ip .home-card-icon-wrap {
  color: #38bdf8;
}

.home-card-label {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  color: #ffffff;
  margin-bottom: 6px;
}

.home-card-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ==============================================================================
   5. CATEGORY VIEW (SCRIPTS IN CATEGORY)
   ============================================================================== */
.category-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.btn-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0 14px;
  height: 38px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 18px;
  transition: all 0.2s ease;
}

.btn-back:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-back-inline {
  width: 38px;
  height: 38px;
  padding: 0;
  margin-bottom: 0;
}

.category-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
  overflow-y: auto;
}

.category-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 18px 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-item:hover {
  background: var(--bg-card-hover);
}

.category-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(8, 144, 234, 0.12);
  border: 1px solid rgba(8, 144, 234, 0.25);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.category-item span {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
}

.badge-refresh-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(8, 144, 234, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.category-empty {
  color: var(--text-dim);
  font-size: 0.95rem;
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
}

/* ==============================================================================
   6. MONACO SCRIPT EDITOR VIEW
   ============================================================================== */
.content-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  position: relative;
  z-index: 100;
}

.script-title-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-script-title {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  outline: none;
  padding: 2px 8px 2px 0;
  transition: border-color 0.2s ease;
}

.input-script-title:focus {
  border-bottom-color: var(--primary);
}

.script-title-icon {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-left: 6px;
}

.env-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.select-category-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0 12px;
  height: 36px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  outline: none;
}

.input-version-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--accent);
  padding: 0 12px;
  height: 36px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  width: 90px;
  text-align: center;
  outline: none;
}

.input-version-pill:focus {
  outline: none;
}

.script-toggle {
  font-size: 0.82rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-muted);
}

.btn-danger-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--danger);
  padding: 0 16px;
  height: 38px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger-confirm:hover {
  background: var(--danger);
  color: #fff;
}

/* Monaco Layout */
.script-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.editor-pane {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane-header {
  background: rgba(12, 13, 16, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pane-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pane-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.monaco-container {
  flex: 1;
  min-height: 0;
}

/* ==============================================================================
   7. IP WORKSPACE (LICENSES TABLE)
   ============================================================================== */
.content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-headline {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.4rem;
  color: #fff;
  margin: 0;
}

.search-capsule {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-capsule i {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-size: 0.85rem;
  pointer-events: none;
  transition: color 0.2s ease;
}

.search-capsule .search-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  height: 38px;
  padding: 0 14px 0 36px;
  color: #fff;
  font-family: var(--font-content);
  font-size: 0.85rem;
  outline: none;
  min-width: 250px;
  transition: all 0.2s ease;
}

.search-capsule .search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: rgba(18, 20, 24, 0.98);
}

.search-capsule:focus-within i {
  color: var(--accent);
}

.btn-refresh-manual {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.btn-refresh-manual:hover {
  color: #fff;
  background: rgba(8, 144, 234, 0.08);
  border-color: rgba(8, 144, 234, 0.35);
}

.table-responsive-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

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

.glass-table th {
  background: rgba(12, 13, 16, 0.85);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.glass-table td {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.9rem;
  color: var(--text-main);
  vertical-align: middle;
}

.glass-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.btn-glass-action {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-glass-action.btn-edit:hover {
  background: rgba(8, 144, 234, 0.15);
  color: var(--accent);
}

.btn-glass-action.btn-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* ==============================================================================
   8. MODALS & FORMS (DARK LUXURY)
   ============================================================================== */
.modal-dark {
  background: rgba(22, 24, 28, 0.98);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  color: var(--text-main);
}

.modal-header {
  border-bottom: 1px solid var(--border-subtle);
  padding: 18px 24px;
}

.modal-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: #ffffff;
}

.btn-close-custom {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.btn-close-custom:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 16px 24px;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px;
}

/* ==============================================================================
   Alert Modal (Modern Esports Dialog)
   ============================================================================== */
.alert-modal-dialog {
  max-width: 380px;
  margin: 1.75rem auto;
}

.alert-modal-content {
  background: rgba(18, 21, 26, 0.98) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
  padding: 28px 24px 24px 24px !important;
  text-align: center;
  position: relative;
}

.alert-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  color: var(--text-dim);
  font-size: 0.95rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.alert-close-btn:hover {
  color: #fff;
}

.alert-icon-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  margin: 0 auto 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  transition: all 0.2s ease;
}

.alert-icon-ring.success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.alert-icon-ring.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.alert-icon-ring.warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.alert-icon-ring.info {
  background: rgba(8, 144, 234, 0.12);
  border: 1px solid rgba(8, 144, 234, 0.3);
  color: #38bdf8;
}

.alert-modal-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.alert-modal-message {
  font-family: var(--font-content);
  font-size: 0.88rem;
  color: #cbd5e1;
  margin-bottom: 22px;
  line-height: 1.5;
  word-break: break-word;
}

.alert-modal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-top: none !important;
  padding: 0 !important;
}

.alert-modal-btn {
  min-width: 130px;
  height: 38px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0 16px;
  height: 38px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.permanent-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

/* ==============================================================================
   Category Defaults Info Widget (Add Script Modal)
   ============================================================================== */
.category-preset-wrapper {
  background: rgba(12, 14, 18, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
}

.preset-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.preset-header-icon {
  color: var(--accent);
  font-size: 0.95rem;
}

.preset-section-title {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.preset-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.preset-item-card {
  background: rgba(22, 25, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-item-card:hover {
  border-color: rgba(8, 144, 234, 0.35);
  background: rgba(26, 30, 38, 0.95);
}

.preset-item-card.active {
  border-color: rgba(8, 144, 234, 0.6);
  background: rgba(8, 144, 234, 0.1);
}

.preset-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preset-badge {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.preset-badge.badge-sell {
  background: rgba(8, 144, 234, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(8, 144, 234, 0.3);
}

.preset-badge.badge-free {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.preset-badge.badge-style {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.preset-badge.badge-open {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.preset-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--font-content);
}

.preset-item-rules {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rule-chip {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.2px;
}

.rule-chip.on {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.rule-chip.off {
  background: rgba(255, 255, 255, 0.03);
  color: #64748b;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.preset-notice-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 144, 234, 0.06);
  border: 1px solid rgba(8, 144, 234, 0.2);
  border-radius: 6px;
  padding: 8px 11px;
}

.notice-icon {
  color: var(--accent);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.notice-text {
  font-size: 0.76rem;
  color: #cbd5e1;
  font-family: var(--font-content);
  line-height: 1.35;
}

.code-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  background: rgba(8, 144, 234, 0.15);
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(8, 144, 234, 0.25);
}

/* ==============================================================================
   9. CUSTOM DROPDOWN UI (DARK LUXURY SELECT)
   ============================================================================== */
.custom-select-wrapper {
  position: relative;
  width: 100%;
  user-select: none;
}

.custom-select-wrapper.open {
  z-index: 1000;
}

.custom-select-trigger {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #ffffff;
  font-family: var(--font-content);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.2s ease;
}

.custom-select-trigger:hover {
  background: rgba(18, 20, 25, 0.95);
}

.custom-select-trigger .custom-select-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-trigger .custom-select-text i {
  color: var(--accent);
  font-size: 0.82rem;
  margin-right: 9px;
}

.custom-select-arrow {
  color: var(--text-dim);
  font-size: 0.85rem;
  transition: transform 0.2s ease;
  margin-left: 10px;
}

.custom-select-wrapper.open .custom-select-arrow {
  transform: rotate(180deg);
  color: var(--accent);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(20, 22, 26, 0.98);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 6px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 1050;
  display: none;
}

.custom-select-wrapper.open .custom-select-menu {
  display: block;
}

.custom-select-option {
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-main);
  font-family: var(--font-content);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease, color 0.15s ease;
  margin-bottom: 2px;
}

.custom-select-option:last-child {
  margin-bottom: 0;
}

.custom-select-option:hover {
  background: rgba(8, 144, 234, 0.15);
  color: var(--accent);
}

.custom-select-option.selected {
  background: rgba(8, 144, 234, 0.2);
  color: #ffffff;
  font-weight: 600;
}

.custom-select-option .option-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-family: var(--font-heading);
}

/* Custom select pill in toolbar */
.custom-select-pill {
  width: auto;
  min-width: 120px;
  position: relative;
}

.custom-select-pill.open {
  z-index: 1000;
}

.custom-select-pill .custom-select-trigger {
  padding: 5px 12px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
}

.custom-select-pill .custom-select-menu {
  min-width: 140px;
  left: 0;
  right: auto;
}

/* Custom scrollbar for dropdown menu */
.custom-select-menu::-webkit-scrollbar {
  width: 5px;
}

.custom-select-menu::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* License editor: restrained, searchable picker for large script libraries */
.editor-modal-content {
  overflow: visible;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.015);
}

.editor-modal-content .modal-header {
  padding: 20px 24px 17px;
}

.editor-modal-content .modal-title::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 10px 2px 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(8, 144, 234, 0.85);
}

.editor-modal-content .modal-body {
  padding: 22px 24px 20px;
}

.editor-modal-content .modal-footer {
  justify-content: flex-end !important;
  padding: 15px 24px 18px;
}

.editor-modal-content .btn-primary-glow {
  min-width: 134px;
}

.license-script-field {
  position: relative;
}

.form-help-text {
  display: block;
  margin-top: 7px;
  color: var(--text-dim);
  font-size: 0.74rem;
}

.license-script-picker .custom-select-menu {
  padding: 10px;
  max-height: none;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.script-picker-search {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  height: 40px;
  background: rgba(7, 9, 12, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  color: var(--text-dim);
}

.script-picker-search:focus-within {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

.script-picker-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font: 500 0.86rem var(--font-content);
}

.script-picker-search input::placeholder { color: var(--text-dim); }
.script-picker-search kbd {
  color: var(--text-dim);
  font: 0.67rem var(--font-heading);
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
}

.script-picker-filters { display: flex; gap: 5px; padding: 10px 1px 8px; overflow-x: auto; }
.script-picker-filter {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-muted);
  font: 600 0.69rem var(--font-heading);
  cursor: pointer;
  transition: 0.16s ease;
}
.script-picker-filter:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
.script-picker-filter.active { color: #fff; background: rgba(8, 144, 234, 0.2); border-color: rgba(8, 144, 234, 0.35); }
.script-picker-meta { display: flex; justify-content: space-between; padding: 0 4px 7px; color: var(--text-dim); font: 0.68rem var(--font-heading); }
.script-picker-options { max-height: 188px; overflow-y: auto; padding-right: 2px; }
.script-picker-options::-webkit-scrollbar { width: 4px; }
.script-picker-options::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }
.script-picker-options .custom-select-option { padding: 9px 10px; }
.script-picker-options .custom-select-option > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-option-icon { color: var(--text-dim); font-size: 0.75rem; margin-right: 9px; }
.script-picker-empty { padding: 20px 10px 12px; color: var(--text-dim); text-align: center; font-size: 0.82rem; }

@media (max-width: 575.98px) {
  .editor-modal-content .modal-body { padding: 18px; }
  .editor-modal-content .modal-header, .editor-modal-content .modal-footer { padding-left: 18px; padding-right: 18px; }
  .script-picker-options { max-height: 160px; }
}
