/* ==========================================================================
   Idle Dad Game - Style System (Pure Vanilla CSS)
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131a2e;
  --bg-card: rgba(22, 30, 49, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  /* Primary & Accent Colors */
  --accent-gold: #fbbf24;
  --accent-gold-rgb: 251, 191, 36;
  --accent-coral: #f43f5e;
  --accent-coral-rgb: 244, 63, 94;
  --accent-green: #10b981;
  --accent-green-rgb: 16, 185, 129;
  --accent-blue: #3b82f6;
  --accent-blue-rgb: 59, 130, 246;

  /* Card Glassmorphism Effect */
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(12px);

  /* Fonts */
  --font-family: 'Noto Sans KR', 'Inter', sans-serif;
  --font-outfit: 'Outfit', sans-serif;
}

/* Base Styles & Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 10% 20%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(244, 63, 94, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#game-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

/* Custom Typography Utility */
.font-outfit {
  font-family: var(--font-outfit);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Glassmorphism Card Style */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  padding: 1.5rem;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Header Styles */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.logo-area h1 {
  font-family: var(--font-outfit);
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-coral) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.logo-area .version {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.utility-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* Main Stats Dashboard Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  transition: color 0.3s ease;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stat-specific colors */
.career .stat-value {
  color: var(--accent-blue);
}

.asset .stat-value {
  color: var(--accent-gold);
}

/* Progress Bars */
.progress-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.progress-fill.stress {
  background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-coral) 100%);
}

.progress-fill.harmony {
  background: linear-gradient(90deg, var(--accent-coral) 0%, var(--accent-green) 100%);
}

.progress-fill.affinity {
  background: linear-gradient(90deg, var(--accent-gold) 0%, var(--accent-green) 100%);
}

.progress-fill.quest {
  background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-gold) 100%);
}

/* Main Body Columns Layout */
.game-main {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

.game-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Tabs UI for Left Column */
.tabs-header {
  display: flex;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--bg-secondary);
  color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
}

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

.panel-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.75rem;
  background: rgba(59, 130, 246, 0.05);
  border-left: 3px solid var(--accent-blue);
  border-radius: 4px;
}

/* Quest List CSS */
.quest-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quest-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
}

.quest-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.quest-info-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.quest-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.quest-rewards {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

.reward-tag {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.reward-tag.gold {
  color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.1);
}

.reward-tag.stress {
  color: var(--accent-coral);
  background: rgba(244, 63, 94, 0.1);
}

.reward-tag.harmony {
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

.quest-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.2rem;
}

.quest-actions .progress-container {
  flex: 1;
  height: 12px;
}

/* Shop UI CSS */
.shop-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shop-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
  color: var(--text-main);
}

.shop-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.shop-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.shop-card-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.shop-card-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Kids Interactions Styling */
.kids-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.kids-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.kids-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.kid-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.kid-avatar {
  font-size: 2.5rem;
  background: rgba(255, 255, 255, 0.04);
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kid-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.kid-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.kid-affinity {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
}

.kid-affinity .mini-progress {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.kid-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.kid-buff {
  font-size: 0.75rem;
  color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px dashed rgba(251, 191, 36, 0.2);
  margin-top: 0.25rem;
}

.kid-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
}

.kid-actions .btn {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Buttons Styles */
.btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue) 0%, rgba(59, 130, 246, 0.7) 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
  background: linear-gradient(135deg, #4f8ff7 0%, rgba(59, 130, 246, 0.8) 100%);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-coral) 0%, rgba(244, 63, 94, 0.7) 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.2);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(244, 63, 94, 0.35);
  background: linear-gradient(135deg, #f5556e 0%, rgba(244, 63, 94, 0.8) 100%);
}

.btn-secondary {
  background: rgba(251, 191, 36, 0.08);
  color: var(--accent-gold);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-green) 0%, rgba(16, 185, 129, 0.7) 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

/* Log / Chat Console Area */
.log-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-grow: 1;
}

.log-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.log-container {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  padding: 1rem;
  font-size: 0.85rem;
  font-family: monospace;
  height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scroll-behavior: smooth;
}

.log-line {
  line-height: 1.4;
  opacity: 0;
  animation: logFadeIn 0.3s forwards;
  padding: 0.1rem 0;
  word-break: break-all;
}

.log-line.system {
  color: #3b82f6;
}

.log-line.earn {
  color: #10b981;
}

.log-line.warn {
  color: #fbbf24;
}

.log-line.danger {
  color: #f43f5e;
}

.log-line.family {
  color: #a78bfa;
}

/* Modals Overlay Base styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

#modal-title-icon {
  font-size: 1.6rem;
}

.modal-body {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.modal-illustration {
  font-size: 4.5rem;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-message-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px 12px 12px 0;
  padding: 1rem 1.25rem;
  flex-grow: 1;
  position: relative;
}

.modal-message-bubble p {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-footer .btn {
  width: 100%;
  padding: 0.85rem;
}

/* Mini-game specifics */
.mini-game-card {
  max-width: 450px;
}

.game-instruction {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.5rem;
}

.game-fail-chance {
  font-size: 0.85rem;
  text-align: center;
  font-weight: 600;
  color: var(--accent-coral);
  margin-bottom: 1rem;
}

.hide-spots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
}

.hide-spot-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
}

.hide-spot-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-gold);
  transform: translateY(-4px);
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.15);
}

/* Toast System */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: rgba(19, 26, 46, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--accent-blue);
  color: var(--text-main);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 250px;
  max-width: 380px;
  pointer-events: auto;
  animation: slideInToast 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             fadeOutToast 0.3s ease 2.7s forwards;
}

.toast.success { border-left-color: var(--accent-green); }
.toast.error { border-left-color: var(--accent-coral); }
.toast.warning { border-left-color: var(--accent-gold); }

/* Animation Keyframes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInToast {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOutToast {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

/* Shake Effect on Stress Overload */
.shake-element {
  animation: shakeAnimation 0.5s ease infinite;
}

@keyframes shakeAnimation {
  0%, 100% { transform: translate(0, 0); }
  10%, 30%, 50%, 70%, 90% { transform: translate(-3px, -2px); }
  20%, 40%, 60%, 80% { transform: translate(3px, 2px); }
}

/* Floating Pocket Money Text animation */
.floating-text {
  position: absolute;
  font-size: 0.95rem;
  font-weight: 800;
  pointer-events: none;
  animation: floatUpAndOut 1s ease-out forwards;
  z-index: 1500;
}

@keyframes floatUpAndOut {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-40px) scale(1.2); opacity: 0; }
}

/* Responsive Layout */
@media (max-width: 900px) {
  body {
    padding: 0.75rem;
  }
  
  #game-container {
    gap: 1rem;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .game-main {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .log-container {
    height: 180px;
  }
}

@media (max-width: 500px) {
  .logo-area h1 {
    font-size: 1.8rem;
  }
  
  .stats-bar {
    grid-template-columns: 1fr;
  }
  
  .stat-value {
    font-size: 1.4rem;
  }

  .kid-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
  }

  .kid-actions {
    flex-direction: row;
    width: 100%;
    gap: 0.5rem;
  }

  .kid-actions .btn {
    flex: 1;
  }
  
  .hide-spots-grid {
    grid-template-columns: 1fr;
  }
}
