@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Roboto:wght@400;500;700&display=swap');

:root {
  --font-body: 'Roboto', sans-serif;
  --font-heading: 'Press Start 2P', cursive;

  /* 🎨 Applied Color Palette */
  --color-bg-parchment: #E6D3A3;
  --color-bg-off-white: #F9F4E3;
  --color-text-brown: #4B2E2E;
  --color-text-charcoal: #333333;
  --color-accent-blue: #00AEEF;
  --color-accent-gold: #F4C542;
  --color-highlight-orange: #E5B87A;
  --color-accent-red: #e94560;
  --color-green: #4ade80;

  --border-radius-sm: 5px;
  --border-radius-md: 8px;
  --border-radius-lg: 10px;
  --transition-speed: 0.2s ease;
  
  /* Dynamic Enhancement: Added a slightly longer transition for animations */
  --transition-speed-slow: 0.3s ease;
}

/* Dynamic Enhancement: Added keyframes for modal animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}


*, *::before, *::after { box-sizing: border-box; }
body, html {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background-color: var(--color-bg-parchment);
  color: var(--color-text-charcoal);
  overflow-x: hidden;
}

header {
  padding: 22px 0 0 0;
}
.center-title {
  text-align: center;
  font-family: var(--font-heading);
  color: var(--color-accent-gold);
  font-size: 36px;
  margin: 0;
  text-shadow: 2px 2px var(--color-text-brown);
}

.navbar.horizontal-navbar {
  width: 100%;
  background-color: var(--color-text-brown);
  border-bottom: 2px solid var(--color-highlight-orange);
  margin-bottom: 20px;
  /* Dynamic Enhancement: Add a shadow for depth */
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.navbar-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap; /* Allow nav items to wrap on small screens */
}

.nav-item .nav-link {
  display: flex;
  align-items: center;
  padding: 16px 30px;
  font-size: 19px;
  color: var(--color-accent-gold);
  font-family: var(--font-heading);
  text-decoration: none;
  /* Dynamic Enhancement: Be specific with transitions, not 'all' */
  transition: color var(--transition-speed), background-color var(--transition-speed), transform var(--transition-speed);
  border-radius: var(--border-radius-md);
  outline: none;
  position: relative; /* For pseudo-elements if needed */
}

/* Dynamic Enhancement: Use :focus-visible for accessibility */
.nav-item .nav-link:focus-visible {
  outline: 2px solid var(--color-accent-gold);
  outline-offset: 2px;
}

.nav-item .nav-link i {
  margin-right: 10px;
  font-size: 20px;
  /* Dynamic Enhancement: Transition the icon color too */
  transition: color var(--transition-speed);
}

.nav-item .nav-link:hover,
.nav-item .nav-link.active {
  color: var(--color-accent-blue);
  background: rgba(244, 197, 66, 0.1);
  /* Dynamic Enhancement: Subtle lift on hover */
  transform: translateY(-2px);
}

/* Dynamic Enhancement: 'Pressed' state for nav links */
.nav-item .nav-link:active {
  transform: translateY(0);
}

.nav-item .nav-link:hover i,
.nav-item .nav-link.active i {
  color: var(--color-accent-blue);
}

/* Dashboard Layout */
.container {
  display: flex;
  min-height: 100vh;
}

aside {
  width: 270px;
  background-color: var(--color-bg-off-white);
  border-right: 2px solid var(--color-highlight-orange);
  padding: 20px;
  overflow-y: auto;
  min-height: calc(100vh - 60px);
  /* Dynamic Enhancement: Transition for potential sidebar toggling */
  transition: width var(--transition-speed-slow), transform var(--transition-speed-slow);
  flex-shrink: 0; /* Prevent sidebar from shrinking */
}

.player-profile h2 {
  font-family: var(--font-heading);
  color: var(--color-text-brown);
  font-size: 14px;
  margin-bottom: 15px;
}

.player-stats {
  background-color: var(--color-text-brown);
  padding: 15px;
  border-radius: var(--border-radius-md);
  margin-bottom: 20px;
  /* Dynamic Enhancement: Add shadow */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.player-level {
  font-size: 18px;
  font-weight: bold;
  color: var(--color-accent-gold);
  margin-bottom: 10px;
}

.xp-bar-container {
  width: 100%;
  height: 20px;
  background-color: var(--color-bg-parchment);
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--color-accent-red);
  padding: 2px;
  margin-bottom: 8px;
}
.xp-bar {
  height: 100%;
  background-color: var(--color-accent-gold);
  border-radius: 3px;
  /* Dynamic Enhancement: A slightly slower, smoother XP bar fill */
  transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  width: 0%;
}

.xp-text {
  font-size: 12px;
  color: var(--color-bg-off-white); /* Changed for contrast on brown bg */
  text-align: center;
}

