/* Modern Premium Glassmorphic Design System */
:root {
  --bg-color: #080914;
  --panel-bg: rgba(18, 20, 38, 0.55);
  --border-light: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(0, 242, 254, 0.15);
  --text-main: #f1f3f9;
  --text-muted: #8d98c0;
  
  --primary-gradient: linear-gradient(135deg, #8a2be2 0%, #4a00e0 100%);
  --accent-cyan: #00f2fe;
  --accent-cyan-glow: rgba(0, 242, 254, 0.35);
  --accent-purple: #9b51e0;
  
  --status-green: #10b981;
  --status-green-glow: rgba(16, 185, 129, 0.3);
  --status-red: #ef4444;
  --status-red-glow: rgba(239, 68, 68, 0.3);
  --status-yellow: #f59e0b;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Glowing Background Blobs */
.glass-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.glass-bg::before,
.glass-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  animation: float 25s infinite alternate ease-in-out;
}

.glass-bg::before {
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, #8a2be2, #4a00e0);
  top: -10%;
  right: -5%;
}

.glass-bg::after {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, #00f2fe, #0072ff);
  bottom: -15%;
  left: -5%;
  animation-delay: -5s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(8%, 10%) scale(1.1);
  }
  100% {
    transform: translate(-5%, -5%) scale(0.95);
  }
}

/* Container */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.pulse-glow {
  width: 12px;
  height: 12px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 15px var(--accent-cyan);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(0, 242, 254, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(0, 242, 254, 0);
  }
}

.brand h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand .highlight {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
  font-weight: 350;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.large-card {
  grid-column: span 3;
}

/* Cards styling */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 10px 35px rgba(0, 242, 254, 0.05);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.75rem;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-cyan);
}

.card-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.card-body {
  flex: 1;
}

.scroll-y {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Custom Scrollbar */
.scroll-y::-webkit-scrollbar {
  width: 6px;
}
.scroll-y::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}
.scroll-y::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}
.scroll-y::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Info Lists */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.info-item .label {
  color: var(--text-muted);
}

.info-item .value {
  font-weight: 500;
}

/* Badges */
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
}

.badge-online {
  background-color: var(--status-green-glow);
  color: var(--status-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.badge-offline {
  background-color: var(--status-red-glow);
  color: var(--status-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.badge-pending {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--status-yellow);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-completed {
  background-color: var(--status-green-glow);
  color: var(--status-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Error Box */
.error-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.75rem;
  border-radius: 8px;
  color: #ff8e8e;
  font-size: 0.85rem;
  margin-top: 1rem;
  word-break: break-all;
}

.hidden {
  display: none !important;
}

/* Memory stats */
.memory-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #8a2be2, var(--accent-cyan));
  border-radius: 4px;
  transition: width 0.8s ease;
}

/* Timeline/Migrations */
.timeline-list {
  list-style: none;
  position: relative;
  padding-left: 1.5rem;
}

.timeline-list::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 5px;
  bottom: 5px;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.timeline-list li {
  position: relative;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  line-content: 1.4;
  padding-bottom: 0.25rem;
}

.timeline-list li::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

.timeline-list li.migration-already_run::before {
  background-color: #6b7280;
  box-shadow: none;
}

.migration-time {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Buttons */
.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
}

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

.refresh-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.4s ease;
}

.btn-icon:hover .refresh-icon {
  transform: rotate(180deg);
}

.btn-primary, .btn-secondary {
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: transform 0.1s ease, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn-primary {
  background: var(--primary-gradient);
  border: none;
  color: white;
  padding: 0.8rem 1.2rem;
  font-size: 0.95rem;
}

.btn-primary:hover {
  box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

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

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

/* Split Pane for CRUD */
.split-pane {
  display: flex;
  gap: 2rem;
}

.pane-form {
  flex: 1.2;
  border-right: 1px solid var(--border-light);
  padding-right: 2rem;
}

.pane-list {
  flex: 1.8;
}

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

.split-pane h3 {
  font-size: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  margin-bottom: 1rem;
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input, .form-group textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.7rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

/* Records List */
.records-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.records-list li {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  transition: transform 0.2s, border-color 0.2s;
  animation: slide-in 0.3s ease forwards;
}

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

.records-list li:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.record-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.record-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.record-title.completed {
  text-decoration: line-through;
  color: var(--text-muted);
}

.record-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-action {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: color 0.15s, background-color 0.15s;
}

.btn-action:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-toggle:hover {
  color: var(--accent-cyan);
}

.btn-delete:hover {
  color: var(--status-red);
}

.action-icon {
  width: 16px;
  height: 16px;
}

.loading-placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem !important;
  font-style: italic;
  font-size: 0.9rem;
  border: none !important;
  background: transparent !important;
}

/* Footer */
.app-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 1.5rem;
  margin-top: 1rem;
}

/* Responsiveness */
@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .large-card {
    grid-column: span 1;
  }
  .split-pane {
    flex-direction: column;
    gap: 1.5rem;
  }
  .pane-form {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding-right: 0;
    padding-bottom: 1.5rem;
  }
}
