/* ================================================================
   style.css - DWD Diary
   Minimal, language-agnostic, PC-first but responsive
   ================================================================ */

/* RESET & BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: white;
  min-height: 100vh;
  transition: background-color 0.3s ease;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* ================================================================
   TOP BAR
   ================================================================ */

.top-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border-radius: 40px;
  padding: 0.5rem 1rem;
}

.top-bar-icons {
  gap: 0.75rem;
}

.top-bar-history {
  gap: 0.5rem;
}

/* Icon buttons */
.icon-btn {
  background: #1a1e2e;
  border: none;
  font-size: 1.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #fff5e0;
}

.icon-btn:hover {
  background: #2a3550;
  transform: translateY(-2px);
}

.icon-btn:active {
  transform: translateY(0);
}

/* History buttons */
.history-btn {
  background: #1a1e2e;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #fff5e0;
  display: none;  /* Hidden by default, shown via JS */
}

.history-btn.visible {
  display: inline-block;
}

.history-btn:hover {
  background: #2a3550;
  transform: translateY(-2px);
}

.history-btn:active {
  transform: translateY(0);
}

/* ================================================================
   MAIN CONTENT & CARD
   ================================================================ */

.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.card {
  background: white;
  border-radius: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 3rem 4rem;
  text-align: center;
  max-width: 90%;
  width: 500px;
  transition: all 0.2s ease;
}

/* Mode containers */
.mode-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* Input mode */
.word-input {
  font-size: 2.5rem;
  font-family: inherit;
  text-align: center;
  border: none;
  border-bottom: 2px solid #ddd;
  padding: 0.5rem 1rem;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease;
}

.word-input:focus {
  border-bottom-color: #1a1e2e;
}

.submit-btn {
  background: #1a1e2e;
  border: none;
  font-size: 1.8rem;
  padding: 0.5rem 1.5rem;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #fff5e0;
}

.submit-btn:hover {
  background: #2a3550;
  transform: scale(1.02);
}

/* View mode */
.word-display {
  font-size: 3rem;
  font-weight: 500;
  color: #1a1e2e;
  word-break: break-word;
}

.date-display {
  font-size: 1rem;
  color: #888;
  margin-top: 0.5rem;
}

/* ================================================================
   BOTTOM BAR (last 5 entries)
   ================================================================ */

.bottom-bar {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border-radius: 40px;
  margin-top: 0.5rem;
}

.bottom-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: transform 0.1s ease;
  padding: 0.25rem;
}

.bottom-entry:hover {
  transform: translateY(-3px);
}

.bottom-color {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bottom-word {
  font-size: 0.85rem;
  color: #333;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================================================================
   HELP MODAL
   ================================================================ */

.help-modal {
  border: none;
  border-radius: 24px;
  max-width: 600px;
  width: 90%;
  padding: 1.5rem;
  background: white;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.help-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 500;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #333;
}

.modal-language {
  margin-bottom: 1rem;
}

.modal-language label {
  margin-right: 0.5rem;
  font-size: 0.9rem;
  color: #555;
}

.modal-language select {
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: white;
}

.modal-content {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #333;
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: monospace;
}

/* ================================================================
   HISTORY VIEW
   ================================================================ */

.history-view {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.history-stripe-container {
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  padding: 0.5rem;
}

.history-stripe-row {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: 0.25rem;
}

.history-stripe-row:last-child {
  margin-bottom: 0;
}

.history-slice {
  display: inline-block;
  width: 3px;
  height: 40px;
  flex-shrink: 0;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.history-item:hover {
  background: rgba(255, 255, 255, 1);
}

.history-color {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-word {
  font-size: 1.1rem;
  font-weight: 500;
  flex: 1;
}

.history-date {
  font-size: 0.85rem;
  color: #888;
  font-family: monospace;
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */

.hidden {
  display: none !important;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 600px) {
  .app-container {
    padding: 0.75rem;
  }
  
  .card {
    padding: 2rem 1.5rem;
    width: 95%;
  }
  
  .word-input {
    font-size: 1.8rem;
  }
  
  .word-display {
    font-size: 2.2rem;
  }
  
  .bottom-bar {
    gap: 0.8rem;
  }
  
  .bottom-color {
    width: 32px;
    height: 32px;
  }
  
  .bottom-word {
    font-size: 0.7rem;
    max-width: 55px;
  }
  
  .icon-btn {
    font-size: 1.2rem;
    padding: 0.4rem 0.6rem;
  }
  
  .history-btn {
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
  }

  .top-bar {
    padding: 0.4rem 0.8rem;
  }
}

@media (max-width: 400px) {
  .bottom-bar {
    gap: 0.5rem;
  }
  
  .bottom-color {
    width: 28px;
    height: 28px;
  }
  
  .history-item {
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  .history-word {
    font-size: 0.9rem;
  }
}
