/* ============================================================================
   Smart Display Installer — Modern UI
   Responsif: mobile & desktop
   ============================================================================ */

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

:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --primary-light: #e8eeff;
  --success: #4caf50;
  --success-light: #e8f5e9;
  --success-dark: #2e7d32;
  --error: #f44336;
  --error-light: #ffebee;
  --error-dark: #c62828;
  --warning: #ff9800;
  --warning-light: #fff3e0;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: all 0.25s ease;
}

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;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text);
  line-height: 1.6;
}

.container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 520px;
  width: 100%;
  padding: 40px;
  text-align: center;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Screens */
.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Logo & Icons */
.logo,
.success-icon,
.alert-icon,
.error-icon {
  font-size: 72px;
  margin-bottom: 20px;
  line-height: 1;
}

.success-icon { filter: drop-shadow(0 4px 8px rgba(76, 175, 80, 0.3)); }
.error-icon { filter: drop-shadow(0 4px 8px rgba(244, 67, 54, 0.3)); }

/* Typography */
h1 {
  color: var(--text);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

h2 {
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 12px;
}

p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

strong { color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-text {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
}

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

.btn-lg {
  padding: 18px 36px;
  font-size: 16px;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.secondary-actions {
  margin-top: 20px;
}

/* Info Box */
.info-box {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 24px;
  text-align: left;
}

.info-title {
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 6px;
  font-size: 14px;
}

.info-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* Steps */
.steps {
  text-align: left;
  margin: 24px 0;
}

.step {
  display: flex;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  background: var(--bg);
  transition: var(--transition);
  border-left: 4px solid transparent;
}

.step[data-state="pending"] {
  opacity: 0.5;
}

.step[data-state="active"] {
  background: var(--primary-light);
  border-left-color: var(--primary);
  opacity: 1;
}

.step[data-state="done"] {
  background: var(--success-light);
  border-left-color: var(--success);
  opacity: 1;
}

.step[data-state="error"] {
  background: var(--error-light);
  border-left-color: var(--error);
  opacity: 1;
}

.step-number {
  background: var(--primary);
  color: white;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  margin-right: 14px;
  flex-shrink: 0;
}

.step[data-state="done"] .step-number {
  background: var(--success);
}

.step[data-state="done"] .step-number::before {
  content: "✓";
}

.step[data-state="error"] .step-number {
  background: var(--error);
}

.step[data-state="error"] .step-number::before {
  content: "✗";
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  font-size: 14px;
}

.step-msg {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Spinner (for active steps) */
.step[data-state="active"] .step-number {
  animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* User Info */
.user-info {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--primary-dark);
}

/* Activation Steps */
.activation-steps {
  text-align: left;
  background: var(--warning-light);
  border: 2px solid var(--warning);
  border-radius: var(--radius);
  padding: 20px;
  margin: 24px 0;
}

.activation-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.activation-step:last-child {
  margin-bottom: 0;
}

.activation-step .num {
  background: var(--warning);
  color: white;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.activation-step span:not(.num) {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* Storage Info */
.storage-info {
  background: var(--success-light);
  border: 2px solid var(--success);
  border-radius: var(--radius);
  padding: 16px;
  margin: 20px 0;
}

.storage-info p {
  color: var(--success-dark);
  font-weight: 500;
  margin: 0;
  font-size: 14px;
}

/* Error Screens */
.error-screen {
  text-align: center;
}

.error-screen h2 {
  color: var(--error-dark);
}

.error-message {
  background: var(--error-light);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  padding: 16px;
  margin: 20px 0;
  text-align: left;
  font-size: 14px;
  color: var(--text);
}

.error-message p {
  margin-bottom: 8px;
}

.error-message p:last-child {
  margin-bottom: 0;
}

.error-message strong {
  color: var(--error-dark);
}

.error-message a {
  color: var(--primary);
  text-decoration: underline;
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1000;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Utility */
[hidden] {
  display: none !important;
}

/* Responsive — Mobile */
@media (max-width: 520px) {
  body {
    padding: 12px;
    align-items: flex-start;
    padding-top: 20px;
  }
  
  .container {
    padding: 28px 20px;
    border-radius: var(--radius);
  }
  
  h1 {
    font-size: 22px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  .logo,
  .success-icon,
  .alert-icon,
  .error-icon {
    font-size: 60px;
  }
  
  .btn {
    width: 100%;
    padding: 14px 20px;
  }
  
  .step {
    padding: 12px;
  }
  
  .step-title {
    font-size: 13px;
  }
}

/* Dark mode preference (optional) */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  }
}