/* style.css */

body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f9f9f9;
  color: #333;
}

header {
  background-color: #2c3e50;
  color: white;
  padding: 1rem;
  text-align: center;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}

.tab-menu {
  display: flex;
  justify-content: center;
  background-color: #ecf0f1;
  border-bottom: 1px solid #ccc;
}

.tab-button {
  padding: 1rem 2rem;
  border: none;
  background: #bdc3c7;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  color: #2c3e50;
  font-weight: bold;
  border-radius: 4px 4px 0 0;
  margin: 0 0.25rem;
}

.tab-button:hover {
  background-color: #d0d0d0;
}

.tab-button.active {
  background-color: #ffffff;
  color: #000;
  border-bottom: 3px solid #3498db;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

textarea {
  width: 100%;
  font-size: 1.1rem;
  padding: 0.5rem;
  margin: 0.5rem 0 1rem;
  resize: vertical;
  border: 1px solid #ccc;
  border-radius: 4px;
}

button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background-color: #3498db;
  color: white;
  border: none;
  cursor: pointer;
  margin-bottom: 1rem;
  border-radius: 4px;
}

.svg-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.25rem;
}

.svg-output {
  display: block;
  margin-bottom: 1rem;
}

.svg-output img {
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  display: inline-block;
  vertical-align: top;
}

.cipher-output {
  background-color: #f4f4f4;
  padding: 1rem;
  font-family: monospace;
  white-space: pre-wrap;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.key-table,
.decrypt-button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.key-entry {
  text-align: center;
  font-size: 1rem;
}

.key-entry img,
.decrypt-button-grid img {
  width: 48px;
  display: block;
  margin: 0.25rem auto;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.decrypt-button-grid img:hover {
  transform: scale(1.2);
}

.decrypt-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 8px;
  justify-items: center;
  align-items: center;
  margin-top: 1rem;
}

.decrypt-grid .grid-cell {
  width: 60px;
  height: 80px;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-align: center;
  font-size: 0.9rem;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}

.decrypt-grid .grid-cell img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

footer {
  background-color: #f0f0f0;
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
  font-size: 0.9rem;
}

.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: background 0.3s ease;
}

.modal.show {
  display: flex !important;
}

.modal-img {
  max-width: 80vw;
  max-height: 80vh;
  width: auto !important;
  height: auto !important;
  border: 4px solid white;
  background: white;
  border-radius: 8px;
}

@media (max-width: 600px) {
  .modal-img {
    max-width: 95vw;
    max-height: 80vh;
  }
}

.modal-img.zoomed {
  width: 300px !important;
  height: auto !important;
  max-width: none;
  max-height: none;
}

.toast {
  margin-top: 0.5rem;
  background: #4caf50;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  display: none;
  text-align: center;
}

.toast.show {
  display: block;
}

.input-guide {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  color: #666;
  font-size: 0.9rem;
}

.char-count {
  font-weight: bold;
  color: #3498db;
}

.validation-feedback {
  display: none;
  background-color: #fff3cd;
  color: #856404;
  padding: 0.75rem;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.validation-feedback.show {
  opacity: 1;
}
