/* ================================= */
/* DECK GENERATOR APPLICATION STYLES */
/* ================================= */

:root {
  --bg: #0b1220;
  --fg: #e5e7eb;
  --muted: #94a3b8;
  --pri: #0ea5e9;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

/* ================================= */
/* HEADER STYLES                     */
/* ================================= */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0b1220cc;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #ffffff1a;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

select,
button,
input[type=file] {
  background: #0a0f1a;
  border: 1px solid #1f2937;
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
}

button {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  border: 0;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ================================= */
/* MAIN LAYOUT                       */
/* ================================= */

main {
  display: grid;
  grid-template-columns: min-content 1fr; /* Default to collapsed layout */
  gap: 16px;
  padding: 16px;
}

/* When log is expanded, give it more space */
main.log-expanded {
  grid-template-columns: 1fr 1.2fr;
}

@media (max-width: 1080px) {
  main {
    grid-template-columns: 1fr;
  }
}

.card {
  background: #0a0f1a;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 12px;
}

.title {
  font-weight: 800;
  margin: 0 0 8px;
}

/* ================================= */
/* COLLAPSIBLE LOG SECTION           */
/* ================================= */

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

/* Make collapsed log header more compact */
.card.log-card .log-header {
  gap: 4px;
}

.card.log-card .log-header .title {
  font-size: 0.875rem;
  margin: 0;
  white-space: nowrap;
}

.log-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2em;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

/* Smaller toggle in collapsed state */
.card.log-card .log-toggle {
  padding: 2px 4px;
  font-size: 1em;
}

.log-toggle:hover {
  background: #1f2937;
  color: var(--fg);
}

.log-content {
  transition: all 0.3s ease;
  overflow: hidden;
  /* Default to collapsed */
  max-height: 0;
  padding: 0;
  margin: 0;
}

/* Expanded state */
.log-content.expanded {
  max-height: 400px;
  padding-top: 8px;
}

/* Log card is minimal by default (collapsed state) - higher specificity */
.card.log-card {
  padding: 4px 8px;
  width: min-content;
  min-width: auto;
  max-width: 80px;
}

/* When expanded, log card gets full width - higher specificity */
.card.log-card.expanded {
  padding: 12px;
  width: auto;
  min-width: 300px;
  max-width: none;
}

/* ================================= */
/* LOG PRE ELEMENT                   */
/* ================================= */

pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875rem;
  line-height: 1.4;
  max-height: 400px;
  overflow-y: auto;
}

/* ================================= */
/* PREVIEW IFRAME                    */
/* ================================= */

iframe {
  width: 100%;
  height: 76vh;
  border: 0;
  background: #000;
  border-radius: 12px;
}

/* ================================= */
/* UTILITY STYLES                    */
/* ================================= */

small {
  opacity: .8;
}

/* Loading states */
button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Enhanced focus styles for accessibility */
button:focus,
select:focus,
input:focus {
  outline: 2px solid var(--pri);
  outline-offset: 2px;
}

/* Error states */
.error {
  color: #ef4444;
  background: #fef2f2;
  border-color: #fca5a5;
}