/* Fantasy Setting Helper - Custom Styling */

:root {
  --color-bg-dark: #0f0a0a;
  --color-bg-deep: #160e0e;
  --color-parchment: #f4ebd0;
  --color-parchment-dark: #2a1b1b;
  --color-gold: #d4af37;
  --color-gold-hover: #f3e5ab;
  --color-accent-purple: #8a2be2;
  --color-accent-teal: #008b8b;
  --color-accent-red: #8b0000;
  --color-text-bright: #ebdcb9;
  --color-text-muted: #a69685;
  --font-fantasy: 'Cinzel', 'Nanum Myeongjo', serif;
  --font-sans: 'Noto Sans KR', sans-serif;
  --shadow-magic: 0 0 15px rgba(212, 175, 55, 0.3);
  --shadow-magic-hover: 0 0 25px rgba(212, 175, 55, 0.6);
  --border-radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--color-bg-dark);
  background-image: 
    radial-gradient(circle at 50% 0%, #301717 0%, var(--color-bg-dark) 70%),
    radial-gradient(circle at 0% 100%, #151b24 0%, var(--color-bg-dark) 50%);
  color: var(--color-text-bright);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* Background Magic Circles */
.magic-bg-circle {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  border: 1px double rgba(212, 175, 55, 0.15);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: rotateCircle 60s linear infinite;
}

.magic-bg-circle::after {
  content: '';
  position: absolute;
  top: 20px; left: 20px; right: 20px; bottom: 20px;
  border: 2px dashed rgba(212, 175, 55, 0.08);
  border-radius: 50%;
}

.magic-bg-circle-2 {
  position: absolute;
  bottom: -200px;
  right: -100px;
  width: 400px;
  height: 400px;
  border: 1px dashed rgba(212, 175, 55, 0.1);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: rotateCircle 90s linear reverse infinite;
}

@keyframes rotateCircle {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

.opacity-light {
  opacity: 0.7;
}

/* App Layout Container */
.app-container {
  width: 100%;
  max-width: 480px; /* Mobile first / responsive */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 80px 16px; /* Footer navigation buffer */
  position: relative;
  z-index: 10;
}

/* Header */
.app-header {
  text-align: center;
  margin-top: 10px;
  margin-bottom: 20px;
  position: relative;
}

.header-logo {
  display: inline-block;
  font-size: 2.2rem;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.5));
  animation: floatBook 3s ease-in-out infinite;
}

@keyframes floatBook {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.app-title {
  font-family: var(--font-fantasy);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--color-gold);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.app-subtitle {
  font-size: 0.9rem;
  letter-spacing: 3px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.header-decoration {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  gap: 10px;
}

.line-deco {
  height: 1px;
  width: 50px;
  background: linear-gradient(to right, transparent, var(--color-gold), transparent);
}

.rune-char {
  font-family: var(--font-fantasy);
  color: var(--color-gold);
  font-size: 0.8rem;
  opacity: 0.6;
}

/* Navigation Tabs */
.app-nav {
  display: flex;
  background: rgba(42, 27, 27, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.nav-tab {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 12px 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  transition: all 0.3s ease;
  border-bottom: 2px solid transparent;
}

.nav-tab:hover {
  color: var(--color-text-bright);
  background: rgba(212, 175, 55, 0.05);
}

.nav-tab.active {
  color: var(--color-gold);
  border-bottom: 2px solid var(--color-gold);
  background: rgba(212, 175, 55, 0.08);
}

.tab-icon {
  font-size: 1.25rem;
}

.tab-label {
  font-weight: 500;
}

/* Tab Contents */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Panel Card & Form elements */
.panel-card {
  background-color: var(--color-parchment-dark);
  background-image: radial-gradient(circle at 100% 100%, rgba(212, 175, 55, 0.05) 0%, transparent 60%);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.panel-header {
  margin-bottom: 16px;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.15);
  padding-bottom: 12px;
}

.panel-header h2 {
  font-family: var(--font-fantasy);
  font-size: 1.15rem;
  color: var(--color-gold);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.control-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.control-group label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.control-group select, 
.control-group input,
textarea {
  background-color: rgba(15, 10, 10, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 4px;
  color: var(--color-text-bright);
  padding: 10px 12px;
  font-size: 0.9rem;
  outline: none;
  font-family: var(--font-sans);
  transition: all 0.3s ease;
}

.control-group select:focus, 
.control-group input:focus,
textarea:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}

/* Buttons */
.btn-fantasy {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, #4d1c1c 0%, #2a1111 100%);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  padding: 14px 20px;
  font-family: var(--font-fantasy);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-magic);
}

.btn-fantasy:hover {
  color: var(--color-gold-hover);
  border-color: var(--color-gold-hover);
  background: linear-gradient(135deg, #612424 0%, #3a1818 100%);
  box-shadow: var(--shadow-magic-hover);
  transform: translateY(-1px);
}

.btn-fantasy:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-magic);
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-25deg);
  animation: shineBtn 4s infinite;
}

@keyframes shineBtn {
  0% { left: -100%; }
  30% { left: 150%; }
  100% { left: 150%; }
}

.btn-secondary {
  flex: 1;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--color-text-bright);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--color-gold);
}

.btn-danger {
  background: rgba(139, 0, 0, 0.15);
  border: 1px solid rgba(139, 0, 0, 0.4);
  color: #ff9999;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(139, 0, 0, 0.3);
  border-color: #ff3333;
}

.flex-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Result Cards & Displays */
.result-card {
  position: relative;
  background-color: var(--color-parchment-dark);
  background-image: 
    radial-gradient(circle at 0% 0%, rgba(212, 175, 55, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 100% 0%, rgba(212, 175, 55, 0.03) 0%, transparent 40%);
  border: 2px solid var(--color-gold);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-top: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

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

.card-border-decoration {
  position: absolute;
  top: 4px; left: 4px; right: 4px; bottom: 4px;
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 6px;
  pointer-events: none;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 12px;
  margin-bottom: 16px;
  gap: 12px;
}

.fantasy-title {
  font-family: var(--font-fantasy);
  font-size: 1.35rem;
  color: var(--color-gold);
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.char-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: block;
  margin-top: 2px;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-attribute {
  background-color: rgba(138, 43, 226, 0.15);
  border-color: var(--color-accent-purple);
  color: #d8b2ff;
}

.result-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.info-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.info-value {
  font-family: 'Nanum Myeongjo', serif;
  font-size: 0.95rem;
  color: #f3eee3;
  line-height: 1.5;
  background: rgba(15, 10, 10, 0.4);
  padding: 8px 10px;
  border-left: 2px solid var(--color-gold);
  border-radius: 0 4px 4px 0;
}

.incantation-box {
  background-color: rgba(15, 10, 10, 0.8);
  border: 1px dashed rgba(212, 175, 55, 0.4);
  border-radius: 6px;
  padding: 14px;
  position: relative;
  text-align: center;
}

.incantation-title {
  font-size: 0.75rem;
  color: var(--color-gold);
  display: block;
  margin-bottom: 6px;
}

.incantation-text {
  font-family: 'Nanum Myeongjo', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: #fff2cc;
  line-height: 1.6;
}

.result-footer {
  display: flex;
  gap: 10px;
  border-top: 1px solid rgba(212, 175, 55, 0.15);
  padding-top: 16px;
}

.btn-action {
  flex: 1;
  background: rgba(15, 10, 10, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--color-text-bright);
  padding: 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-action:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.btn-save-journal {
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.btn-save-journal:hover {
  background: var(--color-gold);
  color: var(--color-bg-dark);
}

/* Journal View & Grid */
.journal-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.journal-card {
  position: relative;
  background: var(--color-parchment-dark);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.journal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  padding-bottom: 6px;
}

.journal-card-title {
  font-family: var(--font-fantasy);
  font-size: 1.05rem;
  color: var(--color-gold);
  font-weight: 700;
}

.btn-card-delete {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color 0.2s;
  padding: 4px;
}

.btn-card-delete:hover {
  color: #ff5555;
}

.journal-card-body {
  font-size: 0.85rem;
  color: var(--color-text-bright);
}

.journal-card-body p {
  margin-bottom: 6px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  border: 1px dashed rgba(212, 175, 55, 0.15);
  border-radius: var(--border-radius);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(26, 15, 15, 0.95);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.85rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* Import Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-content {
  background: var(--color-parchment-dark);
  border: 2px solid var(--color-gold);
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 400px;
  padding: 20px;
  box-shadow: var(--shadow-magic-hover);
}

.modal-content h3 {
  font-family: var(--font-fantasy);
  color: var(--color-gold);
  margin-bottom: 10px;
  font-size: 1.15rem;
}

.modal-content p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.modal-content textarea {
  width: 100%;
  height: 120px;
  resize: none;
  margin-bottom: 16px;
  font-size: 0.8rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-fantasy-small {
  background: linear-gradient(135deg, #4d1c1c 0%, #2a1111 100%);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  padding: 6px 12px;
  font-family: var(--font-fantasy);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-fantasy-small:hover {
  background: linear-gradient(135deg, #612424 0%, #3a1818 100%);
  color: var(--color-gold-hover);
}

/* Footer Credit */
.app-footer {
  text-align: center;
  margin-top: auto;
  padding: 24px 0 10px 0;
}

.footer-decoration {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(212, 175, 55, 0.2), transparent);
  margin-bottom: 12px;
}

.footer-credit {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
