/* Variables */
:root {
  --sidebar-width: 280px;
  --sidebar-radius: 30px;
  --sidebar-gradient: linear-gradient(180deg, #6366f1 0%, #7c3aed 100%);
  --accent: #667eea;
  --content-max-width: 1100px;
}

/* Reset / base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  font-family: 'Quicksand', sans-serif;
  background: #1a1f3a;
  color: #2c3e50;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font-family: 'Quicksand', sans-serif;
}

/* BG container with sidebar background color */
/* Custom Scrollbar - Hidden/Transparent */
::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}

::-webkit-scrollbar-button {
  display: none;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: transparent;
  border: none;
}

/* BG container with sidebar background color */
.bg-container {
  height: 100vh;
  display: flex;
  align-items: stretch;
  background: #1a1f3a;
  padding: 48px;
  gap: 24px;
  box-sizing: border-box;
  overflow: hidden;
  /* Prevent body scroll */
}

/* Left / Right split */
.left {
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.right {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Constrain content */
  padding: 0;
  /* Remove padding from container to let panel handle it or scroll correctly */
  box-sizing: border-box;
  background: #ffffff;
  border-radius: 30px;
  position: relative;
}

.right::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background: linear-gradient(90deg, #6366f1 0%, #7c3aed 100%);
  z-index: 10;
}

/* Panels */
.content-panel {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  background: transparent;
  padding: 32px;
  box-sizing: border-box;
  border: none;
  box-shadow: none;
  overflow-y: auto;
  /* Scroll here */
}

.dashboard-panel {
  width: 100%;
  max-width: var(--content-max-width);
  background: #ffffff;
  border-radius: 24px;
  padding: 32px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Sidebar styles (kept compact) */
.sidebar {
  padding: 0;
  color: #a0aec0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-logo {
  font-size: 1.65rem;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 1.5rem;
  padding-left: 8px;
}

.sidebar-nav {
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-item {
  padding: 1rem 1.25rem;
  color: #a0aec0;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: none;
  border: none;
  text-align: left;
  font-weight: 600;
}

.sidebar-item:hover {
  background: rgba(251, 191, 36, 0.06);
  color: #fbbf24;
}

.sidebar-item.active {
  background: #fbbf24;
  color: #1a1f3a;
}

.sidebar-item-icon {
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
}

.sidebar-user-name {
  color: #fff;
  font-weight: 600;
}

.sidebar-user-role {
  color: #a0aec0;
  font-size: 0.8rem;
}

.sidebar-logout {
  background: rgba(251, 191, 36, 0.08);
  color: #fbbf24;
  border: none;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: center;
}

/* Header / container */
.container {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Form and inputs */
.section {
  margin-bottom: 1.5rem;
}

.section h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: #2c3e50;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #2c3e50;
}

.form-group input,
.custom-select select {
  width: 100%;
  padding: 0.9rem;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  background: #f8f9fa;
  color: #2c3e50;
}

.custom-select {
  position: relative;
}

/* Button Component System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  line-height: 1;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary */
.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 8px -1px rgba(102, 126, 234, 0.5);
}

/* Secondary */
.btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* Gradient Variants */
.btn-domain {
  background: linear-gradient(135deg, #22d3ee 0%, #0ea5e9 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.4);
}

.btn-domain:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 8px -1px rgba(14, 165, 233, 0.5);
}

.btn-restart {
  background: linear-gradient(135deg, #facc15 0%, #f97316 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.4);
}

.btn-restart:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 8px -1px rgba(249, 115, 22, 0.5);
}

.btn-delete-gradient {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.4);
  border: none;
}

.btn-delete-gradient:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 8px -1px rgba(220, 38, 38, 0.5);
}

/* Danger (Standard) */
.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fecaca;
  color: #b91c1c;
}

/* Ghost / Ghost-Secondary */
.btn-ghost {
  background: transparent;
  color: #64748b;
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1e293b;
}

/* Icon only variant */
.btn-icon {
  padding: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Apps grid & cards */
.apps-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}


.app-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  /* Stack info and buttons */
  align-items: stretch;
  /* Full width */
  gap: 1.25rem;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-details-wrapper {
  flex: 1;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  border-color: rgba(99, 102, 241, 0.2);
}

.app-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--accent);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.app-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.app-card p {
  color: #7f8c8d;
  margin-bottom: 0.5rem;
}

.app-card-footer {
  margin-top: auto;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  /* Align buttons to right */
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  padding-top: 1rem;
}

.app-card-btn {
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fafafa;
  cursor: pointer;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid #e8eef5;
  max-width: 500px;
  width: 100%;
}

/* Utility */
.hidden {
  display: none !important;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: #95a5a6;
}

/* Responsive tweaks */
@media (max-width:1024px) {
  :root {
    --sidebar-width: 220px;
  }
}

@media (max-width:768px) {
  .bg-container {
    flex-direction: column;
    padding: 16px;
  }

  .left {
    width: 100%;
    order: 1;
    display: flex;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
  }

  .right {
    order: 2;
    padding-top: 0;
  }

  .content-panel,
  .dashboard-panel {
    max-width: 100%;
    padding: 16px;
    border-radius: 12px;
  }
}

/* Custom Dropdown */
.custom-dropdown {
  position: relative;
  width: 100%;
  font-family: 'Quicksand', sans-serif;
}

.dropdown-track {
  width: 100%;
  padding: 0.9rem 1rem;
  background: #f8f9fa;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  user-select: none;
}

.dropdown-track:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.dropdown-track.active {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dropdown-track::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.8rem;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.dropdown-track.active::after {
  transform: rotate(180deg);
}

.dropdown-options {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  display: none;
  z-index: 50;
  max-height: 250px;
  overflow-y: auto;
  padding: 0.5rem;
}

.dropdown-options.show {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

.dropdown-option {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  color: #334155;
  transition: background 0.15s ease;
}

.dropdown-option:hover {
  background: #f1f5f9;
  color: #667eea;
}

.dropdown-option.selected {
  background: #eff6ff;
  color: #667eea;
  font-weight: 600;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: capitalize;
}

.status-badge.running {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.status-badge.pending {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.status-badge.failed {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.status-badge.running .status-dot {
  background: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

.status-badge.pending .status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 rgba(245, 158, 11, 0.7);
  animation: pulse-yellow 2s infinite;
}

.status-badge.failed .status-dot {
  background: #ef4444;
  box-shadow: 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes pulse-yellow {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

@keyframes pulse-red {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}