:root {
  --bg: #070b11;
  --panel: #101827;
  --panel-soft: #162236;
  --line: #243247;
  --ink: #eaf1ff;
  --muted: #8ea3c2;
  --primary: #6f60ff;
  --accent: #22baff;
  --ok: #2ecb79;
  --warn: #f4a938;
  --bad: #ff5f72;
  --glass-bg: rgba(16, 24, 39, 0.7);
  --glass-border: rgba(111, 96, 255, 0.2);
}

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

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

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

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(111, 96, 255, 0.4), 0 0 40px rgba(111, 96, 255, 0.2); }
  50% { box-shadow: 0 0 30px rgba(111, 96, 255, 0.6), 0 0 60px rgba(111, 96, 255, 0.3); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

body {
  margin: 0;
  font-family: "Segoe UI", "Inter", -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(800px 400px at 0% -10%, rgba(111, 96, 255, .22), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(34, 186, 255, .16), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

a {
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

a:hover {
  color: var(--accent);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  animation: fadeIn 0.5s ease-out;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 28, 44, .96), rgba(11, 17, 28, .96));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 16px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  box-shadow:
    inset -1px 0 0 rgba(111, 96, 255, 0.1),
    4px 0 20px rgba(0, 0, 0, 0.3);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  animation: fadeIn 0.6s ease-out;
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  font-weight: 700;
  box-shadow:
    0 4px 15px rgba(111, 96, 255, 0.4),
    0 0 20px rgba(111, 96, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: glow 3s ease-in-out infinite;
}

.brand-badge:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow:
    0 6px 25px rgba(111, 96, 255, 0.6),
    0 0 30px rgba(111, 96, 255, 0.5);
}

.brand-title {
  font-weight: 700;
  background: linear-gradient(135deg, var(--ink), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  transition: color 0.3s ease;
}

.sidebar-title {
  margin: 16px 8px 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
}
.sidebar-nav {
  display: grid;
  gap: 6px;
}
.nav-link {
  display: block;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  color: #c9d8f1;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(111, 96, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.nav-link:hover::before {
  left: 100%;
}

.nav-link:hover {
  background: rgba(22, 37, 58, 0.8);
  border-color: #273d5d;
  transform: translateX(5px);
  box-shadow:
    0 4px 15px rgba(111, 96, 255, 0.2),
    inset 0 0 20px rgba(111, 96, 255, 0.05);
}

.nav-link.active {
  background: linear-gradient(130deg, rgba(111,96,255,.23), rgba(34,186,255,.17));
  border-color: #41598a;
  color: #fff;
  font-weight: 700;
  box-shadow:
    0 4px 20px rgba(111, 96, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.content {
  padding: 16px;
  display: grid;
  gap: 14px;
  animation: fadeIn 0.6s ease-out 0.1s backwards;
}

.page-head {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 14px;
  padding: 14px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.page-head::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(111, 96, 255, 0.1), transparent);
  animation: shimmer 3s infinite;
}

.page-head:hover {
  border-color: rgba(111, 96, 255, 0.4);
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 30px rgba(111, 96, 255, 0.2);
}

.page-head h1 {
  margin: 0;
  font-size: 34px;
  background: linear-gradient(135deg, var(--ink), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.panel {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 14px;
  padding: 14px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  animation: fadeIn 0.6s ease-out backwards;
}

.panel:hover {
  border-color: rgba(111, 96, 255, 0.3);
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.panel h2 {
  background: linear-gradient(135deg, var(--ink), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }

label {
  display: block;
  margin-bottom: 5px;
  color: #a5bad8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}
input, textarea, select, button, a.btn {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #2d4367;
  background: rgba(13, 22, 36, 0.6);
  backdrop-filter: blur(10px);
  color: #eff4ff;
  padding: 10px 11px;
  font-size: 14px;
  font-family: "Segoe UI", "Inter", sans-serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.45;
}

input:hover, textarea:hover, select:hover {
  border-color: rgba(78, 105, 161, 0.6);
  background: rgba(13, 22, 36, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(13, 22, 36, 0.9);
  box-shadow:
    0 0 0 3px rgba(111, 96, 255, .2),
    0 4px 20px rgba(111, 96, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

button, a.btn {
  border: 0;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button::before, a.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

button:hover::before, a.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-main {
  background: linear-gradient(140deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow:
    0 4px 15px rgba(111, 96, 255, 0.4),
    0 0 20px rgba(111, 96, 255, 0.2);
}

.btn-main:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 25px rgba(111, 96, 255, 0.6),
    0 0 30px rgba(111, 96, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-main:active {
  transform: translateY(0);
}

.btn-soft {
  background: rgba(19, 35, 58, 0.6);
  backdrop-filter: blur(10px);
  color: #d3e3fc;
  border: 1px solid #2d4367;
}

.btn-soft:hover {
  background: rgba(19, 35, 58, 0.9);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow:
    0 4px 15px rgba(111, 96, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

button:disabled, a.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.message {
  margin-top: 10px;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid #2d4367;
  background: rgba(17, 35, 61, 0.6);
  backdrop-filter: blur(10px);
  color: #bdd1ef;
  min-height: 42px;
  transition: all 0.3s ease;
  animation: fadeIn 0.4s ease-out;
}

.message:not(:empty) {
  border-color: rgba(111, 96, 255, 0.3);
  box-shadow: 0 4px 15px rgba(111, 96, 255, 0.2);
}

.cards {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.card {
  border: 1px solid rgba(43, 61, 90, 0.8);
  background: rgba(15, 24, 40, 0.6);
  backdrop-filter: blur(15px);
  border-radius: 12px;
  padding: 10px;
  min-height: 150px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
  transition: left 0.6s ease;
}

.card:hover::before {
  left: 100%;
}

.card:hover {
  border-color: rgba(111, 96, 255, 0.5);
  background: rgba(15, 24, 40, 0.8);
  transform: translateY(-5px);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(111, 96, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card.active {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px rgba(111,96,255,.18),
    0 10px 40px rgba(111, 96, 255, 0.4);
  background: rgba(15, 24, 40, 0.9);
}

.card.disabled {
  opacity: .55;
  filter: grayscale(0.5);
  pointer-events: none;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  font-size: 10px;
  padding: 3px 7px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 7px;
  transition: all 0.3s ease;
  animation: fadeIn 0.5s ease-out;
}

.pill.on {
  background: rgba(46,203,121,.18);
  color: #79ebb2;
  border: 1px solid rgba(46,203,121,.35);
  box-shadow: 0 0 15px rgba(46,203,121,.3);
}

.pill.on:hover {
  background: rgba(46,203,121,.28);
  box-shadow: 0 0 25px rgba(46,203,121,.5);
  transform: scale(1.05);
}

.pill.off {
  background: rgba(244,169,56,.15);
  color: #ffd9a1;
  border: 1px solid rgba(244,169,56,.35);
}
.muted { color: var(--muted); font-size: 13px; }
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  border: 1px solid #31466a;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  color: #bfd1ef;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.tag:hover {
  border-color: var(--primary);
  background: rgba(111, 96, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(111, 96, 255, 0.2);
}

.upload-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.upload-chip {
  border-radius: 999px;
  border: 1px solid #2d4367;
  background: rgba(16, 32, 58, 0.6);
  backdrop-filter: blur(10px);
  padding: 4px 9px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  animation: fadeIn 0.4s ease-out;
}

.upload-chip:hover {
  border-color: var(--primary);
  background: rgba(16, 32, 58, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(111, 96, 255, 0.2);
}

.upload-chip button {
  width: auto;
  border: 0;
  background: transparent;
  color: #ff8c97;
  padding: 0;
  transition: all 0.2s ease;
  cursor: pointer;
}

.upload-chip button:hover {
  color: var(--bad);
  transform: scale(1.2);
}

.table-wrap {
  border: 1px solid rgba(43, 61, 90, 0.8);
  border-radius: 12px;
  overflow: auto;
  background: rgba(13, 22, 36, 0.4);
  backdrop-filter: blur(15px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  border-bottom: 1px solid rgba(32, 48, 75, 0.6);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  transition: background 0.3s ease;
}

tr:hover td {
  background: rgba(111, 96, 255, 0.05);
}

th {
  color: #90a8cb;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: rgba(15, 27, 47, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.state-success {
  color: var(--ok);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(46, 203, 121, 0.5);
  animation: pulse 2s ease-in-out infinite;
}

.state-fail, .state-error {
  color: var(--bad);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 95, 114, 0.5);
}

.state-waiting, .state-queued {
  color: var(--warn);
  font-weight: 700;
  animation: pulse 2s ease-in-out infinite;
}

.result-list {
  display: grid;
  gap: 7px;
  max-width: 260px;
}

.result-card {
  border: 1px solid rgba(45, 67, 103, 0.8);
  border-radius: 8px;
  padding: 5px;
  background: rgba(15, 27, 47, 0.6);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  animation: fadeIn 0.5s ease-out;
}

.result-card:hover {
  border-color: var(--primary);
  background: rgba(15, 27, 47, 0.9);
  transform: translateY(-3px);
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(111, 96, 255, 0.3);
}

.result-card img {
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  transition: transform 0.3s ease;
}

.result-card:hover img {
  transform: scale(1.05);
}

.result-actions {
  display: flex;
  gap: 6px;
  margin-top: 5px;
}

.result-actions button, .result-actions a {
  flex: 1;
  text-decoration: none;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: 7px;
  padding: 5px 7px;
  background: rgba(17, 35, 61, 0.6);
  backdrop-filter: blur(5px);
  color: #bdd1ef;
  border: 1px solid #2d4367;
  transition: all 0.3s ease;
  cursor: pointer;
}

.result-actions button:hover, .result-actions a:hover {
  background: rgba(17, 35, 61, 0.9);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(111, 96, 255, 0.3);
}

.live {
  border: 1px solid rgba(45, 67, 103, 0.8);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(15, 24, 40, 0.6);
  backdrop-filter: blur(15px);
  max-width: 480px;
  transition: all 0.3s ease;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.live:hover {
  border-color: var(--primary);
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(111, 96, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.live img {
  width: 100%;
  max-height: 250px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.live:hover img {
  transform: scale(1.02);
}

.preview-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  z-index: 80;
  padding: 14px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.preview-modal.open {
  display: flex;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  animation: fadeIn 0.4s ease-out;
}

.preview-box {
  max-width: min(95vw, 1200px);
  max-height: 92vh;
  border: 1px solid rgba(69, 96, 137, 0.6);
  background: rgba(5, 9, 18, 0.9);
  backdrop-filter: blur(30px);
  border-radius: 10px;
  padding: 10px;
  box-shadow:
    0 20px 80px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(111, 96, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.5s ease-out 0.1s backwards;
  transform-origin: center;
}

.preview-box img {
  max-width: 100%;
  max-height: calc(92vh - 20px);
  display: block;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Loading States */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(32, 48, 75, 0.4) 0%,
    rgba(45, 67, 103, 0.6) 50%,
    rgba(32, 48, 75, 0.4) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

.skeleton-text {
  height: 14px;
  margin: 6px 0;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 12px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(111, 96, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

/* Utility Classes */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

.glow-effect {
  box-shadow:
    0 0 20px rgba(111, 96, 255, 0.4),
    0 0 40px rgba(111, 96, 255, 0.2);
  animation: glow 3s ease-in-out infinite;
}

.float-effect {
  animation: float 3s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  
  .page-head h1 {
    font-size: 28px;
  }
}

@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .actions button, .actions a.btn { flex: 1 1 100%; }
  
  .page-head h1 {
    font-size: 24px;
  }
  
  .brand-badge {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
  
  .sidebar-title {
    font-size: 10px;
  }
  
  .nav-link {
    font-size: 13px;
    padding: 8px 10px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Visible */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
