/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100vh;
  caret-color: transparent !important;
}

/* Terminal Container */
#terminal-container {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: #161b22;
  z-index: 200;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 1px solid #30363d;
  display: flex;
  flex-direction: column;
}

#terminal-container.open {
  height: 66.67vh;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #21262d;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}

.terminal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-title {
  font-size: 12px;
  font-weight: 600;
  color: #c9d1d9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
}

.terminal-status {
  font-size: 12px;
  color: #8b949e;
}

#terminal {
  flex: 1;
  width: 100%;
  overflow: hidden;
}

/* App Container */
#app {
  display: block;
  height: 100vh;
  overflow-y: auto;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#app.terminal-open {
  height: 33.33vh;
  overflow-y: auto;
}

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(1, 4, 9, 0.8);
  z-index: 500;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

/* OTP Input */
.otp-input {
  letter-spacing: 8px;
  text-align: center;
  font-size: 24px !important;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
}

/* Session Items */
.session-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #21262d;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.session-item:hover {
  background-color: #161b22;
}

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

.session-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.session-icon svg {
  color: white;
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-name {
  font-size: 14px;
  font-weight: 600;
  color: #c9d1d9;
  margin-bottom: 2px;
}

.session-meta {
  font-size: 12px;
  color: #8b949e;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 20px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 10px;
  background: rgba(35, 134, 54, 0.2);
  color: #3fb950;
  margin-left: 12px;
}

.session-arrow {
  color: #8b949e;
  margin-left: 8px;
}

/* Header */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #21262d;
  background: #0d1117;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  color: #c9d1d9;
}

.header-links {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto;
}

.header-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.header-links a:hover {
  background-color: #30363d;
}

.header-links a:hover svg {
  fill: #c9d1d9;
}

.section-header {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #010409;
  border-bottom: 1px solid #21262d;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  text-align: center;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: #484f58;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: #c9d1d9;
  margin-bottom: 4px;
}

.empty-state-text {
  font-size: 14px;
  color: #8b949e;
}

/* Status Banners */
.status-banner {
  padding: 12px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #21262d;
}

.status-banner.connecting {
  background: rgba(187, 128, 9, 0.15);
  color: #d29922;
}

.status-banner.connected {
  background: rgba(35, 134, 54, 0.15);
  color: #3fb950;
}

.status-banner.error {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
}

.status-banner.notification-prompt {
  background: rgba(56, 139, 253, 0.15);
  color: #58a6ff;
  cursor: pointer;
}

.status-banner.notification-prompt:hover {
  background: rgba(56, 139, 253, 0.25);
}

.status-banner.new-session {
  background: rgba(35, 134, 54, 0.15);
  color: #3fb950;
  cursor: pointer;
}

.status-banner.new-session:hover {
  background: rgba(35, 134, 54, 0.25);
}

/* Buttons */
.close-btn {
  background: transparent;
  border: 1px solid #30363d;
  color: #8b949e;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.close-btn:hover {
  background: #30363d;
  color: #c9d1d9;
  border-color: #8b949e;
}

/* SSE Connection Indicator */
.sse-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(13, 17, 23, 0.9);
  border: 1px solid #30363d;
  border-radius: 6px;
  font-size: 11px;
  color: #8b949e;
  z-index: 1000;
}

.sse-indicator.connected {
  display: flex;
}

.sse-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid #30363d;
  border-top-color: #3fb950;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Mobile Responsive Styles */
@media (max-width: 480px) {
  /* Header adjustments for mobile */
  .header-bar {
    padding: 12px;
    gap: 8px;
  }

  .header-title {
    font-size: 14px;
  }

  .header-links {
    gap: 8px;
  }

  .header-links a {
    padding: 4px;
  }

  .header-links a svg {
    width: 18px;
    height: 18px;
  }

  /* Hide blog and mastodon links on mobile to save space */
  .header-links a.header-link-desktop {
    display: none !important;
  }

  /* SSE indicator styling for mobile */
  .sse-indicator {
    padding: 4px 8px;
    font-size: 10px;
  }

  /* When terminal is open on mobile, hide the session list completely */
  #app.terminal-open {
    height: 0;
    overflow: hidden;
    padding: 0;
  }

  /* Terminal takes full height on mobile when open */
  #terminal-container.open {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
  }

  /* Terminal header adjustments for mobile */
  .terminal-header {
    padding: 8px 12px;
  }

  .terminal-title {
    font-size: 11px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Session items more compact on mobile */
  .session-item {
    padding: 10px 12px;
  }

  .session-icon {
    width: 28px;
    height: 28px;
    margin-right: 10px;
  }

  .session-icon svg {
    width: 14px;
    height: 14px;
  }

  .session-name {
    font-size: 13px;
  }

  .session-meta {
    font-size: 11px;
  }

  .session-badge {
    font-size: 11px;
    padding: 0 6px;
    height: 18px;
    margin-left: 8px;
  }

  /* Status banner adjustments */
  .status-banner {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* OTP modal adjustments for mobile */
  .modal-overlay .Box {
    width: 95% !important;
    margin: 0 10px;
  }

  .otp-input {
    font-size: 20px !important;
    letter-spacing: 6px;
  }

  /* Section header more compact */
  .section-header {
    padding: 10px 12px;
    font-size: 11px;
  }

  /* Empty state adjustments */
  .empty-state {
    padding: 32px 12px;
  }

  .empty-state-icon {
    width: 40px;
    height: 40px;
  }

  .empty-state-title {
    font-size: 14px;
  }

  .empty-state-text {
    font-size: 12px;
  }
}
