/* Magnus Archives GM Tool - Dashboard,  Party, NPCs, Combat, Reference, Utilities */

/* Shimmer Animation */
@keyframes shimmer {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ==================== DASHBOARD ==================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.dashboard-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #0d1a0d 100%);
  border: 3px solid #317e30;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(49, 126, 48, 0.3);
  position: relative;
  transition: all 0.3s ease;
}

.dashboard-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #317e30 20%,
    #4caf50 50%,
    #317e30 80%,
    transparent 100%
  );
  animation: shimmer 3s infinite;
}

.dashboard-card:hover {
  border-color: #4caf50;
  box-shadow: 0 12px 40px rgba(76, 175, 80, 0.4);
  transform: translateY(-2px);
}

.dashboard-card h3 {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a2a1a 100%);
  padding: 15px 20px;
  margin: 0;
  color: #4caf50;
  font-size: 1.2em;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  border-bottom: 2px solid #317e30;
}

.dashboard-card > div {
  padding: 20px;
}

.dashboard-card .button {
  width: 100%;
  margin-top: 10px;
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-info label {
  color: #888;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 3px;
}

.session-info input,
.session-info select,
.session-info textarea {
  width: calc(100% - 28px);
  padding: 12px;
  background: #2a2a2a;
  border: 2px solid #317e30;
  border-radius: 6px;
  color: #fff;
  font-size: 1em;
  transition: all 0.2s ease;
  font-family: inherit;
}

.session-info input:focus,
.session-info select:focus,
.session-info textarea:focus {
  outline: none;
  border-color: #4caf50;
  background: #333;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

.session-info input::placeholder,
.session-info textarea::placeholder {
  color: #555;
  font-style: italic;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  text-align: center;
  color: #666;
  padding: 40px 20px;
  font-style: italic;
  background: #000;
  border: 2px dashed #444;
  border-radius: 6px;
  margin: 10px 0;
}

/* ==================== PARTY MEMBER CARDS ==================== */
.party-member-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #0d1a0d 100%);
  border: 3px solid #317e30;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(49, 126, 48, 0.2);
  position: relative;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

.party-member-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #317e30 20%,
    #4caf50 50%,
    #317e30 80%,
    transparent 100%
  );
  opacity: 0.5;
}

.party-member-card:hover {
  border-color: #4caf50;
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
  transform: translateY(-2px);
}

.party-member-card:hover::before {
  opacity: 1;
  animation: shimmer 2s infinite;
}

.party-member-card > div {
  padding: 20px;
}

.party-member-card input,
.party-member-card select,
.party-member-card textarea {
  background: #2a2a2a;
  border: 2px solid #317e30;
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.party-member-card input:focus,
.party-member-card select:focus,
.party-member-card textarea:focus {
  outline: none;
  border-color: #4caf50;
  background: #333;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

/* ==================== NPC CARDS ==================== */
.npc-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #0d1a0d 100%);
  border: 3px solid #317e30;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(49, 126, 48, 0.2);
  position: relative;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

.npc-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #317e30 20%,
    #4caf50 50%,
    #317e30 80%,
    transparent 100%
  );
  opacity: 0.5;
}

.npc-card:hover {
  border-color: #4caf50;
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
  transform: translateY(-2px);
}

.npc-card:hover::before {
  opacity: 1;
  animation: shimmer 2s infinite;
}

.npc-card > div {
  padding: 20px;
}

