@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0b0c10;
  --bg-secondary: rgba(22, 24, 30, 0.65);
  --accent: #6f42c1;
  --accent-glow: rgba(111, 66, 193, 0.4);
  --accent-hover: #8250df;
  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --text-muted: #636e72;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(111, 66, 193, 0.6);
  --success: #00e676;
  --warning: #ffb300;
  --danger: #ff1744;
  --deploying: #00e5ff;
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(12px);
  --font: 'Outfit', sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(111, 66, 193, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 229, 255, 0.1) 0%, transparent 40%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Glassmorphism utility card */
.glass-card {
  background: var(--bg-secondary);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

/* Auth Container */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  text-align: center;
}

.brand-header {
  margin-bottom: 30px;
}

.brand-logo {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #00e5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 5px;
  letter-spacing: -1px;
}

.brand-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 300;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 15px var(--accent-glow);
  background: rgba(0, 0, 0, 0.6);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(111, 66, 193, 0.3);
  transition: all 0.3s ease;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(111, 66, 193, 0.5);
  background: linear-gradient(135deg, var(--accent-hover), #7b4ee6);
}

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

.error-message {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 15px;
  min-height: 20px;
  font-weight: 500;
}

/* Dashboard Header */
.dashboard-header {
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(11, 12, 16, 0.8);
  backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title-sec {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-badge {
  background: rgba(111, 66, 193, 0.15);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-outline {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--text-primary);
}

/* Main Layout */
.dashboard-content {
  padding: 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 40px;
  flex-grow: 1;
}

@media (max-width: 1024px) {
  .dashboard-content {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-body {
  padding: 24px;
}

/* Project List */
.projects-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
}

@media (max-width: 600px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 25px rgba(111, 66, 193, 0.15);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.project-domain {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.project-domain:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

/* Status Badges */
.status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-running {
  background: rgba(0, 230, 118, 0.15);
  color: var(--success);
  border: 1px solid var(--success);
}

.status-stopped {
  background: rgba(99, 110, 114, 0.15);
  color: var(--text-secondary);
  border: 1px solid var(--text-muted);
}

.status-deploying, .status-starting, .status-stopping, .status-restarting {
  background: rgba(0, 229, 255, 0.15);
  color: var(--deploying);
  border: 1px solid var(--deploying);
  animation: pulse 1.5s infinite ease-in-out;
}

.status-failed {
  background: rgba(255, 23, 68, 0.15);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.project-details {
  margin-bottom: 20px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.detail-label {
  font-weight: 500;
}

.detail-value {
  color: var(--text-primary);
  font-family: monospace;
}

.project-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.btn-action {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-action:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-action.stop:hover:not(:disabled) {
  border-color: var(--warning);
  color: var(--warning);
  background: rgba(255, 179, 0, 0.05);
}

.btn-action.start:hover:not(:disabled) {
  border-color: var(--success);
  color: var(--success);
  background: rgba(0, 230, 118, 0.05);
}

.btn-action.delete:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(255, 23, 68, 0.05);
}

/* Log drawer / panel */
.log-panel {
  grid-column: 1 / -1;
  display: none;
  flex-direction: column;
  height: 350px;
}

.log-panel.active {
  display: flex;
}

.log-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-body {
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.6);
  padding: 20px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #00e5ff;
  overflow-y: auto;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.log-line {
  margin-bottom: 6px;
  white-space: pre-wrap;
}

/* Spinner and Animations */
.spinner {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top: 2px solid currentColor;
  width: 14px;
  height: 14px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* Modal configuration for Credentials */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 90%;
  max-width: 600px;
  padding: 30px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-title {
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.credential-block {
  margin-top: 15px;
}

.credential-field {
  background: rgba(0,0,0,0.3);
  padding: 10px 15px;
  border-radius: 6px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.credential-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.credential-value {
  font-family: monospace;
  color: var(--success);
}
