/* Dungeon UI Shared Styles */

.d-grid {
  display: grid;
  gap: 8px;
}

/* Dungeon Container Styles */
.dungeon-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 24px;
}

#dungeon-host {
    min-height: 560px;
    background: linear-gradient(145deg, rgba(26, 26, 32, 0.92), rgba(10, 10, 14, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow:
        0 18px 48px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4);
    padding: 24px;
}

.dungeon-controls,
.dungeon-selection-section,
.dungeon-log {
    background: rgba(18, 18, 24, 0.92);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.dungeon-controls {
    margin-bottom: 24px;
    padding: 18px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.dungeon-controls button {
    padding: 10px 18px;
    background: rgba(68, 68, 84, 0.85);
    color: #f5f5f5;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(6px);
}

.dungeon-controls button:hover {
    background: rgba(108, 108, 136, 0.95);
    transform: translateY(-1px);
}

.dungeon-controls button:disabled {
    background: rgba(32, 32, 40, 0.6);
    color: #7a7a88;
    cursor: not-allowed;
}

.dungeon-status {
    margin-left: auto;
    font-size: 14px;
    color: #9aa0ff;
}


.dungeon-selection-section {
    margin-bottom: 24px;
    padding: 18px;
}

.dungeon-selection-section h3 {
    margin: 0 0 12px 0;
    color: #e0e0ff;
}

/* Dungeon Selection Dropdown */

.dungeon-dropdown-container {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.custom-dropdown {
  position: relative;
  width: 100%;
}

.dropdown-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1a1a1a;
  border: 2px solid #333;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #fff;
}

.dropdown-selected:hover {
  border-color: #555;
  background: #222;
}

.dropdown-arrow {
  transition: transform 0.2s ease;
  color: #888;
}

.dropdown-selected.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #1a1a1a;
  border: 2px solid #333;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
}

.dropdown-option {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #333;
  transition: background 0.2s ease;
}

.dropdown-option:last-child {
  border-bottom: none;
}

.dropdown-option:hover {
  background: #222;
}

.dropdown-option.selected {
  background: #2a4a2a;
  color: #4a8;
}

.dungeon-option-name {
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.dungeon-option-description {
  font-size: 0.9em;
  color: #aaa;
  margin-bottom: 4px;
}

@media (min-width: 1200px) { 
  .d-grid { 
    grid-template-columns: 2fr 1fr; 
  } 
}

/* Unit Frames */
#dungeon-host fw-unit-frames,
#dungeon-host fw-skill-bar,
#dungeon-host fw-dungeon-panel {
  display: block;
  background: rgba(18, 20, 32, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

#dungeon-host fw-dungeon-panel {
  padding: 16px;
}

#dungeon-host fw-unit-frames .uf-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#dungeon-host .uf {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(20, 22, 36, 0.95), rgba(12, 13, 22, 0.95));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

#dungeon-host .uf .name {
  font-weight: 600;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; /* Black outline */
}

#dungeon-host .uf.enemy .name {
  color: #a00; /* Red for enemies */
}

#dungeon-host .uf.ally .name {
  color: #0a0; /* Green for allies */
}

#dungeon-host .uf.current-character .name {
  color: #08f; /* Blue for current character */
}

#dungeon-host .uf .bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 6px;
  border-radius: 6px;
  overflow: hidden;
}

#dungeon-host .uf .bar.hp > div {
  height: 100%;
  background: #0a0; /* Green for allies */
}

#dungeon-host .uf.enemy .bar.hp > div {
  background: #a00; /* Red for enemies */
}

#dungeon-host .uf .bar.mp > div {
  height: 100%;
  background: #08f;
}

/* Skill Bar */
#dungeon-host .skills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#dungeon-host button.skill {
  position: relative;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid #333;
  background: #000;
  border-radius: 6px;
}

#dungeon-host button.skill img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#dungeon-host button.skill .cd {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 12px;
  background: #000a;
  padding: 1px 3px;
  border-radius: 3px;
}

/* Dungeon Panel */
#d-panel .header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
}

#d-panel .events { 
  font-family: monospace; 
  max-height: 240px; 
  overflow: auto; 
}

#d-panel .choices { 
  display: flex; 
  gap: 8px; 
  margin-top: 8px; 
  align-items: center; 
  flex-wrap: wrap; 
}

#d-panel .choices .vote { 
  font-size: 12px; 
  opacity: .8; 
  margin-left: 4px; 
}

/* Responsive Grid Layout */
#dungeon-host.d-grid {
  grid-template-areas: "panel" "frames";
  position: relative;
}

@media (min-width: 1200px) {
  #dungeon-host.d-grid {
    grid-template-columns: 2fr 1fr;
    grid-template-areas: "panel frames";
  }
}

#d-panel {
  grid-area: panel;
}

#dungeon-host fw-unit-frames {
  grid-area: frames;
}

/* Dungeon host floating skill bar overlay */
#dungeon-host fw-skill-bar {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px;
  backdrop-filter: blur(4px);
  z-index: 1000;
}