.achievements-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.achievement {
  display: flex;
  align-items: center;
  padding: 8px;
  margin-bottom: 8px;
  background-color: rgba(75, 46, 46, 0.1); /* Lighter brown */
  border-radius: var(--border-radius-sm);
  opacity: 0.6;
  /* Dynamic Enhancement: Transition more properties */
  transition: opacity var(--transition-speed), background-color var(--transition-speed), transform var(--transition-speed);
}
.achievement.unlocked {
  opacity: 1;
  background-color: var(--color-text-brown); /* Make unlocked stand out */
}
/* Unlocked achievements should have white text */
.achievement.unlocked .achievement-name {
    color: var(--color-bg-off-white);
}
/* Locked achievements have brown text */
.achievement .achievement-name {
    color: var(--color-text-brown);
}


/* Dynamic Enhancement: Add hover effect to achievements */
.achievement:hover {
  transform: translateX(5px);
  background-color: rgba(75, 46, 46, 0.2);
}
.achievement.unlocked:hover {
    background-color: #3a2222; /* Slightly lighter brown */
}


.achievement-icon {
  margin-right: 10px;
  font-size: 16px;
  color: var(--color-accent-gold);
}


main {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}
/*
  This section for quest-board, search, etc. is not
  currently in the HTML, but is safe to leave here 
  in case you add it back.
*/
.main-content {
  display: flex;
  gap: 20px;
  height: calc(100vh - 180px);
}
.quest-board {
  flex: 0 0 65%;
  background-color: var(--color-bg-off-white);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.quest-board h2 {
  font-family: var(--font-heading);
  color: var(--color-text-brown);
  font-size: 16px;
  margin-bottom: 20px;
}
.quest-search {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
#quest-search-input {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--color-highlight-orange);
  background-color: var(--color-bg-parchment);
  color: var(--color-text-brown);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}
#quest-search-input::placeholder {
  color: var(--color-text-brown);
  opacity: 0.7;
}
#quest-search-input:focus {
  border-color: var(--color-accent-gold);
  box-shadow: 0 0 0 3px rgba(244, 197, 66, 0.3);
}
#search-quests-btn {
  background-color: var(--color-accent-red);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  transition: background-color var(--transition-speed), color var(--transition-speed), transform var(--transition-speed);
}
#search-quests-btn:hover {
  background-color: var(--color-accent-gold);
  color: var(--color-text-brown);
  transform: translateY(-2px);
}
#search-quests-btn:active {
  transform: translateY(0) scale(0.98);
}
.add-quest {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding: 15px;
  background-color: var(--color-text-brown);
  border-radius: var(--border-radius-md);
}
.add-quest input, .add-quest select {
  flex: 1;
  min-width: 110px;
  padding: 8px;
  border: 1px solid var(--color-highlight-orange);
  background-color: var(--color-bg-parchment);
  color: var(--color-text-brown);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}
.add-quest input:focus, .add-quest select:focus {
  border-color: var(--color-accent-gold);
  box-shadow: 0 0 0 3px rgba(244, 197, 66, 0.3);
}
#add-quest-btn {
  background-color: var(--color-accent-red);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  transition: background-color var(--transition-speed), color var(--transition-speed), transform var(--transition-speed);
}
#add-quest-btn:hover { 
  background-color: var(--color-accent-gold); 
  color: var(--color-text-brown);
  transform: translateY(-2px);
}
#add-quest-btn:active {
  transform: translateY(0) scale(0.98);
}
.quest-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.quest-card {
  background-color: var(--color-text-brown);
  padding: 15px;
  border-radius: var(--border-radius-md);
  border-left: 4px solid var(--color-accent-red);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.quest-card:hover { 
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.quest-card h3 { color: var(--color-accent-gold); margin: 0 0 10px 0; font-size: 16px;}
.quest-card p { color: var(--color-bg-off-white); margin: 5px 0; font-size: 14px;}
.complete-quest-btn {
  background-color: var(--color-green);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  margin-top: 10px;
  transition: background-color var(--transition-speed), transform var(--transition-speed);
}
.complete-quest-btn:hover { 
  background-color: #22c55e;
  transform: scale(1.03);
}
.complete-quest-btn:active {
  transform: scale(0.98);
}
.profile-section {
  flex: 0 0 30%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.level-profile-btn {
  background: none;
  border: none;
  cursor: pointer;
  margin: 0 auto 16px auto;
  display: flex;
  justify-content: center;
  padding: 0;
  border-radius: 16px;
  outline: none;
}
.badge-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--color-accent-blue), var(--color-accent-gold));
  border: 4px solid var(--color-accent-blue);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 32px;
  color: var(--color-text-brown);
  box-shadow: 0 2px 14px rgba(75, 46, 46, 0.15);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
.badge-icon span {
  font-family: var(--font-heading);
  font-size: 32px;
  color: var(--color-text-brown);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}
.level-profile-btn:hover .badge-icon,
.level-profile-btn:focus-visible .badge-icon {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(75, 46, 46, 0.25);
}
.level-profile-btn:active .badge-icon {
  transform: scale(1.05);
}

/* --- Styles for Your Dashboard Cards --- */

/* This is the wrapper for ALL cards */
.dashboard-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* This styles the Welcome Card ONLY */
.dashboard-card.welcome-card {
  background-color: var(--color-bg-off-white);
  padding: 20px;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border: 1px solid var(--color-highlight-orange);
  text-align: center;
}

/* This is the grid for the 4 feature cards */
.features-grid {
  display: grid;
  grid-template-columns: 1fr; /* 1 column on mobile by default */
  gap: 20px;
}

/* NEW STYLES START HERE
  These target the 4 feature cards
*/

/* This styles the BLUE card base */
.features-grid .dashboard-card {
  background-color: #EADDCA;
  border-radius: var(--border-radius-lg);
  /* Heavier shadow inspired by your image */
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.2), 0 8px 10px -6px rgba(0,0,0,0.2);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
  /* Use flexbox to space the header, description, and footer */
  display: flex;
  flex-direction: column;
  min-height: 250px; /* Give cards a consistent height */
}

