@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');
@import url('./colores/light.css');
@import url('./colores/dark.css');
@import url('./colores/light-mc.css');
@import url('./colores/dark-mc.css');
@import url('./colores/light-hc.css');
@import url('./colores/dark-hc.css');


/* --- Variables y Estilos Globales --- */
html {
  box-sizing: border-box;
  /* Add a transition for theme changes. This is the root element where theme classes are applied. */
  transition: background-color 0.3s ease, color 0.3s ease;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans JP', sans-serif;
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
}

.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex-grow: 1;

}

/* --- Contenedor Global --- */
.container-padded {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* --- Componentes Genéricos --- */

/* Encabezados de Página */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--md-sys-color-on-surface-variant);
  max-width: 700px;
  margin: 0 auto;
}

/* Grilla de Items Genérica */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
}

.item-grid>a {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

/* Tarjeta de Item Genérica */
.item-card {
  background-color: var(--md-sys-color-surface-container);
  border-radius: 1.25rem;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, border-radius 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 100%;
  flex-grow: 1;
}

.item-grid>a:hover .item-card {
  background-color: var(--md-sys-color-surface-container-high);
}

.item-grid>a:active .item-card {
  border-radius: 3rem;
}

/* Clase aplicada por JS para el contorno y forma del clic central */
.item-card.new-tab-opening {
  border-radius: 3rem;
  /* <-- AÑADIDO: asegura el cambio de forma */
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.item-card .card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

/* Botón de Volver */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 50rem;
  transition: background-color 0.2s ease, border-radius 0.2s ease-out;
}

.back-button:hover {
  background-color: var(--md-sys-color-surface-container-high);
}

.back-button:active {
  border-radius: 0.75rem;
}

.back-button .material-symbols-outlined {
  font-size: 1.2rem;
}

/* Botón de Píldora */
.btn-pill-action {
  border-radius: 50rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  min-height: calc(1.5em + 0.75rem + 8px);
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all .15s ease-in-out, border-radius .2s ease-in-out;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.btn-pill-action:hover {
  filter: brightness(0.95);
}

.btn-pill-action:active {
  filter: brightness(0.9);
  border-radius: 0.75rem;
}

.btn-pill-action .material-symbols-outlined {
  margin-right: 0.35rem;
  font-size: 1.2em;
  line-height: 1;
}

.btn-pill-action.no-text .material-symbols-outlined {
  margin-right: 0;
}

.btn-pill-lima {
  background-color: var(--md-sys-color-tertiary-container);
  border-color: transparent;
  color: var(--md-sys-color-on-tertiary-container);
}

.btn-pill-lima:hover {
  color: var(--md-sys-color-on-tertiary-container);
  filter: brightness(0.95);
}

/* Tablas Globales */
.table-container {
  border-radius: 0.5rem;
  overflow-x: auto;
  border: 1px solid var(--md-sys-color-outline-variant);
}

.table-global {
  width: 100%;
  margin-bottom: 0;
  color: var(--md-sys-color-on-surface);
  border-collapse: collapse;
}

.table-global thead th {
  vertical-align: bottom;
  border-bottom: 2px solid var(--md-sys-color-outline);
  background-color: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
}

.table-global tbody tr {
  transition: background-color 0.15s ease-in-out;
}

.table-global tbody tr:nth-of-type(odd) {
  background-color: var(--md-sys-color-surface-bright);
}

.table-global tbody tr:nth-of-type(even) {
  background-color: transparent;
}

.table-global tbody tr:hover {
  background-color: var(--md-sys-color-surface-container-high);
}

.table-global td {
  padding: 0.75rem 1rem;
  vertical-align: top;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  line-height: 1.5;
}

.table-global td:first-child {
  font-weight: 500;
}

/* Media Queries Globales */
@media (max-width: 992px) {
  .container-padded {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 768px) {
  .main-content .container-padded {
    gap: 1rem;
  }

  .page-title {
    font-size: 2.2rem;
  }
}

/* --- Adaptive Text Color on Images --- */
.adaptive-text-light {
  color: #ffffff !important;
  text-shadow: none;
}

.adaptive-text-dark {
  color: #1d1b20 !important;
  text-shadow: none;
}