/* SCORM Builder — identidad scormelearning.es */
:root {
  --purple: #7B3FE4;
  --blue: #009FE3;
  --green: #00BFA5;
  --dark: #333333;
  --gray: #6b7280;
  --light: #f5f7fb;
  --border: #e5e7eb;
  --white: #ffffff;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --font: "Open Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--dark);
  background: var(--light);
  min-height: 100%;
  line-height: 1.5;
}

a {
  color: var(--purple);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0 0 0.5rem;
  font-weight: 700;
  line-height: 1.25;
}

p {
  margin: 0 0 1rem;
  color: var(--gray);
}

/* Auth layout */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse at 10% 20%, rgba(123, 63, 228, 0.12), transparent 50%),
    radial-gradient(ellipse at 90% 80%, rgba(0, 159, 227, 0.12), transparent 50%),
    var(--light);
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.auth-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.auth-brand span {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
}

.auth-brand small {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--gray);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  color: var(--dark);
  background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid rgba(123, 63, 228, 0.35);
  border-color: var(--purple);
}

.form-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
  color: var(--white);
  background: var(--purple);
}

.btn:hover {
  opacity: 0.92;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-blue {
  background: var(--blue);
}

.btn-green {
  background: var(--green);
}

.btn-ghost {
  background: transparent;
  color: var(--dark);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.alert-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.muted {
  font-size: 0.875rem;
  color: var(--gray);
  text-align: center;
}

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--dark);
  color: var(--white);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand img {
  width: 36px;
  height: 36px;
}

.sidebar-brand strong {
  font-size: 0.95rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sidebar nav a {
  color: rgba(255, 255, 255, 0.85);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(123, 63, 228, 0.45);
  color: var(--white);
  text-decoration: none;
}

.sidebar-footer {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.5rem;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar h1 {
  font-size: 1.15rem;
  margin: 0;
}

.content {
  padding: 1.5rem;
  flex: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow);
}

.project-card h3 {
  font-size: 1.05rem;
}

.project-meta {
  font-size: 0.8rem;
  color: var(--gray);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(123, 63, 228, 0.12);
  color: var(--purple);
}

.badge-blue {
  background: rgba(0, 159, 227, 0.12);
  color: var(--blue);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal h2 {
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Editor layout */
.editor-shell {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  height: 100vh;
  background: var(--light);
}

.editor-panel {
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-panel.right {
  border-right: none;
  border-left: 1px solid var(--border);
}

.panel-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.panel-body {
  padding: 0.75rem;
  overflow: auto;
  flex: 1;
}

.screen-item {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  background: var(--white);
}

.screen-item.active {
  border-color: var(--purple);
  background: rgba(123, 63, 228, 0.08);
}

.screen-item .ord {
  color: var(--gray);
  font-size: 0.75rem;
  margin-right: 0.35rem;
}

.editor-canvas-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.editor-toolbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.editor-canvas {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
}

.canvas-page {
  max-width: 720px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  min-height: 420px;
}

.block {
  border: 1px dashed transparent;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius);
  position: relative;
}

.block:hover,
.block.selected {
  border-color: var(--blue);
  background: rgba(0, 159, 227, 0.04);
}

.block-toolbar {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  display: none;
  gap: 0.25rem;
}

.block:hover .block-toolbar,
.block.selected .block-toolbar {
  display: flex;
}

.block-text {
  font-size: 1rem;
}

.block-text h2 {
  font-size: 1.4rem;
}

.block-media img,
.block-media video {
  width: 100%;
  border-radius: var(--radius);
}

.block-quiz {
  border: 1px solid var(--border);
  background: #fafafa;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
}

.save-status {
  font-size: 0.8rem;
  color: var(--gray);
  margin-left: auto;
}

.save-status.saved {
  color: var(--green);
}

.save-status.error {
  color: var(--danger);
}

/* Preview player */
.player {
  max-width: 900px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--white);
}

.player-header {
  background: linear-gradient(90deg, var(--purple), var(--blue));
  color: var(--white);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.player-body {
  flex: 1;
  padding: 1.5rem;
}

.player-nav {
  border-top: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--light);
}

.index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.index-list li {
  margin-bottom: 0.35rem;
}

.index-list button {
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

.index-list button:hover,
.index-list button.current {
  border-color: var(--purple);
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .editor-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    height: auto;
    min-height: 100vh;
  }

  .editor-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 220px;
  }

  .editor-panel.right {
    border-left: none;
  }
}
