/* DashCaddy Installer Styles */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #818cf8;
  --success: #22c55e;
  --success-bg: #dcfce7;
  --error: #ef4444;
  --error-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --text: #1f2937;
  --text-muted: #6b7280;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--text);
  overflow: hidden;
}

#root {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Main Container */
.installer-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 900px;
  width: 95%;
  margin: 20px auto;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Step Indicator */
.step-indicator {
  display: flex;
  justify-content: center;
  padding: 24px 40px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  background: var(--border);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.step-item.active .step-circle {
  background: var(--primary);
  color: white;
}

.step-item.completed .step-circle {
  background: var(--success);
  color: white;
}

/* Checkmark rendered in HTML, no ::after needed */

.step-label {
  font-size: 13px;
  color: var(--text-muted);
  display: none;
}

.step-item.active .step-label {
  display: block;
  color: var(--text);
  font-weight: 500;
}

.step-connector {
  width: 40px;
  height: 2px;
  background: var(--border);
}

.step-item.completed + .step-connector {
  background: var(--success);
}

/* Content Area */
.step-content {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Welcome Step */
.welcome-content {
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.logo-container {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-container img {
  max-width: 200px;
  max-height: 120px;
  height: auto;
  object-fit: contain;
}

.logo-placeholder {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: white;
  font-size: 48px;
  font-weight: bold;
  /* Fallback if logo image fails to load */
}

.step-content h1 {
  font-size: 32px;
  color: var(--text);
  margin-bottom: 12px;
}

.step-content h2 {
  font-size: 24px;
  color: var(--text);
  margin-bottom: 16px;
}

.step-content p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.feature-list {
  list-style: none;
  text-align: left;
  margin: 24px 0;
  padding: 0;
}

.feature-list li {
  padding: 12px 0;
  padding-left: 32px;
  position: relative;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.feature-list li:last-child {
  border-bottom: none;
}

.feature-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: bold;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* Folder Selection */
.folder-inputs {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.folder-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.folder-input label {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.folder-input .hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.input-row input:focus {
  border-color: var(--primary);
}

.input-row input::placeholder {
  color: var(--text-muted);
}

.btn-browse {
  padding: 12px 20px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-browse:hover {
  border-color: var(--primary);
  background: white;
}

/* Dependency Cards */
.dependency-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.dependency-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg);
  border-radius: 12px;
  border: 2px solid var(--border);
}

.dependency-card.checking {
  border-color: var(--warning);
  background: var(--warning-bg);
}

.dependency-card.installed {
  border-color: var(--success);
  background: var(--success-bg);
}

.dependency-card.missing {
  border-color: var(--error);
  background: var(--error-bg);
}

.dependency-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  font-size: 24px;
}

.dependency-info {
  flex: 1;
}

.dependency-info h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.dependency-info p {
  font-size: 13px;
  margin: 0;
}

.dependency-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-icon {
  font-size: 20px;
}

.status-icon.checking::after {
  content: '⏳';
}

.status-icon.installed::after {
  content: '✓';
  color: var(--success);
}

.status-icon.missing::after {
  content: '✗';
  color: var(--error);
}

.btn-install {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-install:hover {
  background: var(--primary-hover);
}

.btn-install:disabled {
  background: var(--border);
  cursor: not-allowed;
}

/* Installation Progress */
.installation-progress {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  text-align: center;
}

.progress-container {
  margin: 32px 0;
}

.progress-bar-bg {
  width: 100%;
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.progress-text {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.progress-percentage {
  font-size: 48px;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 16px;
}

.task-log {
  margin-top: 24px;
  text-align: left;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
}

.task-log-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.task-log-item:last-child {
  border-bottom: none;
}

.task-log-item.completed {
  color: var(--success);
}

.task-log-item.current {
  color: var(--primary);
  font-weight: 500;
}

.task-log-item.pending {
  color: var(--text-muted);
}

/* Complete Step */
.complete-content {
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 40px;
  color: var(--success);
}

.install-summary {
  background: var(--bg);
  border-radius: 12px;
  padding: 20px;
  margin: 24px 0;
  text-align: left;
}

.install-summary h3 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.install-summary .summary-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.install-summary .summary-item:last-child {
  border-bottom: none;
}

.install-summary .summary-label {
  color: var(--text-muted);
}

.install-summary .summary-value {
  color: var(--text);
  font-weight: 500;
  font-family: monospace;
}

/* Footer / Navigation */
.step-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.btn {
  padding: 12px 32px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
}

/* Loading States */
.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.spinner-small {
  width: 20px;
  height: 20px;
  border-width: 2px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

/* Error States */
.error-message {
  background: var(--error-bg);
  color: var(--error);
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.error-message::before {
  content: '⚠';
  font-size: 20px;
}

/* Tier Selection Cards */
.tier-cards {
  display: flex;
  gap: 16px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.tier-card {
  flex: 1;
  padding: 20px;
  background: var(--bg);
  border-radius: 12px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.tier-card:hover {
  border-color: var(--primary-light);
}

.tier-card.selected {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.tier-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  background: var(--primary);
  color: white;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.tier-header {
  margin-bottom: 12px;
}

.tier-card h3 {
  font-size: 18px;
  margin: 0;
}

.tier-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.tier-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tier-features li {
  font-size: 12px;
  padding: 4px 0 4px 20px;
  position: relative;
  color: var(--text);
}

.tier-features li::before {
  content: '+';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: bold;
}

/* Access Mode Cards */
.access-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
  color: white;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px;
}

.access-note {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Toggle */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
  margin-bottom: 16px;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Form group */
.form-group {
  margin-bottom: 16px;
}

/* Info message */
.info-message {
  background: #e0e7ff;
  color: #3730a3;
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
}

/* Success message */
.success-message {
  background: var(--success-bg);
  color: #166534;
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Color input styling */
input[type="color"] {
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}

/* Uninstall Link on Welcome */
.uninstall-link {
  margin-top: 24px;
}

.uninstall-link a {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s;
}

.uninstall-link a:hover {
  color: var(--error);
  text-decoration: underline;
}

/* Uninstall Content */
.uninstall-content {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.uninstall-content h1 {
  text-align: center;
}

.uninstall-content > p {
  text-align: center;
}

.uninstall-content .step-footer {
  margin-top: 32px;
  padding: 0;
  background: none;
  border-top: none;
}

/* Danger button */
.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-danger:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Detecting spinner */
.detecting-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Path input row */
.path-input-row {
  display: flex;
  gap: 8px;
}

.path-input-row .input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.path-input-row .input:focus {
  border-color: var(--primary);
}

/* Detection badges */
.detected-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 12px;
  background: var(--success-bg);
  color: #166534;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.not-detected-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 12px;
  background: var(--error-bg);
  color: var(--error);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* Preserve options */
.preserve-options {
  margin-top: 24px;
  background: var(--bg);
  border-radius: 12px;
  padding: 20px;
}

.preserve-options h3 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.preserve-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.checkbox-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.checkbox-row strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}

.checkbox-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* Uninstall progress */
.uninstall-content .progress-container {
  margin: 24px 0;
}

.uninstall-content .progress-bar {
  width: 100%;
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.current-task {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 8px;
}

.completed-tasks {
  margin-top: 20px;
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text);
}

.task-item.completed .task-check {
  color: var(--success);
  font-weight: bold;
}

/* Preserve note */
.preserve-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 12px;
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .tier-cards {
    flex-direction: column;
  }

  .installer-container {
    margin: 10px;
    width: calc(100% - 20px);
  }

  .step-content {
    padding: 24px;
  }

  .step-footer {
    padding: 16px 24px;
  }

  .step-label {
    display: none !important;
  }

  .step-connector {
    width: 24px;
  }
}
