/*
 File: asset/css/practise.css
 Purpose: Styles specific to the Practice page UI (toolbar, editor, results, recycle bin).
 Notes: Complements global styles in asset/css/style.css. IDs/classes align with practice.html.
*/

/* Practice: layout and components (migrated) */
.practice-body {
  overflow-y: auto;
  padding-bottom: 12px;
}
.practice-resize {
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 5;
}

/* Practice SQL modal (right-side drawer) */
.practice-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}
.practice-modal[aria-hidden="true"] {
  display: none;
}
.practice-modal.show {
  pointer-events: auto;
}

.practice-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 180ms ease;
}

.practice-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(560px, 92vw);
  min-width: 360px;
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.35);
  transform: translateX(8px);
  opacity: 0.98;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  transition:
    transform 220ms ease,
    opacity 180ms ease,
    width 120ms ease;
}

.practice-modal.show .practice-backdrop {
  opacity: 1;
}
.practice-modal.show .practice-panel {
  transform: translateX(0);
  opacity: 1;
}

.practice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

.practice-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 48px;
  z-index: 9;
}

.practice-status {
  color: var(--muted);
  margin-left: auto;
  font-size: 13px;
}

.practice-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.practice-form input {
  flex: 1 1 140px;
  min-width: 120px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.practice-editor {
  padding: 10px 12px;
}
.practice-editor textarea {
  width: 100%;
  height: 180px;
  resize: vertical;
  background: var(--code-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 13.5px;
}

.practice-output {
  padding: 0 12px 12px;
  overflow: auto;
}

.practice-output .result-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.practice-output .result-table thead th {
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px 10px;
}
.practice-output .result-table tbody td {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
}
.practice-output .result {
  margin: 10px 0 16px;
}
.practice-output .error {
  color: #f87171;
  font-weight: 600;
}

/* Dynamic form (drag + delete) */
#practice-form-dyn {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
#practice-form-dyn .dyn-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
#practice-form-dyn .dyn-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#practice-form-dyn .dyn-field {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
#practice-form-dyn .dyn-field.dragging {
  opacity: 0.6;
}
#practice-form-dyn .dyn-field .field-drag {
  cursor: grab;
  user-select: none;
  color: var(--muted);
}
#practice-form-dyn .dyn-field input {
  flex: 1 1 180px;
  min-width: 160px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
#practice-form-dyn .dyn-field .field-del {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

/* Recycle Bin panel */
.recycle-panel {
  margin: 8px 12px 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.recycle-list {
  display: grid;
  gap: 8px;
}
.recycle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.recycle-name {
  font-weight: 600;
}
.recycle-actions {
  display: flex;
  gap: 6px;
}

/* Recycle actions button hover */
.recycle-dialog .btn {
  transition:
    background-color 150ms ease,
    color 150ms ease,
    border-color 150ms ease;
}
.recycle-dialog .btn:hover {
  background: var(--primary-tint);
  border-color: var(--primary);
  color: var(--primary);
}

/* Recycle overlay layer */
.recycle-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}
.recycle-overlay.show {
  display: block;
}
.recycle-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.recycle-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(740px, 94vw);
  max-height: 80vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
.recycle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}
.recycle-body {
  padding: 10px 12px;
}
