/* Ipse Custom Styles */

/* Mobile viewport */
html, body {
  height: 100%;
  overflow: hidden;
}

.page-wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.content-wrapper {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Navbar */
.navbar {
  min-height: 44px;
  padding: 4px 10px;
  flex-shrink: 0;
}
.navbar-brand {
  font-weight: 600;
  letter-spacing: 0.05em;
}
.ipse-icon svg {
  fill: currentColor;
  vertical-align: middle;
}
.ipse-icon svg path {
  fill: currentColor;
}

/* Object Navigation */
.ipse-nav {
  padding: 8px 0;
  margin: 0 3rem;
  font-size: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}
@media (max-width: 576px) {
  .ipse-nav {
    margin: 0 2rem;
  }
}
.ipse-nav-link {
  color: inherit;
  opacity: 0.7;
  text-decoration: none;
}
.ipse-nav-link:hover {
  opacity: 1;
  text-decoration: underline;
}
.ipse-nav-sep {
  opacity: 0.4;
  margin: 0 2px;
}

/* Outliner */
.ipse-outliner {
  margin-bottom: 10px;
  border-left: 3px solid rgba(100, 150, 255, 0.5);
  border-radius: 4px;
}
.ipse-outliner-header {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  gap: 6px;
  min-height: 44px;
  user-select: none;
  -webkit-user-select: none;
}
.ipse-outliner-header:active {
  opacity: 0.8;
}
.ipse-outliner-icon svg {
  fill: currentColor;
  vertical-align: middle;
}
.ipse-outliner-icon svg path {
  fill: currentColor;
}
.ipse-hdr-btn {
  padding: 4px;
  min-width: 28px;
  min-height: 28px;
}
.ipse-hdr-btn svg path {
  fill: currentColor;
}

.ipse-outliner-body {
  padding: 0 10px 10px;
}

/* Slot Groups */
.ipse-slot-group {
  margin-bottom: 6px;
}
.ipse-slot-group-label {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.5;
  padding: 4px 0 2px;
}

/* Slot Row */
.ipse-slot-row {
  display: flex;
  align-items: center;
  padding: 4px 0;
  min-height: 36px;
  gap: 4px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.1);
  flex-wrap: wrap;
}
.ipse-slot-row:last-child {
  border-bottom: none;
}
.ipse-slot-marker {
  font-family: monospace;
  font-weight: bold;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.ipse-marker-parent { color: #4caf50; }
.ipse-marker-data { color: #90a4ae; }
.ipse-marker-method { color: #42a5f5; }
.ipse-marker-native { color: #ff9800; }

.ipse-slot-name {
  font-family: monospace;
  font-weight: 600;
  flex-shrink: 0;
}
.ipse-slot-sep {
  opacity: 0.4;
  flex-shrink: 0;
}
.ipse-slot-value {
  font-family: monospace;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ipse-method-code {
  color: #42a5f5;
  font-size: 1.2rem;
}
.ipse-native {
  color: #ff9800;
  font-style: italic;
  font-size: 1.2rem;
}
.ipse-nil {
  opacity: 0.4;
}
.ipse-obj-link {
  color: #66bb6a;
  text-decoration: none;
  cursor: pointer;
}
.ipse-obj-link:hover {
  text-decoration: underline;
}

.ipse-slot-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
}
.ipse-slot-btn {
  padding: 2px;
  min-width: 24px;
  min-height: 24px;
  opacity: 0.5;
}
.ipse-slot-btn:hover {
  opacity: 1;
}
.ipse-slot-btn svg path {
  fill: currentColor;
}

/* Slot editing */
.ipse-editing {
  flex-direction: column;
  align-items: stretch;
}
.ipse-edit-input {
  font-family: monospace;
  font-size: 1.3rem;
  margin: 4px 0;
}
.ipse-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* Outliner actions */
.ipse-outliner-actions {
  padding-top: 8px;
  border-top: 1px solid rgba(128, 128, 128, 0.15);
  margin-top: 4px;
}
.ipse-add-slot {
  display: flex;
  gap: 4px;
  align-items: center;
}
.ipse-add-slot-input {
  flex: 1;
  font-family: monospace;
}
.ipse-add-slot-type {
  width: auto;
  min-width: 80px;
}

/* Workspace */
.ipse-workspace {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-top: 1px solid rgba(128, 128, 128, 0.2);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.dark-mode .ipse-workspace {
  background: #1e2125;
}
.ipse-workspace:not(.dark-mode *) {
  background: #f8f9fa;
}
.ipse-workspace-log {
  max-height: 150px;
  overflow-y: auto;
  padding: 6px 10px;
  font-family: monospace;
  font-size: 1.2rem;
  line-height: 1.6;
}
.ipse-ws-entry {
  margin-bottom: 4px;
}
.ipse-ws-input {
  opacity: 0.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.ipse-ws-output {
  color: #66bb6a;
  white-space: pre-wrap;
  word-break: break-all;
}
.ipse-ws-error {
  color: #ef5350;
  white-space: pre-wrap;
  word-break: break-all;
}

.ipse-workspace-input-area {
  padding: 6px 10px;
  display: flex;
  gap: 4px;
  align-items: stretch;
}
.ipse-ws-textarea {
  font-family: monospace;
  font-size: 1.3rem;
  resize: none;
  flex: 1;
  min-height: 60px;
  max-height: 100px;
}
.ipse-ws-buttons {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  width: 64px;
}
.ipse-ws-buttons .btn {
  flex: 1;
  white-space: nowrap;
  font-size: 1.1rem;
  padding: 2px 6px;
}

/* Help screen */
.ipse-help {
  margin: 0 3rem 16px;
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 4px;
  border-left: 3px solid rgba(255, 200, 50, 0.6);
}
@media (max-width: 576px) {
  .ipse-help {
    margin-left: 2rem;
    margin-right: 2rem;
  }
}
.ipse-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}
.ipse-help-title {
  font-size: 1.5rem;
  font-weight: 600;
}
.ipse-help-body {
  padding: 10px 14px 14px;
  font-size: 1.3rem;
  line-height: 1.7;
}
.ipse-help-body h5 {
  margin: 16px 0 6px;
  font-size: 1.4rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  padding-bottom: 4px;
}
.ipse-help-body h5:first-child {
  margin-top: 4px;
}
.ipse-help-body p {
  margin: 6px 0;
}
.ipse-help-body code {
  font-family: monospace;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 1.2rem;
}
.dark-mode .ipse-help-body code {
  background: rgba(255, 255, 255, 0.08);
  color: #7ec8e3;
}
.ipse-help-body:not(.dark-mode *) code {
  background: rgba(0, 0, 0, 0.06);
}
.ipse-help-body table {
  width: 100%;
  margin: 6px 0;
  font-size: 1.2rem;
}
.ipse-help-body td,
.ipse-help-body th {
  padding: 3px 8px;
  vertical-align: top;
}
.ipse-help-body th {
  text-align: left;
  font-weight: 600;
  opacity: 0.7;
}
.ipse-help-body tr:nth-child(even) {
  background: rgba(128, 128, 128, 0.06);
}
.ipse-help-body ul {
  margin: 6px 0;
  padding-left: 20px;
}
.ipse-help-body li {
  margin-bottom: 4px;
}
.ipse-help-body a {
  color: #42a5f5;
}
.dark-mode .ipse-help {
  background: rgba(255, 255, 255, 0.03);
}

/* Confirmation modal */
.ipse-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
}
.ipse-modal {
  width: 100%;
  max-width: 340px;
  border-radius: 6px;
  border: 1px solid rgba(128, 128, 128, 0.3);
  overflow: hidden;
}
.dark-mode .ipse-modal {
  background: #2a2e33;
  color: rgba(255, 255, 255, 0.8);
}
.ipse-modal:not(.dark-mode *) {
  background: #ffffff;
  color: rgba(0, 0, 0, 0.85);
}
.ipse-modal-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  gap: 6px;
}
.ipse-modal-title {
  font-size: 1.5rem;
  font-weight: 600;
}
.ipse-modal-body {
  padding: 14px;
  font-size: 1.3rem;
  line-height: 1.6;
}
.ipse-modal-body p {
  margin: 0;
}
.ipse-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid rgba(128, 128, 128, 0.15);
}

/* Dark mode adjustments */
.dark-mode .card {
  background-color: #2a2e33;
  border-color: rgba(255, 255, 255, 0.08);
}
.dark-mode .ipse-outliner {
  border-left-color: rgba(100, 150, 255, 0.4);
}

/* Mobile refinements */
@media (max-width: 576px) {
  .ipse-ws-buttons {
    width: 54px;
  }
  .ipse-ws-buttons .btn {
    font-size: 1rem;
    padding: 2px 4px;
  }
  .ipse-slot-row {
    font-size: 1.2rem;
  }
  .ipse-add-slot {
    flex-wrap: wrap;
  }
  .ipse-add-slot-input {
    min-width: 0;
  }
}
