/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  background: linear-gradient(135deg, #eef2f7, #f7f9fc);
  color: #1f2937;
  min-height: 100vh;
}

/* Layout */
header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}
header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
}
main {
  flex: 1;
  width: 100%;
  max-width: 950px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 2rem;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .07);
  padding: 2rem;
  position: relative;
}

/* Form groups */
#repoForm {
  display: grid;
  gap: 1.5rem;
}
.group {
  display: grid;
  gap: 1rem;
}
.group-title {
  font-size: 1.1rem;
  font-weight: 600;
}
label {
  display: flex;
  flex-direction: column;
  font-size: .875rem;
  gap: .25rem;
}
input, textarea {
  padding: .6rem .75rem;
  border: 1px solid #cbd5e1;
  border-radius: .5rem;
  font: inherit;
  background: #f9fafb;
  transition: border-color .2s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: #3b82f6;
}
textarea {
  min-height: 5rem;
  resize: vertical;
}
fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}
.options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.options label {
  flex: 1 1 200px;
}

/* Buttons */
button {
  cursor: pointer;
  padding: .65rem 1.25rem;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 500;
  border: none;
  border-radius: .5rem;
  background: #3b82f6;
  color: #fff;
  transition: background .2s, transform .1s;
}
button:hover:not(:disabled) {
  background: #2563eb;
}
button:active:not(:disabled) {
  transform: scale(.97);
}
button:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}
.actions {
  display: flex;
  gap: .5rem;
}

/* Drop zone */
#dropZone {
  padding: 2.5rem;
  border: 2px dashed #94a3b8;
  border-radius: .75rem;
  text-align: center;
  font-size: .9rem;
  background: #f8fafc;
  transition: border-color .2s, background .2s;
}
#dropZone.dragover {
  border-color: #3b82f6;
  background: #eef6ff;
}

/* Collapsible details */
details.collapsible summary::-webkit-details-marker {
  display: none;
}
details.collapsible summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: .5rem 0;
}
details.collapsible .arrow {
  display: inline-block;
  transition: transform .2s ease;
}
details.collapsible:not([open]) .arrow {
  transform: rotate(-90deg);
}

/* Output actions (top-right) */
.output-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: .5rem;
}
.output-actions button {
  font-size: .85rem;
}

/* Preview area */
pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: .75rem;
  overflow: auto;
  max-height: 70vh;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, monospace;
  font-size: .85rem;
}

/* Responsive */
@media (max-width: 600px) {
  button, input, textarea {
    font-size: 1rem;
  }
}
#outputCard {
  position: relative;
  height: 70vh;
  overflow: hidden;
}

#outputCard pre {
  height: calc(100% - 0.5rem);
  overflow-y: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.group label,
.group textarea {
  position: relative;
}

/* Hint bubble: inline and RTL-safe */
.hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.25rem;
  width: 0.8rem;
  height: 0.8rem;
  font-size: 0.6rem;
  border-radius: 50%;
  background: #cbd5e1;
  color: #1f2937;
  cursor: help;
  user-select: none;
}
.hint:hover {
  background: #94a3b8;
}

.hidden {
  display: none;
}
