.coolify-dashboard {
  padding: 20px 0;
}

/* Dashboard header with sync button styles */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #eee;
}

.dashboard-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.sync-apps-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #0073aa;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.sync-apps-btn:hover {
  background: #005a87;
  color: #fff;
}

.sync-apps-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.sync-apps-btn .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

/* Spinning animation for sync icon */
.dashicons.spin {
  animation: spin 1s linear infinite;
}

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

/* Dashboard header styles */
.coolify-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #eee;
}

.coolify-dashboard-header h2 {
  margin: 0;
}

.coolify-dashboard-actions {
  display: flex;
  gap: 10px;
}

.coolify-no-apps {
  text-align: center;
  padding: 40px 20px;
  background: #f9f9f9;
  border-radius: 8px;
}

.coolify-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.coolify-app-card {
  position: relative;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}

.coolify-app-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* App logo styles */
.app-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
}

.app-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Service type badge */
.service-type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #e8f4f8;
  color: #0073aa;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 5;
}

.service-type-badge::before {
  content: "⚙";
  font-size: 12px;
}

/* Resource type dropdown - hidden by default, shown only for services */
.resource-type-select {
  display: none;
  margin-bottom: 10px;
}

.resource-type-select.show-for-service {
  display: block;
}

/* App card styles */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.app-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

/* Status badges with visual indicators */
.app-status,
.coolify-app-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-status::before,
.coolify-app-status::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-running::before,
.coolify-status-running::before {
  content: "✓";
  background: #28a745;
  color: white;
  font-size: 10px;
  font-weight: bold;
  line-height: 12px;
  text-align: center;
}

.status-stopped::before,
.coolify-status-stopped::before {
  content: "✗";
  background: #dc3545;
  color: white;
  font-size: 10px;
  font-weight: bold;
  line-height: 12px;
  text-align: center;
}

.status-pending::before,
.coolify-status-pending::before {
  content: "⏳";
  font-size: 10px;
  line-height: 12px;
  background: transparent;
}

.status-error::before,
.coolify-status-error::before {
  content: "⚠";
  background: #ffc107;
  color: #333;
  font-size: 10px;
  font-weight: bold;
  line-height: 12px;
  text-align: center;
}

.status-deleted::before,
.coolify-status-deleted::before {
  content: "🗑";
  font-size: 10px;
  line-height: 12px;
  background: transparent;
}

.status-unknown::before,
.coolify-status-unknown::before {
  content: "?";
  background: #6c757d;
  color: white;
  font-size: 10px;
  font-weight: bold;
  line-height: 12px;
  text-align: center;
}

.status-running,
.coolify-status-running {
  background: #d4edda;
  color: #155724;
}

.status-stopped,
.coolify-status-stopped {
  background: #f8d7da;
  color: #721c24;
}

.status-pending,
.coolify-status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-error,
.coolify-status-error {
  background: #f8d7da;
  color: #721c24;
}

.status-deleted,
.coolify-status-deleted {
  background: #e2e3e5;
  color: #383d41;
}

.status-unknown,
.coolify-status-unknown {
  background: #e2e3e5;
  color: #383d41;
  border: 1px solid #d6d8db;
}

.app-details {
  margin-bottom: 16px;
  text-align: left;
}

.app-details > div {
  margin-bottom: 8px;
  font-size: 14px;
}

.app-details strong {
  display: inline-block;
  min-width: 80px;
  color: #666;
}

.app-url a {
  color: #0073aa;
  text-decoration: none;
  word-break: break-all;
}

.app-url a:hover {
  text-decoration: underline;
}

.deleted-url {
  color: #999;
  text-decoration: line-through;
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-actions .button {
  flex: 1;
  min-width: 80px;
  text-align: center;
}

.button-danger {
  background: #dc3545;
  color: #fff;
  border-color: #dc3545;
}

.button-danger:hover {
  background: #c82333;
  border-color: #bd2130;
  color: #fff;
}

.coolify-app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.coolify-app-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.coolify-app-info {
  margin-bottom: 16px;
}

.coolify-app-info > div {
  margin-bottom: 8px;
}

.coolify-app-url a {
  color: #0073aa;
  text-decoration: none;
  word-break: break-all;
}

.coolify-app-url a:hover {
  text-decoration: underline;
}

.coolify-app-metrics {
  background: #f9f9f9;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.coolify-metrics-loading {
  text-align: center;
  color: #666;
}

.coolify-metrics-loading .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: #0073aa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.coolify-metrics-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.coolify-metric {
  display: flex;
  justify-content: space-between;
}

