/* Global Styles for PumpQuest */

/* Font Definitions */
@font-face {
  font-family: 'PumpQuest';
  src: url('./fonts/pumpquest.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap; /* Ensures text remains visible during font loading */
}

/* Basic reset and global styles */
body { 
  margin: 0; 
  font-family: 'PumpQuest', 'Arial', sans-serif;
  color: #fff;
  letter-spacing: 1px; /* Add default letter spacing for all text */
}

canvas { 
  display: block; 
  position: fixed; 
  top: 0; 
  left: 0; 
  z-index: 0; 
}

/* Apply the custom font to all game elements */
.npc-name, 
.npc-interaction,
#shopUI,
#inventoryUI,
#characterUI,
.shop-message,
.tooltip,
.hit-splat,
.player-health-container,
.context-menu,
.floating-text,
#gameUI,
#interactionUI,
.inventory-grid,
.inventory-slot,
.item-count {
  font-family: 'PumpQuest', 'Arial', sans-serif;
  letter-spacing: 1px;
}

/* Headings use the same font but with wider spacing for emphasis */
h1, h2, h3, h4, .shop-title, .section-title {
  font-family: 'PumpQuest', 'Arial', sans-serif;
  letter-spacing: 1.5px;
}

/* Apply pixelation for better retro feel with the font */
#shopUI,
#inventoryUI,
#characterUI,
.npc-interaction,
.inventory-slot img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Make sure all buttons have the same font */
button, 
.buy-button, 
.sell-button, 
.close-button,
.goodbye-button,
.trade-button,
#inventoryButton,
#characterButton {
  font-family: 'PumpQuest', 'Arial', sans-serif;
  letter-spacing: 1px;
}

/* Game UI Styles */
#gameUI {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
}

#interactionUI {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 20px;
  border-radius: 5px;
}

/* Inventory UI Styles */
#inventoryButton {
  /* Styles now handled by the common button styles above */
}

#inventoryButton:hover {
  /* Styles now handled by the common button styles above */
}

#inventoryUI {
  position: fixed;
  right: 20px;
  top: 70px;
  background: rgba(0, 0, 0, 0.8);
  padding: 15px;
  border-radius: 5px;
  display: none;
  border: 2px solid #444;
  z-index: 1000;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, 50px);
  gap: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.inventory-slot {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #666;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  font-size: 24px;
}

.inventory-slot:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #888;
}

.inventory-slot img {
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
}

.item-count {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 4px;
  border-radius: 3px;
  min-width: 12px;
  text-align: center;
}

/* Shop UI Styles */
#shopUI {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  max-width: 90vw;
  max-height: 80vh;
  z-index: 1000;
  color: #ffff00;
  text-shadow: 1px 1px 1px #000;
  display: none;
}

/* Frame Container */
.shop-frame {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 6px solid #463020;
  border-radius: 4px;
  box-shadow: 0 0 0 2px #000, 0 0 10px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

/* Content Wrapper (for proper layering with noise) */
.shop-content-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(51, 38, 24, 0.98);
  padding: 8px;
  box-sizing: border-box;
  z-index: 2;
}

/* Noise overlay for retro effect */
.noise-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5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6gWJhMLAoYI74pFn9Q7CwmC4sbihHF4A/K3cWCTaC4YvEHZWJyi2JQ3FA0/mDizsYCQ7G4o2j8YYQCcsUxuLJCQaO4ozQqf5ihoJAYDK5IBL05ijtLY/KHGRIDEYEZisT6/B81jcofpltAJBbMRMTrFYfMUFD4Q3QrCcSCs5IYvWLSQeEP4a00GhO8XZu9Yt5B5Q/TbXNhA+k1e82eUFhk/jCvb9f0SrFLTFD5w9K328RG6TXeKhqZP0ywzYXNAo1J5Q8zbgMRnYXFgo3FBpU/YKcb3yXeKhYaGSt/KHa7jVLsIjqZP0y7jdLrrcYCsVlk/rBz2+2i1+tFr9u58Ue1201ErzcKFn9UO6Xbc3WbpNt5d6OPyuzOVt3ZVpN24I/q7O7WRnPuFqcOf1Rnd2u32lbpzup5xx/V2TbO6nna2Kt014I/kLM71t2e644tO2f+QG/rqNg9nme1d+cHckePz+7svVndD2f+QJEo/AV/0ZA/HvhJQQAAAABJRU5ErkJggg==");
  opacity: 0.05;
  pointer-events: none;
  z-index: 3;
}

/* Header */
.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  margin-bottom: 10px;
  border-bottom: 2px solid #59432E;
}

.shop-title {
  margin: 0;
  font-size: 1.6em;
  color: #fff700;
  text-shadow: 2px 2px 2px #000;
  letter-spacing: 2px; /* Wider spacing for main titles */
}