.features-grid .dashboard-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 30px -5px rgba(0,0,0,0.25), 0 10px 15px -6px rgba(0,0,0,0.25);
}

/* This styles the "lifted" white header */
.card-image-header {
  background-color: var(--color-bg-off-white);
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  padding: 20px;
  /* Inset spacing */
  margin: 15px 15px 0 15px; 
  text-align: center;
}

/* This styles the h3 inside the new header */
.features-grid .dashboard-card h3 {
  font-family: var(--font-heading); /* Pixel font */
  font-size: 16px;
  color: var(--color-text-brown);
  margin: 0;
}

/* This styles the text container with the vertical bar */
.card-description {
  padding: 10px 15px 10px 15px;
  margin: 15px 15px 0 15px;
  border-left: 4px solid var(--color-text-brown);
}

/* This styles the <p> text */
.features-grid .dashboard-card p {
  color: var(--color-text-brown);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

/* This container pushes the button to the bottom */
.card-button-footer {
  padding: 15px;
  margin-top: auto; /* Magic flexbox property */
}

/* This styles the "Welcome" card's text */
.dashboard-card.welcome-card h2 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 24px;
  color: var(--color-text-brown);
  margin-top: 0;
  margin-bottom: 10px;
}
.dashboard-card.welcome-card p {
  font-size: 14px;
  margin-bottom: 0;
  line-height: 1.5;
  color: var(--color-text-charcoal);
}

/* This is the original button style for the WELCOME card */
.dashboard-btn {
  background-color: var(--color-accent-blue);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
  transition: background-color var(--transition-speed), transform var(--transition-speed);
}
.dashboard-btn:hover {
  background-color: #008fbf; /* Darker blue */
  transform: translateY(-2px);
}
.dashboard-btn:active {
  transform: translateY(0);
}


/* NEW BUTTON STYLE for the 4 feature cards */
.features-grid .dashboard-btn {
  background-color: transparent;
  border: 2px solid var(--color-text-brown);
  color: var(--color-text-brown);
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: 700;
  transition: all var(--transition-speed);
}

.features-grid .dashboard-btn:hover {
  background-color: var(--color-text-brown);
  color: #FFFFFF; /* Text changes to white on hover */
  transform: none; /* Override previous hover */
}
.features-grid .dashboard-btn:active {
  transform: scale(0.98);
}


/* --- Media Queries for Responsiveness --- */

/* This creates the 2x2 grid on wide screens */
@media (min-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  /* No changes needed here for layout */
}

@media (max-width: 768px) {
  .container { 
    flex-direction: column; /* Stack sidebar on top of main */
  }
  aside { 
    width: 100%; 
    height: auto; 
    max-height: 250px; 
    overflow-y: auto; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
    border-right: none; /* Remove side border */
    border-bottom: 2px solid var(--color-highlight-orange); /* Add bottom border */
  }
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  header { padding: 15px 0 0 0; }
  .center-title { font-size: 20px; }
  .navbar.horizontal-navbar { margin-bottom: 10px; }
  .navbar-nav { 
    flex-direction: column; 
    gap: 0; 
    align-items: center; 
  }
  .nav-item .nav-link { 
    padding: 10px 15px; 
    font-size: 14px; /* Slightly smaller */
    width: 100%; 
    justify-content: center; 
  }
  .nav-item .nav-link:hover,
  .nav-item .nav-link.active {
    transform: none;
  }
  
  .nav-item .nav-link i { margin-right: 5px; }
  main { padding: 10px; }
  .badge-icon { width: 60px; height: 60px; }
  .badge-icon span { font-size: 18px; }

  /* All cards will stack vertically 1-column, which is correct */
  
  .dashboard-card.welcome-card h2 { font-size: 20px; }
}
