:root {
  --color-bg-start: #0f172a;
  --color-bg-end: #1e1b4b;
  --color-text: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-accent-start: #8b5cf6;
  --color-accent-end: #3b82f6;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-card-bg: rgba(255, 255, 255, 0.03);
  --color-card-border: rgba(255, 255, 255, 0.08);
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, var(--color-bg-start), var(--color-bg-end));
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
}

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

/* Glassmorphism utility card */
.glass-card {
  background: var(--color-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-card-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px 0 rgba(139, 92, 246, 0.15);
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-area .icon {
  font-size: 28px;
}

.logo-area h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.status-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.status-pulse::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  animation: pulse-ring 1.5s infinite;
}

.status-pulse.connected {
  background-color: var(--color-success);
}

.status-pulse.connecting {
  background-color: var(--color-warning);
}

.status-pulse.disconnected {
  background-color: var(--color-danger);
}

.status-text {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Config Panel styling */
.config-panel h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

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

.ip-input-group {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--color-card-border);
  border-radius: 10px;
  padding: 4px;
  transition: all 0.3s;
}

.ip-input-group:focus-within {
  border-color: var(--color-accent-start);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.ip-input-group .prefix,
.ip-input-group .suffix {
  padding: 0 12px;
  font-size: 14px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.ip-input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: 16px;
  padding: 8px 4px;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-connect {
  background: linear-gradient(to right, var(--color-accent-start), var(--color-accent-end));
  color: white;
  padding: 8px 18px;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-connect:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

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

.btn-connect.active {
  background: #334155;
  color: var(--color-text);
  box-shadow: none;
}

.btn-connect.active:hover {
  background: #475569;
}

/* Control Grid styling */
.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.control-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.control-card.trigger-active {
  border-color: var(--color-success);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.card-icon {
  font-size: 40px;
  margin-bottom: 14px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s;
}

.control-card:hover .card-icon {
  transform: translateY(-4px) scale(1.05);
}

.control-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.door-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 24px;
  transition: all 0.3s;
}

.status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Action button inside card */
.btn-action {
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
  background: linear-gradient(135deg, #4f46e5, #2563eb);
}

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

.btn-action:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.25);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-action .btn-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.btn-action:active:not(:disabled) .btn-pulse {
  animation: click-ripple 0.4s ease-out;
}

/* Logs Panel styling */
.logs-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 250px;
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.logs-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--color-accent-start);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s;
}

.btn-text:hover {
  color: var(--color-accent-end);
}

.logs-container {
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 150px;
  padding-right: 5px;
}

/* Scrollbar customization */
.logs-container::-webkit-scrollbar {
  width: 4px;
}

.logs-container::-webkit-scrollbar-track {
  background: transparent;
}

.logs-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.logs-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.log-entry {
  line-height: 1.4;
  word-break: break-all;
}

.log-entry .time {
  color: var(--color-text-muted);
}

.log-entry.info .message { color: #e2e8f0; }
.log-entry.success .message { color: var(--color-success); }
.log-entry.warning .message { color: var(--color-warning); }
.log-entry.error .message { color: var(--color-danger); }
.log-entry.outgoing .message { color: #60a5fa; }
.log-entry.incoming .message { color: #f472b6; }
.log-entry.system .message { color: #a78bfa; }

/* Animations */
@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

@keyframes click-ripple {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 250px;
    height: 250px;
    opacity: 0;
  }
}
