/* ==========================================================================
   Pakujaya Language - Colorful Light Mode Dictionary
   Warm layered surfaces, vivid accent palette, playful but legible
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --page-bg: #fef7f0;
  --surface-1: #ffffff;
  --surface-2: #fdf4ee;
  --surface-3: #f6efe8;
  --border-light: rgba(0, 0, 0, 0.07);
  --border-mid: rgba(0, 0, 0, 0.12);

  --text-primary: #1a1523;
  --text-secondary: #544d56;
  --text-muted: #8b8492;

  --coral: #f2613f;
  --coral-soft: #fef0ec;
  --violet: #7c5cfc;
  --violet-soft: #f0ecfe;
  --teal: #0ea5a0;
  --teal-soft: #e6f7f6;
  --amber: #e5930b;
  --amber-soft: #fef5e4;
  --rose: #e5457a;
  --rose-soft: #fdeef3;
  --sky: #2b8ddb;
  --sky-soft: #e9f3fc;

  --gradient-hero: linear-gradient(135deg, #f2613f 0%, #e5457a 40%, #7c5cfc 100%);
  --gradient-btn: linear-gradient(135deg, #7c5cfc 0%, #e5457a 100%);
  --gradient-btn-hover: linear-gradient(135deg, #6a4ce8 0%, #d93d6e 100%);

  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-btn: 0 2px 8px rgba(124, 92, 252, 0.35);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--page-bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Container ── */
.app-shell {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 18px 80px;
}

/* ── Hero Header ── */
.hero-header {
  background: var(--gradient-hero);
  border-radius: var(--radius-lg);
  padding: 28px 26px 24px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  color: #ffffff;
}

/* decorative circles inside the header for visual depth */
.hero-header::before {
  content: "";
  position: absolute;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  top: -70px;
  right: -40px;
  pointer-events: none;
}

.hero-header::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  bottom: -30px;
  left: 20px;
  pointer-events: none;
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-logo {
  width: 46px;
  height: 46px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  flex-shrink: 0;
}

.hero-text h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero-text p {
  font-size: 0.82rem;
  opacity: 0.85;
  margin-top: 2px;
  font-weight: 500;
}

.btn-add-hero {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--violet);
  background: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.btn-add-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
  color: var(--coral);
}

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

.btn-add-hero:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

/* ── Flash Notice ── */
.flash-toast {
  background: var(--teal-soft);
  border: 1px solid rgba(14, 165, 160, 0.25);
  color: #0d7d79;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Search & Translate Section ── */
.search-card {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.direction-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  margin-bottom: 14px;
}

.lang-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-label .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
}

.lang-label.target-lang {
  color: var(--violet);
}

.lang-label.target-lang .dot {
  background: var(--violet);
}

