:root {
  --bg-color: #0c0e14;
  --card-bg: #141824;
  --card-border: #1e2638;
  --text-main: #f1f5f9;
  --text-muted: #828fa3;
  --text-dim: #4b5568;

  --color-online: #10b981;
  --color-online-glow: rgba(16, 185, 129, 0.25);
  --color-offline: #64748b;
  --color-offline-glow: rgba(100, 116, 139, 0.2);
  --color-checking: #f59e0b;
  --color-checking-glow: rgba(245, 158, 11, 0.25);

  --btn-wake: #059669;
  --btn-wake-hover: #10b981;
  --btn-shutdown: #e11d48;
  --btn-shutdown-hover: #f43f5e;
  --btn-refresh: #2563eb;
  --btn-refresh-hover: #3b82f6;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.header-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 4px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.header-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.icon-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-btn:hover {
  color: var(--text-main);
  border-color: #334155;
  background: #1e2638;
}

/* Main Card */
.main-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Status Orb Box */
.status-box {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: rgba(12, 14, 20, 0.6);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.status-orb-container {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.status-orb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transition: background-color 0.4s ease;
  z-index: 2;
}

.status-halo {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  z-index: 1;
}

/* Estados Visuales */
.status-orb.online {
  background-color: var(--color-online);
}
.status-halo.online {
  background: var(--color-online-glow);
  animation: pulse-halo 2.5s infinite ease-out;
}

.status-orb.offline {
  background-color: var(--color-offline);
}
.status-halo.offline {
  background: var(--color-offline-glow);
  opacity: 0.2;
}

.status-orb.checking {
  background-color: var(--color-checking);
}
.status-halo.checking {
  background: var(--color-checking-glow);
  animation: pulse-fast 1s infinite ease-in-out alternate;
}

@keyframes pulse-halo {
  0% {
    transform: scale(0.7);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.4);
    opacity: 0;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

@keyframes pulse-fast {
  0% { transform: scale(0.85); opacity: 0.4; }
  100% { transform: scale(1.2); opacity: 0.9; }
}

.status-text-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.status-label {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: color 0.3s ease;
}

.status-label.online {
  color: #34d399;
}
.status-label.offline {
  color: #94a3b8;
}
.status-label.checking {
  color: #fbbf24;
}

.status-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-dot {
  opacity: 0.4;
}

/* 3 Botones Principales */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.action-btn {
  position: relative;
  background: #192032;
  border: 1px solid #273349;
  border-radius: var(--radius-md);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  overflow: hidden;
  user-select: none;
}

.action-btn:hover {
  transform: translateY(-2px);
  border-color: #3d4f72;
}

.action-btn:active {
  transform: translateY(1px);
}

.btn-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-text-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.btn-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Botón 1: Encender */
.btn-wake .btn-icon-wrapper {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-wake:hover {
  border-color: rgba(16, 185, 129, 0.5);
  background: #14282a;
}

.btn-wake:hover .btn-icon-wrapper {
  background: rgba(16, 185, 129, 0.22);
  transform: scale(1.05);
}

/* Botón 2: Apagar */
.btn-shutdown .btn-icon-wrapper {
  background: rgba(225, 29, 72, 0.12);
  color: #fb7185;
  border: 1px solid rgba(225, 29, 72, 0.2);
}

.btn-shutdown:hover {
  border-color: rgba(225, 29, 72, 0.5);
  background: #2a1620;
}

.btn-shutdown:hover .btn-icon-wrapper {
  background: rgba(225, 29, 72, 0.22);
  transform: scale(1.05);
}

/* Botón 3: Recargar */
.btn-refresh .btn-icon-wrapper {
  background: rgba(37, 99, 235, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.btn-refresh:hover {
  border-color: rgba(37, 99, 235, 0.5);
  background: #17223b;
}

.btn-refresh:hover .btn-icon-wrapper {
  background: rgba(37, 99, 235, 0.22);
  transform: scale(1.05);
}

.spin-anim {
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Device Info Footer */
.device-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(12, 14, 20, 0.4);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
}

.detail-pill {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-label {
  color: var(--text-dim);
  font-weight: 500;
}

.detail-val {
  color: var(--text-muted);
  font-weight: 600;
}

.font-mono {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
  opacity: 0;
}

.modal-card {
  background: #161b2a;
  border: 1px solid #273349;
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: modal-enter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-card {
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-warning-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(225, 29, 72, 0.15);
  color: #fb7185;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.modal-body {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-body strong {
  color: var(--text-main);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-secondary {
  background: #1e2638;
  border: 1px solid #2a374f;
  color: var(--text-muted);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  color: var(--text-main);
  background: #253147;
}

.btn-danger {
  background: #e11d48;
  border: none;
  color: #ffffff;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-primary {
  background: #2563eb;
  border: none;
  color: #ffffff;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  background: #3b82f6;
}

.icon-btn-sm {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}

.icon-btn-sm:hover {
  color: var(--text-main);
  background: #273349;
}

/* Form Styles */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input,
.form-group select {
  background: #0f131d;
  border: 1px solid #273349;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.hidden {
  display: none !important;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: #182033;
  border: 1px solid #2a374f;
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #f43f5e;
}

.toast.info {
  border-left: 4px solid #3b82f6;
}

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

/* Responsive */
@media (max-width: 520px) {
  .actions-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .action-btn {
    flex-direction: row;
    justify-content: flex-start;
    padding: 16px;
    gap: 16px;
    text-align: left;
  }
  .btn-text-content {
    align-items: flex-start;
  }
  .device-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
