/* src/styles.css */
:root {
  --primary-color: #0040a5;
  --secondary-color: #989898;
  --background-color: #f8f9fa;
  --text-color: #212529;
  --border-color: #dee2e6;
  --success-color: #38b000;
  --card-background: #fff;
  --shadow: 0 4px 6px #0000001a;
  color-scheme: light dark;
  color: var(--text-color);
  background-color: var(--background-color);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Oxygen, Open Sans, sans-serif;
  font-weight: 400;
  line-height: 1.5;
}

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

body {
  display: grid;
  place-items:  center;
  overflow: auto;
  height: 100dvh;
  font-size: 1.2rem;
}

input, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

#app {
  overflow: auto;
  width: 100%;
  height: 100%;
  margin: 0 auto;
}

.app-container {
  display: flex;
  background-color: var(--card-background);
  box-shadow: var(--shadow);
  overflow: auto;
  flex-direction: column;
  width: 100%;
  max-width: 40rem;
  height: 100%;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-direction: row;
}

header h1 {
  margin: 1rem;
  font-size: 1.2rem;
}

header nav {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  font-size: inherit;
  padding-right: 1rem;
  font-family: inherit;
}

header nav button {
  color: #000;
  cursor: pointer;
  background: none;
  border: none;
  margin: 0;
  padding: 0;
}

header nav button:hover:not(:disabled) {
  background-color: #ffffff4d;
}

header nav button.active {
  background-color: #fff6;
  font-weight: bold;
}

header nav button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

main {
  display: flex;
  overflow: auto;
  flex-direction: column;
  flex: 1;
}

footer {
  display: flex;
  justify-content: space-between;
  text-align: center;
  border-top: 1px solid var(--border-color);
  color: #6c757d;
  padding: .5rem 1rem;
  font-size: .9rem;
}

footer a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  padding: 0 .5rem;
}

.input-mode, .edit-mode {
  text-align: center;
  padding: 1rem;
}

:is(.input-mode, .edit-mode) h2 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

:is(.input-mode, .edit-mode) form {
  display: flex;
  gap: .5rem;
  flex-direction: column;
}

:is(.input-mode, .edit-mode) form textarea {
  border: 1px solid var(--border-color);
  resize: vertical;
  border-radius: 4px;
  width: 100%;
  padding: .75rem;
  font-family: inherit;
  font-size: 1rem;
}

:is(.input-mode, .edit-mode) form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px #3a86ff33;
}

:is(.input-mode, .edit-mode) form .to {
  font-weight: bold;
}

:is(.input-mode, .edit-mode) .save-button {
  align-self: center;
  background-color: var(--success-color);
  color: #fff;
  cursor: pointer;
  display: inline-block;
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  padding: .5rem;
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1rem;
}

:is(.input-mode, .edit-mode) .save-button:hover {
  background-color: #2d9300;
}

.show-mode {
  display: flex;
  justify-content: center;
  flex-direction: column;
  flex-grow: 1;
  max-height: 100%;
}

.show-mode .text-display {
  text-align: center;
  overflow: scroll;
  white-space: normal;
  word-break: break-word;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-direction: column;
  flex: 1;
  padding: 0 1rem;
  font-size: 1.5rem;
}

.show-mode .text-display p {
  margin: 0;
}

.show-mode a[lang="es"] {
  color: var(--primary-color);
  background-color: var(--primary-color);
  text-decoration: none;
  pointer-events: none;
  cursor: default;
}

.show-mode .revealed a[lang="es"] {
  pointer-events: auto;
  cursor: pointer;
  background-color: #0000;
}

.show-mode .buttons {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: .5rem 1rem;
}

.show-mode .buttons button {
  background-color: var(--secondary-color);
  color: #fff;
  cursor: pointer;
  display: inline-block;
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  padding: .5rem;
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1rem;
}

.show-mode .buttons .reveal-button {
  padding: .35rem .5rem .65rem;
}

.show-mode .fill {
  flex: 1;
}

.list-mode .search-input {
  width: 100%;
  margin-bottom: .5rem;
  padding: .3rem .5rem;
}

.list-mode .search-input input {
  font-family: inherit;
  font-size: inherit;
  border: 1px solid var(--border-color);
  border-radius: .25rem;
  width: 100%;
  padding: .3rem .5rem;
}

.list-mode .empty-list {
  text-align: center;
  padding: 1rem;
}

.list-mode ul {
  list-style: none;
  display: flex;
  gap: 0;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

.list-mode ul li {
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  padding: .5rem;
}

.list-mode ul li.current {
  border: 1px solid var(--primary-color);
  background-color: #0000000d;
}

.upload-mode {
  text-align: center;
  padding: 1rem;
}

.upload-mode input {
  margin-top: 1rem;
}

.show-mode.empty {
  display: grid;
  place-items: center;
  color: #6c757d;
  height: 200px;
  font-size: 1.2rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #121212;
    --text-color: #e9ecef;
    --border-color: #343a40;
    --card-background: #1e1e1e;
  }

  .text-display, .markdown-content pre, .markdown-content code, .markdown-content th {
    background-color: #2a2a2a;
  }
}