.npc-card input,
.npc-card select,
.npc-card textarea {
  background: #2a2a2a;
  border: 2px solid #317e30;
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.npc-card input:focus,
.npc-card select:focus,
.npc-card textarea:focus {
  outline: none;
  border-color: #4caf50;
  background: #333;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

/* ==================== COMBAT TRACKER ==================== */
.combat-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

#initiativeList {
  min-height: 200px;
  background: #000;
  border: 2px solid #317e30;
  border-radius: 8px;
  padding: 15px;
  box-shadow: inset 0 0 20px rgba(49, 126, 48, 0.2);
}

/* ==================== REFERENCE SECTIONS ==================== */
.reference-section {
  background: linear-gradient(135deg, #1a1a1a 0%, #0d1a0d 100%);
  border: 3px solid #317e30;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(49, 126, 48, 0.2);
  position: relative;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.reference-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #317e30 20%,
    #4caf50 50%,
    #317e30 80%,
    transparent 100%
  );
  animation: shimmer 3s infinite;
}

.reference-section summary,
.reference-summary {
  cursor: pointer;
  padding: 18px 24px;
  background: linear-gradient(135deg, #2a2a2a 0%, #1a2a1a 100%);
  border-bottom: 2px solid #317e30;
  font-weight: bold;
  color: #4caf50;
  font-size: 1.15em;
  text-transform: uppercase;
  letter-spacing: 2px;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.reference-section summary h3,
.reference-summary h3 {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  text-shadow: inherit;
}

.reference-section summary::-webkit-details-marker {
  display: none;
}

.reference-section summary::before {
  content: "▶";
  display: inline-block;
  transition: transform 0.2s;
  font-size: 0.9em;
}

.reference-section[open] summary::before {
  transform: rotate(90deg);
}

.reference-section summary:hover,
.reference-summary:hover {
  background: linear-gradient(135deg, #333 0%, #1a2a1a 100%);
  color: #66bb6a;
}

.reference-section[open] summary {
  margin-bottom: 0;
}

.reference-content {
  padding: 20px;
  background: #1a1a1a;
}

/* ==================== GENERATOR CARDS ==================== */
.generator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.generator-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #0d1a0d 100%);
  border: 3px solid #317e30;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(49, 126, 48, 0.2);
  position: relative;
  transition: all 0.3s ease;
}

.generator-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #317e30 20%,
    #4caf50 50%,
    #317e30 80%,
    transparent 100%
  );
  opacity: 0.5;
}

.generator-card:hover {
  border-color: #4caf50;
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
  transform: translateY(-2px);
}

.generator-card:hover::before {
  opacity: 1;
  animation: shimmer 2s infinite;
}

.generator-card h3 {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a2a1a 100%);
  padding: 15px 20px;
  margin: 0;
  color: #4caf50;
  font-size: 1.1em;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  border-bottom: 2px solid #317e30;
}

.generator-card > div {
  padding: 20px;
}

.generator-card label {
  display: block;
  margin: 12px 0 6px 0;
  color: #888;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.generator-card input {
  width: 80px;
  padding: 8px 12px;
  background: #2a2a2a;
  border: 2px solid #317e30;
  border-radius: 4px;
  color: #fff;
  font-size: 1em;
  transition: all 0.2s ease;
}

.generator-card input:focus {
  outline: none;
  border-color: #4caf50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

/* ==================== DICE BUTTONS ==================== */
.dice-btn {
  min-width: 100px;
  font-size: 1.2em;
  padding: 15px;
  background: linear-gradient(135deg, #317e30 0%, #2a6528 100%);
  color: white;
  border: 2px solid #4caf50;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 3px 10px rgba(49, 126, 48, 0.3);
}

.dice-btn:hover {
  background: linear-gradient(135deg, #4caf50 0%, #317e30 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
}

.quick-dice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

/* ==================== ROLL LOG ==================== */
.rolls-log {
  min-height: 150px;
  padding: 15px;
  background: #000;
  border: 2px solid #317e30;
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: inset 0 0 20px rgba(49, 126, 48, 0.2);
}

.rolls-log::-webkit-scrollbar {
  width: 8px;
}

.rolls-log::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 4px;
}

.rolls-log::-webkit-scrollbar-thumb {
  background: #317e30;
  border-radius: 4px;
}

.rolls-log::-webkit-scrollbar-thumb:hover {
  background: #4caf50;
}

/* ==================== BUTTON STYLING ==================== */
.button.primary-button,
.primary-button {
  background: linear-gradient(135deg, #317e30 0%, #2a6528 100%);
  color: white;
  font-weight: bold;
  border: 2px solid #4caf50;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 3px 10px rgba(49, 126, 48, 0.3);
}

.button.primary-button:hover,
.primary-button:hover {
  background: linear-gradient(135deg, #4caf50 0%, #317e30 100%);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
  transform: translateY(-2px);
}

.button.primary-button:active,
.primary-button:active {
  transform: translateY(0);
}

.button {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a2a1a 100%);
  color: #4caf50;
  border: 2px solid #317e30;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9em;
}

.button:hover {
  background: linear-gradient(135deg, #333 0%, #1a2a1a 100%);
  border-color: #4caf50;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

/* ==================== SECTION STYLING ==================== */
.section {
  background: linear-gradient(135deg, #1a1a1a 0%, #0d1a0d 100%);
  border: 3px solid #317e30;
  border-radius: 10px;
  padding: 0;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(49, 126, 48, 0.3);
  position: relative;
}

/* Reference tab sections should be transparent containers */
#reference .section {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  overflow: visible;
}

#reference .section::before {
  display: none;
}

#reference .section > h2 {
  color: #4caf50;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 1.5em;
  margin-bottom: 25px;
  text-align: center;
  text-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(76, 175, 80, 0.3);
}

.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #317e30 20%,
    #4caf50 50%,
    #317e30 80%,
    transparent 100%
  );
  animation: shimmer 3s infinite;
}

.section > h2:first-child {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a2a1a 100%);
  padding: 20px 25px;
  margin: 0;
  color: #4caf50;
  font-size: 1.3em;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  border: none;
  border-bottom: 2px solid #317e30;
}

