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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  min-height: 100vh;
  color: #f3f4f6;
  position: relative;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* ============ ANIMATED BLOBS ============ */
.blob-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: blobFloat 20s ease-in-out infinite;
}

.blob-1 {
  width: 600px;
  height: 600px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  top: -250px;
  left: -150px;
  animation-delay: 0s;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  top: 40%;
  right: -200px;
  animation-delay: -5s;
  animation-duration: 25s;
}

.blob-3 {
  width: 450px;
  height: 450px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  bottom: -150px;
  left: 25%;
  animation-delay: -10s;
  animation-duration: 22s;
}

.blob-4 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  top: 20%;
  left: -150px;
  animation-delay: -15s;
  animation-duration: 28s;
}

@keyframes blobFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  25% {
    transform: translate(60px, -60px) scale(1.1) rotate(90deg);
  }
  50% {
    transform: translate(30px, 60px) scale(0.95) rotate(180deg);
  }
  75% {
    transform: translate(-40px, 30px) scale(1.05) rotate(270deg);
  }
}

/* ============ LOGIN SCREEN ============ */
.screen {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

#loginScreen {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: rgba(31, 41, 55, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 40px;
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.2);
  width: 100%;
  max-width: 400px;
  animation: fadeInUp 0.6s ease;
}

.login-box .logo-container {
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 40px rgba(168, 85, 247, 0.4);
  animation: pulse 2s infinite;
}

.login-box .logo-container img {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  object-fit: cover;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, #a855f7, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-box .subtitle {
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
  margin-bottom: 30px;
}

.login-box input {
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(75, 85, 99, 0.5);
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.6);
  color: #f3f4f6;
  font-size: 15px;
  transition: all 0.3s;
}

.login-box input:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
  background: rgba(17, 24, 39, 0.8);
}

.login-box button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 5px 20px rgba(168, 85, 247, 0.3);
}

.login-box button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(168, 85, 247, 0.5);
}

.error {
  color: #ef4444;
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
}

/* ============ DASHBOARD ============ */
#dashboard {
  min-height: 100vh;
  padding: 30px;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

#dashboard main {
  width: 100%;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 30px;
  animation: fadeInDown 0.5s ease;
}

.header .logo-container {
  width: 70px;
  height: 70px;
  margin: 0 auto 15px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 40px rgba(168, 85, 247, 0.4);
  animation: pulse 2s infinite;
}

.header .logo-container img {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  object-fit: cover;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #a855f7, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 5px;
}

.header .subtitle {
  color: #9ca3af;
  font-size: 14px;
}

.header-actions {
  position: absolute;
  top: 20px;
  right: 20px;
}

#logoutBtn {
  padding: 10px 20px;
  background: rgba(55, 65, 81, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(75, 85, 99, 0.5);
  border-radius: 10px;
  color: #f3f4f6;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

#logoutBtn:hover {
  background: rgba(75, 85, 99, 0.8);
  border-color: #a855f7;
}

/* ============ CARDS ============ */
.card {
  background: rgba(31, 41, 55, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid rgba(168, 85, 247, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  animation: fadeInUp 0.5s ease backwards;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }

.card:hover {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(168, 85, 247, 0.1);
  transform: translateY(-2px);
}

.card h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #a855f7;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h2 span {
  font-size: 20px;
}

/* ============ STATS ============ */
.stats-card {
  padding: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-box {
  background: rgba(17, 24, 39, 0.5);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  border: 1px solid rgba(75, 85, 99, 0.3);
  transition: all 0.3s;
}

.stat-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.stat-box .stat-number {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: #f3f4f6;
  margin-bottom: 4px;
}

.stat-box .stat-label {
  font-size: 12px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-box.active {
  border-color: rgba(34, 197, 94, 0.4);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
}

.stat-box.active .stat-number {
  color: #22c55e;
}

.stat-box.available {
  border-color: rgba(168, 85, 247, 0.4);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(168, 85, 247, 0.05));
}

.stat-box.available .stat-number {
  color: #a855f7;
}

.stat-box.paused {
  border-color: rgba(251, 191, 36, 0.4);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0.05));
}

