/* Fuentes locales Plus Jakarta Sans */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../../assets/fonts/PlusJakartaSans-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../../assets/fonts/PlusJakartaSans-500.woff2') format('woff2');
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../../assets/fonts/PlusJakartaSans-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../../assets/fonts/PlusJakartaSans-700.woff2') format('woff2');
}

:root {
  /* Paleta de colores */
  --negro-800: #1a1a1a;
  --negro-700: #262626;
  --negro-600: #333333;
  --blanco-50: #ffffff;
  --blanco-100: #f0f0f0;
  --aqua-500: #00e5ff;

  /* Tipografías */
  --font-family-base: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-code: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* ==========================================================================
     DESIGN TOKENS - PC / DESKTOP (Default)
     ========================================================================== */
  --type-h1-size: 48px;
  --type-h1-weight: 700;
  --type-h1-spacing: -0.5px;
  --type-h1-line-height: 117%;

  --type-h2-size: 36px;
  --type-h2-weight: 700;
  --type-h2-spacing: -0.25px;
  --type-h2-line-height: 122%;

  --type-h3-size: 28px;
  --type-h3-weight: 600;
  --type-h3-spacing: 0px;
  --type-h3-line-height: 129%;

  --type-h4-size: 22px;
  --type-h4-weight: 600;
  --type-h4-spacing: 0px;
  --type-h4-line-height: 127%;

  --type-p-large-size: 18px;
  --type-p-large-weight: 400;
  --type-p-large-spacing: 0.15px;
  --type-p-large-line-height: 156%;

  --type-p-size: 16px;
  --type-p-weight: 400;
  --type-p-spacing: 0.25px;
  --type-p-line-height: 150%;

  --type-p-small-size: 14px;
  --type-p-small-weight: 400;
  --type-p-small-spacing: 0.3px;
  --type-p-small-line-height: 143%;

  --type-caption-size: 12px;
  --type-caption-weight: 400;
  --type-caption-spacing: 0.4px;
  --type-caption-line-height: 133%;

  --type-button-size: 14px;
  --type-button-weight: 600;
  --type-button-spacing: 0.5px;
  --type-button-line-height: 140%;

  --type-code-inline-size: 14px;
  --type-code-inline-weight: 400;
  --type-code-inline-spacing: 0px;
  --type-code-inline-line-height: 143%;

  --type-code-block-size: 14px;
  --type-code-block-weight: 400;
  --type-code-block-spacing: 0px;
  --type-code-block-line-height: 160%;
}

/* Tablet Tokens (600px - 959px) */
@media (max-width: 959px) {
  :root {
    --type-h1-size: 40px;
    --type-h1-line-height: 120%;

    --type-h2-size: 32px;
    --type-h2-line-height: 125%;

    --type-h3-size: 24px;
    --type-h3-line-height: 133%;

    --type-h4-size: 20px;
    --type-h4-line-height: 130%;

    --type-p-large-size: 18px;
    --type-p-large-line-height: 156%;

    --type-p-size: 16px;
    --type-p-line-height: 150%;

    --type-p-small-size: 14px;
    --type-p-small-line-height: 143%;

    --type-caption-size: 12px;
    --type-caption-line-height: 133%;

    --type-button-size: 14px;
    --type-button-line-height: 140%;

    --type-code-inline-line-height: 143%;
    --type-code-block-line-height: 160%;
  }
}

/* Mobile Tokens (< 600px) */
@media (max-width: 599px) {
  :root {
    --type-h1-size: 32px;
    --type-h1-line-height: 125%;

    --type-h2-size: 28px;
    --type-h2-line-height: 129%;

    --type-h3-size: 22px;
    --type-h3-line-height: 127%;

    --type-h4-size: 18px;
    --type-h4-line-height: 133%;

    --type-p-large-size: 16px;
    --type-p-large-line-height: 150%;

    --type-p-size: 16px;
    --type-p-line-height: 150%;

    --type-p-small-size: 14px;
    --type-p-small-line-height: 143%;

    --type-caption-size: 12px;
    --type-caption-line-height: 133%;

    --type-button-size: 14px;
    --type-button-line-height: 140%;

    --type-code-inline-line-height: 138%;
    --type-code-block-line-height: 154%;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--blanco-50);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Contenedor principal a pantalla completa */
.page-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--blanco-50);
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
}

/* Header superior (40px) */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 40px;
  margin-bottom: 16px;
  padding: 0;
}

/* Botones circulares (Atrás y Descargar) */
.header-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--negro-800);
  border: none;
  outline: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.header-btn:hover:not(:disabled) {
  background: var(--negro-700);
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}

.header-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.header-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Botón central 'Subir archivo' */
.btn-upload {
  height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--negro-800);
  color: var(--blanco-50);
  border: none;
  outline: none;
  font-family: var(--font-family-base);
  font-size: var(--type-button-size);
  font-weight: var(--type-button-weight);
  letter-spacing: var(--type-button-spacing);
  line-height: var(--type-button-line-height);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-upload:hover {
  background: var(--negro-700);
  transform: scale(1.04);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.btn-upload:active {
  transform: scale(0.97);
}

.hidden-input {
  display: none;
}

/* Contenedor central Bento */
.bento-container {
  flex: 1;
  width: 100%;
  background: var(--negro-800);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 2px solid transparent;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.bento-container.dragover {
  border-color: var(--aqua-500);
  background: #202020;
}

/* Estado vacío */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 32px;
  color: #888888;
  user-select: none;
  gap: 8px;
}

.empty-title {
  font-family: var(--font-family-base);
  font-size: var(--type-p-large-size);
  font-weight: 500;
  color: #f0f0f0;
  letter-spacing: -0.2px;
}

.empty-subtitle {
  font-family: var(--font-family-base);
  font-size: var(--type-caption-size);
  color: #777777;
}

/* Previsualización del contenido */
.preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  font-family: var(--font-family-base);
  font-size: var(--type-p-small-size);
  line-height: 1.7;
  color: #f0f0f0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Scrollbar sutil para el preview */
.preview-content::-webkit-scrollbar {
  width: 8px;
}

.preview-content::-webkit-scrollbar-track {
  background: transparent;
}

.preview-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.preview-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 599px) {
  .page-container {
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .preview-content {
    padding: 20px 18px;
    font-size: 14px;
  }
}