.section > *:not(h2:first-child) {
  padding: 20px 25px;
}

.section-description {
  color: #888;
  margin-bottom: 15px;
  font-style: italic;
  line-height: 1.6;
}

/* ==================== CUSTOM MULTI-SELECT ==================== */
.custom-multiselect {
  position: relative;
  width: 100%;
}

.multiselect-trigger {
  width: 100%;
  min-height: 32px;
  padding: 5px 30px 5px 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #4caf50;
  border-radius: 4px;
  color: #e0e0e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  position: relative;
  font-size: 0.9em;
}

.multiselect-trigger:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: #66bb6a;
}

.multiselect-trigger::after {
  content: "▼";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #4caf50;
  font-size: 0.75em;
}

.multiselect-trigger.open::after {
  content: "▲";
}

.multiselect-placeholder {
  color: #888;
  font-style: italic;
  font-size: 0.9em;
}

.multiselect-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: #317e30;
  border-radius: 3px;
  font-size: 0.85em;
  gap: 4px;
  line-height: 1.3;
}

.multiselect-tag-remove {
  cursor: pointer;
  font-weight: bold;
  color: #fff;
  opacity: 0.7;
  transition: opacity 0.2s;
  font-size: 1.1em;
}

.multiselect-tag-remove:hover {
  opacity: 1;
}

.multiselect-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: #1a1a1a;
  border: 1px solid #4caf50;
  border-radius: 4px;
  margin-top: 2px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.multiselect-option {
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9em;
}

.multiselect-option:hover {
  background: rgba(76, 175, 80, 0.2);
}

.multiselect-option.selected {
  background: rgba(76, 175, 80, 0.3);
}

.multiselect-option input[type="checkbox"] {
  pointer-events: none;
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .generator-grid {
    grid-template-columns: 1fr;
  }

  .quick-dice-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .combat-controls {
    flex-direction: column;
  }

  .dashboard-card h3,
  .generator-card h3 {
    font-size: 1em;
    padding: 12px 15px;
  }

  .section > h2:first-child {
    font-size: 1.1em;
    padding: 15px 20px;
  }

  .party-member-card > div,
  .npc-card > div,
  .dashboard-card > div,
  .generator-card > div {
    padding: 15px;
  }
}

/* ==================== ENTITY POPUP SYSTEM ==================== */
.entity-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.entity-popup {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  border: 2px solid #4caf50;
  border-radius: 12px;
  padding: 25px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(76, 175, 80, 0.3);
  position: relative;
}

.entity-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(76, 175, 80, 0.3);
}

.entity-popup-title {
  font-size: 1.5em;
  font-weight: bold;
  color: #4caf50;
  margin: 0;
}

.entity-popup-close {
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid #f44336;
  color: #ef5350;
  font-size: 1.2em;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s;
}

.entity-popup-close:hover {
  background: rgba(244, 67, 54, 0.4);
  transform: scale(1.1);
}

.entity-popup-content {
  margin-bottom: 20px;
}

.entity-popup-field {
  margin-bottom: 15px;
}

.entity-popup-label {
  display: block;
  font-weight: bold;
  color: #888;
  font-size: 0.85em;
  text-transform: uppercase;
  margin-bottom: 5px;
  letter-spacing: 0.5px;
}

.entity-popup-value {
  color: #eee;
  font-size: 1em;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.entity-popup-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(76, 175, 80, 0.2);
}

.entity-popup-button {
  flex: 1;
  padding: 12px 20px;
  border-radius: 6px;
  border: 1px solid;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1em;
}

.entity-popup-button.primary {
  background: rgba(33, 150, 243, 0.2);
  border-color: #2196f3;
  color: #64b5f6;
}

.entity-popup-button.primary:hover {
  background: rgba(33, 150, 243, 0.4);
  transform: translateY(-2px);
}

.entity-popup-button.secondary {
  background: rgba(76, 175, 80, 0.2);
  border-color: #4caf50;
  color: #66bb6a;
}

.entity-popup-button.secondary:hover {
  background: rgba(76, 175, 80, 0.4);
  transform: translateY(-2px);
}

.entity-clickable {
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: currentColor;
  text-underline-offset: 2px;
}

.entity-clickable:hover {
  opacity: 0.8;
  text-decoration-style: solid;
}