.coolify-metric-label {
  font-weight: 600;
  color: #666;
}

.coolify-metric-value {
  color: #333;
}

.coolify-app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.coolify-app-actions .button {
  flex: 1;
  min-width: 80px;
  text-align: center;
}

.coolify-btn-delete {
  background: #dc3545;
  color: #fff;
  border-color: #dc3545;
}

.coolify-btn-delete:hover {
  background: #c82333;
  border-color: #bd2130;
  color: #fff;
}

.coolify-app-settings {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.coolify-app-settings h4 {
  margin-top: 0;
  margin-bottom: 12px;
}

.coolify-env-vars {
  margin-bottom: 12px;
}

.coolify-env-var {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.coolify-env-key,
.coolify-env-value {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.coolify-btn-add-env {
  margin-right: 8px;
}

/* Rebuild section */
.app-rebuild-section {
  background: #f0f8ff;
  padding: 16px;
  border-radius: 6px;
  margin-top: 16px;
}

.rebuild-info {
  margin: 0 0 16px 0;
  color: #666;
  font-size: 14px;
}

.rebuild-options {
  margin-bottom: 16px;
}

.rebuild-options label {
  display: block;
  margin-bottom: 12px;
  cursor: pointer;
}

.rebuild-options input[type="radio"] {
  margin-right: 8px;
}

.new-subdomain-input {
  margin-top: 12px;
  margin-left: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.new-subdomain-input input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: monospace;
}

.subdomain-suffix {
  color: #666;
  font-size: 14px;
}

.rebuild-app-btn {
  width: 100%;
}

/* Environment variables section */
.app-env-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.toggle-env-btn {
  width: 100%;
  margin-bottom: 12px;
}

.env-vars-container {
  background: #f9f9f9;
  padding: 16px;
  border-radius: 6px;
}

.env-vars-list {
  margin-bottom: 12px;
}

.env-vars-list .loading {
  text-align: center;
  color: #666;
  margin: 0;
}

.env-vars-list .error {
  color: #dc3545;
  margin: 0;
}

.env-var-inputs {
  margin-bottom: 12px;
}

.env-var-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.env-var-row .env-key,
.env-var-row .env-value {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: monospace;
}

.env-var-row .env-key {
  max-width: 200px;
}

.env-var-row .remove-env-var {
  padding: 8px 12px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  min-width: 40px;
}

.env-var-row .remove-env-var:hover {
  background: #c82333;
}

.add-env-var {
  margin-right: 8px;
  margin-bottom: 8px;
}

.save-env-vars {
  margin-bottom: 8px;
}

/* Subdomain update section */
.app-subdomain-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.toggle-subdomain-btn {
  width: 100%;
  margin-bottom: 12px;
}

.subdomain-update-container {
  background: #fff9e6;
  padding: 16px;
  border-radius: 6px;
  border: 1px solid #ffd966;
}

.subdomain-warning {
  margin: 0 0 16px 0;
  color: #856404;
  font-size: 14px;
  line-height: 1.5;
}

.subdomain-input-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.subdomain-input-wrapper .new-subdomain-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: monospace;
}

.subdomain-input-wrapper .subdomain-suffix {
  color: #666;
  font-size: 14px;
  font-family: monospace;
}

.subdomain-check-status {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  min-height: 20px;
}

.update-subdomain-btn {
  width: 100%;
}

/* Modal styles */
.coolify-modal {
  display: none;
  position: fixed;
  z-index: 100000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.coolify-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 30px;
  border: 1px solid #ddd;
  width: 90%;
  max-width: 800px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  max-height: 80vh;
  overflow-y: auto;
}

.coolify-modal-close {
  color: #666;
  float: right;
  font-size: 28px;
  font-weight: bold;
  line-height: 20px;
  cursor: pointer;
}

.coolify-modal-close:hover,
.coolify-modal-close:focus {
  color: #000;
}

.coolify-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.coolify-template-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: default;
}

.coolify-template-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.template-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.template-info h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.template-category {
  display: inline-block;
  padding: 4px 10px;
  background: #e8f4f8;
  color: #0073aa;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.template-description {
  font-size: 13px;
  color: #666;
  margin: 8px 0 0 0;
  line-height: 1.4;
}

.coolify-loading {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.coolify-loading .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #ddd;
  border-top-color: #0073aa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 10px;
}

/* Debug info panel */
.debug-info {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

.debug-info strong {
  display: inline-block;
  min-width: 150px;
  color: #495057;
}

.debug-info details {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #dee2e6;
}

.debug-info summary {
  cursor: pointer;
  color: #007bff;
  font-weight: bold;
  padding: 8px;
  background: #f0f8ff;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.debug-info summary:hover {
  background: #e6f3ff;
}

.debug-info pre {
  margin-top: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  overflow-x: auto;
  max-height: 400px;
  font-size: 11px;
  line-height: 1.4;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .coolify-apps-grid {
    grid-template-columns: 1fr;
  }

  .coolify-app-actions .button {
    flex: 1 1 calc(50% - 4px);
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .sync-apps-btn {
    width: 100%;
    justify-content: center;
  }

  .coolify-dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .coolify-templates-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .template-logo {
    width: 48px;
    height: 48px;
  }

  .template-info h4 {
    font-size: 14px;
  }

  .template-description {
    font-size: 12px;
  }

  .coolify-modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 20px;
  }

  .env-var-row {
    flex-direction: column;
    align-items: stretch;
  }

  .env-var-row .env-key {
    max-width: 100%;
  }

  .env-var-row .remove-env-var {
    width: 100%;
  }

  .new-subdomain-input {
    flex-direction: column;
    align-items: stretch;
    margin-left: 12px;
  }

  .rebuild-options label {
    font-size: 14px;
  }

  .subdomain-input-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .subdomain-input-wrapper .subdomain-suffix {
    text-align: left;
    padding-left: 12px;
  }

  .debug-info {
    font-size: 11px;
  }

  .debug-info strong {
    display: block;
    min-width: auto;
    margin-bottom: 4px;
  }

  .debug-info pre {
    font-size: 10px;
    max-height: 300px;
  }
}

/* Added app management navigation styles to fix merged links */
.app-management-nav {
  display: flex;
  gap: 0;
  margin: 24px 0;
  border-bottom: 2px solid #e0e0e0;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.app-management-nav .nav-link {
  flex: 1;
  padding: 16px 24px;
  text-align: center;
  text-decoration: none;
  color: #555;
  font-weight: 500;
  font-size: 14px;
  border-right: 1px solid #e0e0e0;
  transition: all 0.3s ease;
  background: transparent;
  position: relative;
}

.app-management-nav .nav-link:last-child {
  border-right: none;
}

.app-management-nav .nav-link:hover {
  background: #fff;
  color: #0073aa;
}

.app-management-nav .nav-link.active {
  background: #fff;
  color: #0073aa;
  font-weight: 600;
  border-bottom: 3px solid #0073aa;
}

.app-management-nav .nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: #0073aa;
}

.app-management-content {
  background: #fff;
  padding: 32px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  min-height: 400px;
}

/* Improved app management header with better layout and modern design */
.app-management-header {
  margin-bottom: 32px;
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

.app-management-header .header-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-management-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  width: fit-content;
}

.app-management-header .back-link:hover {
  color: #fff;
  transform: translateX(-4px);
}

.app-management-header .back-link .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.app-management-header .app-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.app-management-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-management-header .app-status {
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-management-header .app-status .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

.app-management-header .app-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.app-management-header .button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.app-management-header .button-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

.app-management-header .button-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

/*