.close-button {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, #8B6914, #6D4C0D);
  border: 2px solid #593D29;
  border-radius: 4px;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.close-button:hover {
  background: linear-gradient(to bottom, #9E7B1F, #7E5D18);
}

/* Shop Content Styles */
.shop-content {
  display: flex;
  gap: 20px;
  overflow-y: auto;
  max-height: 60vh;
  padding: 0 15px 15px;
}

.shop-inventory, 
.inventory-section {
  flex: 1;
  background: rgba(32, 22, 14, 0.6);
  border: 2px solid #59432E;
  border-radius: 4px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  max-height: 55vh;
}

.section-title {
  margin: 5px 0;
  color: #fff;
  font-size: 1.2em;
  text-align: center;
}

.divider {
  height: 2px;
  background: #59432E;
  margin: 5px 0 10px;
}

.shop-items, 
.inventory-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
  overflow-y: auto;
  max-height: calc(50vh - 50px);
  padding-right: 5px;
}

/* Scrollbar styling for shop items */
.shop-items::-webkit-scrollbar,
.inventory-items::-webkit-scrollbar {
  width: 8px;
}

.shop-items::-webkit-scrollbar-track,
.inventory-items::-webkit-scrollbar-track {
  background: rgba(20, 15, 10, 0.5);
  border-radius: 4px;
}

.shop-items::-webkit-scrollbar-thumb,
.inventory-items::-webkit-scrollbar-thumb {
  background: rgba(89, 67, 46, 0.8);
  border-radius: 4px;
}

.shop-items::-webkit-scrollbar-thumb:hover,
.inventory-items::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 105, 20, 0.8);
}

.shop-item {
  background: rgba(40, 30, 20, 0.6);
  border: 2px solid #59432E;
  border-radius: 4px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.shop-item:hover {
  background: rgba(70, 70, 70, 0.8);
}

.item-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-bottom: 5px;
  image-rendering: pixelated;
}

.item-name {
  font-size: 0.9em;
  text-align: center;
  margin-bottom: 5px;
  color: #fff;
  letter-spacing: 0.8px; /* Slightly tighter spacing for item names */
}

.item-price {
  font-size: 0.8em;
  color: #ffd700;
  letter-spacing: 0.8px; /* Slightly tighter spacing for prices */
}

.player-gold {
  font-size: 0.9em;
  color: #ffd700;
}

/* Shop Message Styles */
.shop-message {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 4px;
  border: 2px solid #59432E;
  font-size: 14px;
  z-index: 10;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.shop-message.error {
  color: #ff6b6b;
  border-color: #ff6b6b;
}

.shop-message.show {
  opacity: 1;
}

/* NPC Interaction Styles */
.npc-name {
  position: fixed;
  color: #ffff00;
  font-size: 14px;
  text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.floating-text {
  position: fixed;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-50px);
    opacity: 0;
  }
}

/* Loading Screen */
#loadingScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-bar-container {
  width: 50%;
  height: 30px;
  border: 2px solid #333;
  border-radius: 15px;
  overflow: hidden;
  margin-top: 20px;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #8B6914, #6D4C0D);
  transition: width 0.5s;
}

.loading-text {
  margin-top: 20px;
  color: #fff;
}

/* UI Buttons Container */
.ui-buttons {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  z-index: 1000;
}

/* Common styles for all UI buttons */
#characterButton,
#inventoryButton,
#journalButton,
#equipmentButton,
#settingsButton {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: 2px solid #444;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
  text-align: center;
  min-width: 100px;
  font-family: 'PumpQuest', 'Arial', sans-serif;
  letter-spacing: 1px;
}

#characterButton:hover,
#inventoryButton:hover,
#journalButton:hover,
#equipmentButton:hover {
  background: rgba(40, 40, 40, 0.8);
  border-color: #666;
}

/* Skills UI Styles - Now combines Character and Skills */
#skillsUI {
  position: fixed;
  right: 20px;
  top: 70px;
  background: rgba(0, 0, 0, 0.8);
  padding: 15px;
  border-radius: 5px;
  display: none;
  border: 3px solid #0099ff; /* Bright blue border for skills UI */
  z-index: 1000;
  min-width: 300px;
}

.character-info {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #444;
}

.character-avatar {
  width: 80px;
  height: 80px;
  background: rgba(30, 30, 30, 0.5);
  border: 2px solid #666;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #ddd;
}

