/* Element Selectors */
html, body {
  height: 100%;
}

body {
  background-image: url("wood-background.jpg");
  background-size: cover;
  background-color: #63412d;
}

header {
  margin: 0 10%;
  font-family: 'Georgia', serif;
  font-weight: bold;
  background-color: #928e85;
}

.navbar :focus, .navbar-light .navbar-brand:focus{
  outline: 2px solid rgb(171, 170, 170);
  outline-offset: 0;
  color: white;
}

main {
  background-color: #e8d8a8;
  color: #4a3a28;
  margin: 0 10%;
  padding: 4rem 2rem;
  font-family: "MedievalSharp", cursive;
  line-height: 1.8;
}

a {
  color: #5c3a1a;
  text-decoration: underline;
  text-decoration-color: #c99a5a;
}

a:hover {
  color: #8a4c1a;
  text-decoration-color: #7a5b2b;
}

.entity-image {
  width: 256px;
  height: 256px;
}

select option {
  background-color: #e8d8a8;
  color: #4a3a28;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  table-layout: fixed;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

th, td {
  border: 1px solid #4a3a28;
  text-align: center;
  padding: 0.5rem;
  height: auto;
  font-size: 0.95rem;
}

th {
  background: #d7b87a;
  color: #3d2b1a;
  font-weight: 700;
}

/* Class Selectors */
.engraved-stone {
  color: white;
  background-color: #928e85;
  text-shadow:
    -1px -1px 1px rgba(0, 0, 0, 0.3),
     1px  1px 1px rgba(255, 255, 255, 0.1);
}

.engraved-stone:hover,
.engraved-stone:focus {
  color: white;
  background-color: rgb(171, 170, 170);
}

.engraved-stone.active,
.engraved-stone:active,
.engraved-stone.show {
  color: white;
  background-color: #928e85;
}

.navbar-light .navbar-nav .engraved-stone:hover,
.navbar-light .engraved-stone:hover {
  color: white;
  background-color: rgb(171, 170, 170);
}

.navbar-light .navbar-nav .nav-link.engraved-stone.show {
  color: white;
}

.dropdown-menu {
  padding: 0;
  background-color: #928e85;
  min-width: max-content;
}

.dropdown-divider {
  border-top: 1px solid white;
}

.ck-editor__editable {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: inherit !important;
  font: inherit !important;
}

.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content,
.ck-editor__editable {
  border: 1px solid #4a3a28 !important;
}

.ck-toolbar {
  background-color: inherit !important;
}

/* Modal Styling */
.modal-content {
  background-color: #e8d8a8;
  color: #4a3a28;
  border: 2px solid #4a3a28;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.modal-header {
  background-color: #928e85;
  color: white;
  font-family: 'Georgia', serif;
  font-weight: bold;
  border-bottom: 2px solid #4a3a28;
  text-shadow:
    -1px -1px 1px rgba(0, 0, 0, 0.3),
    1px 1px 1px rgba(255, 255, 255, 0.1);
}

.modal-title {
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-header .btn-close {
  background-color: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  opacity: 1;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-header .btn-close:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

.modal-body {
  background-color: #e8d8a8;
  color: #4a3a28;
  padding: 2rem;
  font-family: "MedievalSharp", cursive;
  line-height: 1.8;
}

.modal-footer {
  background-color: #f5f0e8;
  border-top: 2px solid #4a3a28;
  padding: 1.5rem;
}

.modal-footer .btn {
  font-family: 'Georgia', serif;
  font-weight: bold;
  text-transform: uppercase;
  border: 1px solid #4a3a28;
}

.modal-footer .btn-secondary {
  background-color: #928e85;
  color: white;
  text-shadow:
    -1px -1px 1px rgba(0, 0, 0, 0.3),
    1px 1px 1px rgba(255, 255, 255, 0.1);
  border-color: #4a3a28;
}

.modal-footer .btn-secondary:hover {
  background-color: rgb(171, 170, 170);
  color: white;
  border-color: #4a3a28;
}

.modal-footer .btn-success,
.modal-footer .btn-primary {
  background-color: #960018;
  color: #E29587;
  border-color: #960018;
  text-shadow:
    -1px -1px 1px rgba(0, 0, 0, 0.5),
    1px 1px 1px rgba(255, 255, 255, 0.1);
}

.modal-footer .btn-success:hover,
.modal-footer .btn-primary:hover {
  background-color: #b8001f;
  color: #E29587;
  border-color: #960018;
}

/* Backdrop styling */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.form-control, .form-select {
  background-color: rgba(255, 255, 255, 0.2);
  color: inherit;
  border-color: #4a3a28;
}

.form-control:focus, .form-select:focus, :focus {
  background-color: rgba(255, 255, 255, 0.2);
  color: inherit;
  border-color: #4a3a28;
  box-shadow: 0 0 0 0.2rem rgba(74, 58, 40, 0.25);
}

.friend-request {
  border: 1px solid #4a3a28;
  background-color: inherit;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  width: fit-content;
}

.friend-request:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.ai-output {
  max-height: 30rem;
  overflow-y: auto;
  background-color: rgba(255, 255, 255, 0.2);
}

.ai-output pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 8px;
  background: #f6f6f6;
}

.ai-output ul,
.ai-output ol {
  padding-left: 24px;
}

.ai-output h1,
.ai-output h2,
.ai-output h3 {
  margin-top: 16px;
  margin-bottom: 8px;
}

th.sort-column { cursor: pointer; }
th.sort-asc::after { content: " \25b2"; }
th.sort-desc::after { content: " \25bc"; }

label.required::after {
  content: ' *';
  color: red;
}

/* Button styling for both rectangle and circle*/
.round-seal-btn, .square-seal-btn {
  background-color: #960018; /* Rich Carmine */
  color: #E29587;
  font-family: 'Georgia', serif;
  font-weight: bold;
  text-transform: uppercase;

  text-shadow: 
  -1px -1px 1px rgba(0, 0, 0, 0.5),            /* Engraving effect */
  1px 1px 1px rgba(255, 255, 255, 0.1);

  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  position: relative;
  box-sizing: border-box;

  border: none;
  cursor: pointer;

  transition: transform 0.2s ease;
}

.round-seal-btn {
  width: 100px;
  height: 100px;
  padding: 20px;

  white-space: nowrap;
  
  /* The "Organic" Shape */
  border-radius: 45% 55% 50% 50% / 50% 45% 55% 50%;
  
  /* Depth Effects */
  box-shadow: 
    2px 4px 6px rgba(0, 0, 0, 0.3),              /* Drop shadow on paper */
    inset 4px 4px 8px rgba(255, 255, 255, 0.2),  /* Highlight on top edge */
    inset -4px -4px 10px rgba(0, 0, 0, 0.5);     /* Deep shadow in the well */
}

.square-seal-btn {
  padding: 1rem;

  /* The Outer Bevel: Makes the whole button look raised */
  box-shadow: 
    3px 3px 6px rgba(0, 0, 0, 0.4),              /* Shadow on paper */
    inset 3px 3px 2px rgba(255, 255, 255, 0.2),  /* Light hitting top edge */
    inset -3px -3px 2px rgba(0, 0, 0, 0.5);      /* Deep shadow on bottom edge */
}

.round-seal-btn:hover {
  transform: scale(1.05) rotate(2deg);
  text-decoration: none;
  color: #E29587;
}

.square-seal-btn:hover {
  transform: translateY(-2px);
  text-decoration: none;
  color: #E29587;

  /* Soften the shadow to show increased distance from 'paper' */
  box-shadow: 
    6px 10px 15px rgba(0, 0, 0, 0.3),            /* Longer, blurrier shadow */
    inset 3px 3px 2px rgba(255, 255, 255, 0.2), 
    inset -3px -3px 2px rgba(0, 0, 0, 0.5);
}

.round-seal-btn:active, .square-seal-btn:active {
  /* 1. Push it "down" slightly */
  transform: scale(0.96) translateY(2px);
  
  /* 2. Flatten the shadows to simulate contact with paper */
  box-shadow: 
    1px 1px 2px rgba(0, 0, 0, 0.4),              /* Smaller drop shadow */
    inset 2px 2px 5px rgba(255, 255, 255, 0.1),  /* Diminished highlights */
    inset -2px -2px 5px rgba(0, 0, 0, 0.4);      /* Diminished deep shadow */
    
  /* 3. Slightly darken the background to mimic less light hitting it */
  filter: brightness(0.9);
}

.square-seal-btn::before {
  content: '';
  position: absolute;
  /* Adjust these to change the thickness of the 'lip' */
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  
  background-color: rgba(0, 0, 0, 0.05); /* Slightly darker center */
  
  /* This creates the 'sunken' effect for the text area */
  box-shadow: 
    inset 4px 4px 8px rgba(0, 0, 0, 0.4), 
    inset -2px -2px 4px rgba(0, 0, 0, 0.2);
  
  pointer-events: none;
}

.round-seal-btn::before {
  content: '';
  position: absolute;
  pointer-events: none;

  /* Sits inside the lip */
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  
  /* Make the border a circle */
  border-radius: 50%;
  
  /* THE WELL: Deep inset shadow to look 'pressed' */
  box-shadow: 
    inset 6px 6px 10px rgba(0, 0, 0, 0.3), 
    inset -2px -2px 5px rgba(0, 0, 0, 0.2);
    
  background-color: rgba(0, 0, 0, 0.05); /* Slightly darker wax in the center */
  z-index: 0;
}

.btn-in-td {
  width: 100%;
  margin: 0;
  padding: 0.75rem;
}

.menu-btn {
  font-size: 1.25rem;
}

.fixed-stat {
  min-width: 8rem;
}

.stat-card-bg {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.stat-card-border {
  border: 1px solid #4a3a28;
}

.fixed-stat-name {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  padding: 0.25rem;
  background: #d7b87a;
  color: #3d2b1a;
  border-radius: 0.375rem;
}

.fixed-stats-grid {
  overflow-x: auto;
}

.health-card {
  border: 1px solid #4a3a28;
  background-color: inherit;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  max-width: 18rem;
}

.health-title {
  background: #d7b87a;
  color: #3d2b1a;
  font-weight: 700;
  padding: 0.25rem;
  text-transform: uppercase;
  font-size: 0.85rem;
  border-radius: 0.375rem;
}

.health-display {
  font-size: 1.4rem;
  font-weight: 700;
  border-right: 1px solid #4a3a28;
}

.health-current {
  color: #3d2b1a;
}

.health-separator {
  margin: 0 0.25rem;
}

.health-max {
  opacity: 0.75;
  font-size: 1.1rem;
}

.health-controls button {
  padding: 0.15rem 0;
}

.health-controls input {
  background: rgba(255,255,255,0.4);
  border: 1px solid #4a3a28;
  font-weight: 600;
}

.filter-box-border {
  border: 1px solid #4a3a28;
}

.underline-border {
  border-bottom: 1px solid #4a3a28;
}

/* NEW: consistent preview sizing */
.media-preview-wrapper {
    width: 100px;
    height: 100px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-preview {
    width: 100%;
    height: 100%;
    object-fit: cover; /* prevents distortion */
}

/* NEW: cleaner audio appearance */
.audio-inline {
    max-width: 180px;
}

.image-preview {
  height: auto;
  max-height: 500px;
  object-fit: contain;
}

/* ID Selectors */
#menu {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
}

/* ========== Battle Map ========== */
body:has(.battle-layout) {
  background-image: none;
}

body:has(.battle-layout) header {
  margin: 0;
}

main:has(.battle-layout) {
  margin: 0;
  padding: 0;
  padding-top: 3.5rem;
  height: 100vh;
  overflow: hidden;
}

.battle-layout {
  height: 100%;
}

.battle-canvas-container {
  flex: 1 1 auto;
  min-width: 0;
  border: 3px solid #4a3a28;
}

#battleContainer {
  width: 100%;
  height: 100%;
}

.battle-sidebar {
  flex: 0 0 20rem;
  overflow-y: auto;
  border: 2px solid #4a3a28;
}

.battle-sidebar-heading {
  border-bottom: 1px solid #4a3a28;
}

.token-popup {
  position: absolute;
  background-color: #f5ead0;
  border: 1px solid #4a3a28;
  padding: 0.4rem 0.6rem;
  z-index: 10;
  white-space: nowrap;
  font-size: 0.85rem;
  transform: translate(-50%, -100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.token-popup .token-popup-name {
  font-weight: bold;
  margin: 0;
}

.token-popup .token-popup-type {
  margin: 0.15rem 0 0 0;
  color: #6b5b4b;
  font-size: 0.8rem;
}

.token-popup-health-card {
  margin-top: 0.3rem;
  border-top: 1px solid #c9b88a;
  padding-top: 0.3rem;
}