.stat-box.paused .stat-number {
  color: #fbbf24;
}

/* ============ CREATE FORM ============ */
.create-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row.full {
  grid-column: 1 / -1;
}

.form-row label {
  font-size: 13px;
  color: #d1d5db;
  font-weight: 500;
}

.create-form-grid input {
  padding: 14px 16px;
  border: 1px solid rgba(75, 85, 99, 0.5);
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.6);
  color: #f3f4f6;
  font-size: 14px;
  transition: all 0.3s;
}

.create-form-grid input:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
  background: rgba(17, 24, 39, 0.8);
}

.create-form-grid button {
  grid-column: 1 / -1;
  padding: 14px 24px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 5px 20px rgba(168, 85, 247, 0.3);
}

.create-form-grid button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(168, 85, 247, 0.5);
}

/* License Result */
.license-result {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(168, 85, 247, 0.5);
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.license-result span {
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #c084fc;
}

.copy-btn {
  padding: 10px 18px;
  background: rgba(55, 65, 81, 0.8);
  border: 1px solid rgba(75, 85, 99, 0.5);
  border-radius: 10px;
  color: #f3f4f6;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: rgba(75, 85, 99, 0.9);
  border-color: #a855f7;
}

/* ============ LICENSE LIST ============ */
.license-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 5px;
}

.license-list::-webkit-scrollbar {
  width: 6px;
}

.license-list::-webkit-scrollbar-track {
  background: rgba(17, 24, 39, 0.3);
  border-radius: 3px;
}

.license-list::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.5);
  border-radius: 3px;
}

.license-list::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.7);
}

.license-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: rgba(17, 24, 39, 0.4);
  border-radius: 14px;
  border: 1px solid rgba(75, 85, 99, 0.3);
  transition: all 0.2s;
}

.license-item:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(17, 24, 39, 0.6);
}

.license-item.activated {
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
}

.license-item.expired {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
  opacity: 0.7;
}

.license-item.paused {
  border-color: rgba(251, 191, 36, 0.5);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(251, 191, 36, 0.05));
}

.license-item.paused .status {
  color: #fbbf24;
}

/* Toggle Switch */
.license-toggle-wrap {
  flex-shrink: 0;
}

.license-toggle {
  width: 44px;
  height: 24px;
  background: rgba(75, 85, 99, 0.6);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s;
}

.license-toggle.active {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.license-toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.license-toggle.active::after {
  transform: translateX(20px);
}

.license-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.license-customer {
  font-size: 15px;
  font-weight: 600;
  color: #f3f4f6;
}

.license-key {
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  color: #9ca3af;
}

.license-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.license-info {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: #9ca3af;
}

.license-info .duration {
  color: #c084fc;
  background: rgba(168, 85, 247, 0.15);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
}

.license-info .status {
  color: #6b7280;
  font-weight: 500;
}

.license-item.activated .status {
  color: #22c55e;
}

.license-item.expired .status {
  color: #ef4444;
}

.license-meta {
  font-size: 11px;
  color: #6b7280;
}

.delete-btn {
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.4;
  transition: all 0.2s;
}

.delete-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.loading, .empty {
  text-align: center;
  color: #6b7280;
  padding: 50px 20px;
  font-size: 14px;
}

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  margin-top: 30px;
  padding: 20px;
  color: #6b7280;
  font-size: 13px;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 10px 40px rgba(168, 85, 247, 0.4);
  }
  50% {
    box-shadow: 0 10px 50px rgba(168, 85, 247, 0.6);
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 700px) {
  #dashboard {
    padding: 20px 15px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .create-form-grid {
    grid-template-columns: 1fr;
  }

  .license-item {
    flex-wrap: wrap;
    gap: 12px;
  }

  .license-main {
    min-width: unset;
    flex: 1;
  }

  .license-details {
    width: 100%;
    order: 3;
  }

  .license-info {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions {
    position: static;
    text-align: center;
    margin-bottom: 20px;
  }
}