.btn-swap-dir {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-swap-dir:hover {
  color: var(--violet);
  border-color: var(--violet);
  background: var(--violet-soft);
}

.btn-swap-dir:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* Search Box */
.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon-box {
  position: absolute;
  left: 16px;
  color: var(--coral);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.search-field {
  width: 100%;
  padding: 14px 44px 14px 48px;
  font-size: 1rem;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.search-field::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-field:focus {
  outline: none;
  border-color: var(--violet);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(124, 92, 252, 0.12);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.search-clear-btn:hover {
  color: var(--text-primary);
  background: var(--border-light);
}

.search-clear-btn.active {
  display: flex;
}

/* Instant Match Result */
.instant-result {
  margin-top: 14px;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: none;
  border-left: 4px solid var(--violet);
  background: var(--violet-soft);
}

.instant-result.visible {
  display: block;
  animation: slideDown 0.2s ease;
}

.instant-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--violet);
  margin-bottom: 4px;
}

.instant-word {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.instant-meaning {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Word List Section ── */
.list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 14px;
}

.list-heading {
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.list-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--coral);
  background: var(--coral-soft);
  border: 1px solid rgba(242, 97, 63, 0.2);
  padding: 3px 12px;
  border-radius: var(--radius-full);
}

/* Word Cards */
.words-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Color stripe rotation for visual variety */
.word-card {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: stretch;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.word-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-color: var(--border-mid);
}

/* Colored left accent stripe, cycles through 5 hues */
.word-card .card-accent {
  width: 5px;
  flex-shrink: 0;
}

.word-card:nth-child(5n+1) .card-accent { background: var(--coral); }
.word-card:nth-child(5n+2) .card-accent { background: var(--violet); }
.word-card:nth-child(5n+3) .card-accent { background: var(--teal); }
.word-card:nth-child(5n+4) .card-accent { background: var(--amber); }
.word-card:nth-child(5n+5) .card-accent { background: var(--rose); }

.card-body {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-text {
  flex: 1;
}

.card-word {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.card-def {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Card Action Buttons */
.card-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--surface-2);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.icon-btn:hover {
  color: var(--violet);
  border-color: var(--violet);
  background: var(--violet-soft);
  transform: scale(1.08);
}

.icon-btn.del-btn:hover {
  color: var(--rose);
  border-color: var(--rose);
  background: var(--rose-soft);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 1px;
}

/* ── Empty State ── */
.empty-plate {
  background: var(--surface-1);
  border: 2px dashed var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 48px 20px;
  text-align: center;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-plate-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--amber-soft);
  border: 1px solid rgba(229, 147, 11, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  margin-bottom: 4px;
}

.empty-plate-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-plate-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 260px;
}

.btn-action-color {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--gradient-btn);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: all 0.2s ease;
}

.btn-action-color:hover {
  background: var(--gradient-btn-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(124, 92, 252, 0.45);
}

.btn-action-color:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* ── Modals ── */
.modal-layer {
  position: fixed;
  inset: 0;
  background: rgba(26, 21, 35, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
}

.modal-layer.open {
  display: flex;
  animation: fadeIn 0.12s ease;
}

.modal-box {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: popUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-topbar {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
}

.modal-title {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-x-btn {
  background: var(--surface-1);
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  transition: all 0.12s ease;
}

.modal-x-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.modal-form-area {
  padding: 22px;
}

.field-block {
  margin-bottom: 18px;
}

.field-block:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.95rem;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition: all 0.18s ease;
}

.field-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.field-input:focus {
  outline: none;
  border-color: var(--violet);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(124, 92, 252, 0.1);
}

.field-input.has-error {
  border-color: #ef4444 !important;
  background: #fff8f8 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
  animation: shake 0.3s ease;
}

/* Modal Inline Feedback Alert */
.modal-feedback-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 14px;
  animation: slideDown 0.2s ease;
}

.modal-feedback-alert.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1.5px solid #fca5a5;
}

.modal-feedback-alert.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1.5px solid #6ee7b7;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.modal-footer-bar {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  background: var(--surface-2);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-cancel {
  padding: 9px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-cancel:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.btn-delete {
  padding: 9px 16px;
  font-size: 0.86rem;
  font-weight: 700;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--rose) 0%, var(--coral) 100%);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(229, 69, 122, 0.3);
  transition: all 0.15s ease;
}

.btn-delete:hover {
  opacity: 0.9;
  box-shadow: 0 4px 14px rgba(229, 69, 122, 0.4);
}

/* ── Flash Notifications ── */
.flash-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-left: 4px solid #10b981;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.25s ease;
}

.flash-toast.flash-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--rose);
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popUp {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Mobile Adjustments ── */
@media (max-width: 600px) {
  .app-shell {
    padding: 16px 12px 60px;
  }

  .hero-header {
    padding: 22px 18px 20px;
    border-radius: var(--radius-md);
  }

  .hero-row {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .btn-add-hero {
    justify-content: center;
    width: 100%;
  }

  .hero-text h1 {
    font-size: 1.25rem;
  }

  .word-card .card-body {
    padding: 12px 14px;
  }

  .card-word {
    font-size: 1.02rem;
  }
}