.character-stats {
  flex: 1;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.stat-name {
  color: #ccc;
}

.stat-value {
  color: #ffd700;
  font-weight: bold;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.skill-item {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #666;
  padding: 10px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.skill-item:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #888;
}

.skill-icon {
  width: 30px;
  height: 30px;
  margin-right: 10px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
}

.skill-details {
  flex: 1;
}

.skill-name {
  font-weight: bold;
  margin-bottom: 3px;
}

.skill-level {
  font-size: 0.8em;
  color: #ffd700;
}

/* Journal UI Styles */
#journalUI {
  position: fixed;
  right: 20px;
  top: 70px;
  background: rgba(0, 0, 0, 0.8);
  padding: 15px;
  border-radius: 5px;
  display: none;
  border: 2px solid #444;
  z-index: 1000;
  min-width: 320px;
  max-height: 80vh;
  overflow-y: auto;
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-item {
  background: rgba(25, 25, 40, 0.6);
  border: 1px solid #555;
  border-radius: 4px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.quest-item:hover {
  background: rgba(45, 45, 60, 0.6);
  border-color: #777;
}

.quest-item.active {
  border-color: #ffd700;
  background: rgba(35, 35, 50, 0.8);
}

.quest-title {
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 5px;
  font-size: 1.1em;
}

.quest-status {
  font-size: 0.8em;
  display: flex;
  justify-content: space-between;
}

.quest-progress {
  color: #aaf;
}

.quest-difficulty {
  color: #ff9;
}

.quest-detail {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #666;
  border-radius: 4px;
  padding: 15px;
  margin-top: 15px;
  display: none;
}

.quest-detail.show {
  display: block;
}

.quest-description {
  margin-bottom: 15px;
  line-height: 1.4;
}

.quest-objectives {
  margin-bottom: 15px;
}

.objective-item {
  display: flex;
  gap: 10px;
  margin-bottom: 5px;
  align-items: center;
}

.objective-status {
  width: 16px;
  height: 16px;
  background: rgba(255, 0, 0, 0.3);
  border-radius: 50%;
  flex-shrink: 0;
}

.objective-status.completed {
  background: rgba(0, 255, 0, 0.3);
}

.quest-rewards {
  font-size: 0.9em;
}

.quest-reward-title {
  color: #ffd700;
  margin-bottom: 5px;
}

.quest-reward-item {
  display: flex;
  align-items: center;
  margin-bottom: 3px;
}

.reward-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
}

/* Add CSS for enemy health bars at the end of the file */

/* Enemy Health UI Styles */
.enemy-ui-container {
    position: absolute;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 500;
}

.enemy-health-container {
    position: relative;
    width: 50px;
    height: 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #000;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.enemy-health-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: #00ff00;
    transition: width 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

/* Player Health UI Styles */
.player-health-container {
    position: absolute;
    pointer-events: none;
    width: 80px;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #fff;
    border-radius: 4px;
    overflow: hidden;
    z-index: 500;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.player-health-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: #ff3333;
    transition: width 0.2s ease-in-out;
}

/* Hit Splat Styles */
.hit-splat {
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 1px 1px 1px #000;
    pointer-events: none;
    z-index: 1000;
    animation: floatUp 1s ease-out forwards;
}

.hit-splat.player-hit {
    color: #ff0000;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

/* Item pickup message */
.pickup-message {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.7);
    color: gold;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: 'PumpQuest', sans-serif;
    font-size: 16px;
    pointer-events: none;
    z-index: 1000;
    text-shadow: 0 0 3px #000;
    border: 1px solid rgba(255, 215, 0, 0.5);
    transition: all 0.5s ease-out;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    opacity: 1;
}

/* Make pickup messages for special items more dramatic */
.pickup-message.rare {
    color: #ff00ff;
    font-size: 20px;
    text-shadow: 0 0 6px #ff00ff;
    border-color: rgba(255, 0, 255, 0.7);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { box-shadow: 0 0 15px rgba(255, 0, 255, 0.5); }
    to { box-shadow: 0 0 25px rgba(255, 0, 255, 0.8); }
}

/* Equipment UI Styles */
#equipmentUI {
    position: fixed;
    right: 20px;
    top: 70px;
    width: 350px;
    background-color: rgba(0, 0, 0, 0.8);
    border: 5px solid #ff9900; /* Thicker orange border for equipment UI */
    border-radius: 5px;
    padding: 15px;
    color: #fff;
    z-index: 1001; /* Higher than skillsUI */
    display: none;
    font-family: 'PumpQuest', 'Arial', sans-serif;
    letter-spacing: 1px;
}

#equipmentUI h3 {
    text-align: center;
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.equipment-slots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.equipment-slot {
    border: 1px solid #555;
    border-radius: 4px;
    height: 60px;
    position: relative;
    background-color: rgba(50, 50, 50, 0.5);
    display: flex;
    flex-direction: column;
}

.slot-label {
    font-size: 12px;
    padding: 3px;
    background-color: rgba(0, 0, 0, 0.5);
    text-align: center;
}

.slot-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.equipment-stats {
    margin-top: 15px;
    padding: 10px;
    background-color: rgba(40, 40, 40, 0.5);
    border-radius: 4px;
}

.equipment-stats h4 {
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
    color: #ffd700;
}

.no-stats {
    text-align: center;
    color: #999;
    font-style: italic;
} 