/* Current Player Turn Log Component Styles */

.current-player-turn-log {
  position: fixed;
  width: 540px; /* Standard width */
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  z-index: 4999; /* Below toolbar (5000) */
  display: none;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  resize: horizontal; /* Make it resizable */
  overflow: auto; /* Required for resize to work */
  min-width: 400px; /* Minimum width */
  max-width: 90vw; /* Maximum width */
}

/* Desktop only - hide on mobile/touch devices */
@media (max-width: 1024px) {
  .current-player-turn-log {
    display: none !important;
  }
}

/* Collapsed state: to the right of toolbar, only title visible */
.current-player-turn-log.collapsed {
  bottom: 24px;
  left: calc(50% + 360px);
  width: 540px;
  height: 52px;
  overflow: hidden;
  transform: translateX(0); /* No horizontal translation */
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanding animation: slide up first */
.current-player-turn-log.expanding {
  bottom: 24px; /* Stay at same vertical position */
  left: calc(50% + 360px); /* Stay to right of toolbar initially */
  width: 540px; /* Keep narrow during position transition */
  height: 400px;
  max-height: calc(100vh - 140px);
  transform: translateX(0); /* Stay in place horizontally during height expansion */
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded state: moved left to overlay monsters panel, bottom-aligned */
.current-player-turn-log.expanded {
  bottom: 24px; /* Keep same vertical position */
  left: 20px; /* Left side, overlaying monsters panel */
  width: 540px; /* Keep same width */
  height: 400px;
  max-height: calc(100vh - 140px);
  transform: translateX(0); /* At final left position */
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsing animation: move right first, then shrink down */
.current-player-turn-log.collapsing {
  bottom: 24px;
  left: calc(50% + 360px); /* Move back to right of toolbar */
  width: 540px; /* Gradually shrink width after returning to position */
  height: 400px;
  max-height: calc(100vh - 140px);
  transform: translateX(0); /* No translation needed with left positioning */
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.6s; /* Width shrinks after position */
}

.current-player-turn-log .turn-log-header {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
  flex-shrink: 0;
}

.current-player-turn-log .turn-log-title {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  font-family: 'Bangers', cursive;
  letter-spacing: 1px;
}

.current-player-turn-log .turn-log-toggle {
  background: transparent !important;
  border: none !important;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.2s;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
}

.current-player-turn-log .turn-log-toggle:hover {
  opacity: 1;
}

.current-player-turn-log .toggle-arrow {
  display: inline-block;
  transition: transform 0.2s;
}

.current-player-turn-log .turn-log-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  min-height: 0; /* Allow flex shrinking */
}

.current-player-turn-log .turn-log-footer {
  height: 52px;
  background: rgba(0, 0, 0, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

/* Hide footer in collapsed state */
.current-player-turn-log.collapsed .turn-log-footer,
.current-player-turn-log.collapsed .turn-log-body {
  display: none;
}

.current-player-turn-log .turn-log-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.current-player-turn-log .no-entries {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.current-player-turn-log .log-entry {
  display: flex;
  flex-direction: column;
  align-items: flex-start !important;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.current-player-turn-log .log-entry > div {
  padding-left: 24px;
  align-items: flex-start !important;
}

.current-player-turn-log .log-entry > span {
  padding-left: 12px;
}

.current-player-turn-log .log-timestamp {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-family: monospace;
}

.current-player-turn-log .log-message {
  font-size: 14px;
  color: #fff;
  line-height: 1.4;
}

/* Kind-specific colors */
.current-player-turn-log .log-entry-damage {
  border-left-color: #ff4444;
}

.current-player-turn-log .log-entry-heal {
  border-left-color: #44ff44;
}

.current-player-turn-log .log-entry-energy {
  border-left-color: #ffaa00;
}

.current-player-turn-log .log-entry-vp {
  border-left-color: #4488ff;
}

.current-player-turn-log .log-entry-tokyo {
  border-left-color: #ff44ff;
}

.current-player-turn-log .log-entry-system {
  border-left-color: #888888;
}

/* Scrollbar styling */
.current-player-turn-log .turn-log-body::-webkit-scrollbar {
  width: 8px;
}

.current-player-turn-log .turn-log-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.current-player-turn-log .turn-log-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.current-player-turn-log .turn-log-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Dice manipulation nested format (Option 2) */
/* Expandable dice roll entries */
.current-player-turn-log .turn-log-entries .log-entry.log-entry-expandable {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start !important;
  background: transparent;
  border: none;
  padding: 0;
}

.current-player-turn-log .turn-log-entries .log-entry-header {
  cursor: pointer;
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid rgba(255, 255, 255, 0.3);
  transition: background 0.2s;
}

.current-player-turn-log .turn-log-entries .log-entry-header:hover {
  background: rgba(255, 255, 255, 0.08);
}

.current-player-turn-log .turn-log-entries .log-entry-header .expand-icon {
  font-size: 14px;
  transition: transform 0.2s;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.current-player-turn-log .turn-log-entries .log-entry-header .log-timestamp {
  flex-shrink: 0;
}

.current-player-turn-log .turn-log-entries .log-entry-header .log-message {
  flex: 1;
  text-align: left;
}

.current-player-turn-log .turn-log-entries .log-entry-details {
  display: none;
  flex-direction: column;
  align-items: flex-start !important;
  gap: 4px;
  margin-top: 8px;
  padding-left: 40px;
}

/* Original roll - make it stand out */
.current-player-turn-log .turn-log-entries .log-entry.log-entry-dice-original {
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.95) !important;
  border-left: 3px solid rgba(255, 255, 255, 0.6) !important;
  padding: 8px 12px 8px 6px !important;
  margin-bottom: 4px !important;
  display: flex;
  flex-direction: column !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border-radius: 4px !important;
}

.current-player-turn-log .turn-log-entries .log-entry.log-entry-dice-original .log-message {
  text-align: left;
}

/* Power card manipulation entries - indented with arrow */
.current-player-turn-log .turn-log-entries .log-entry.log-entry-power-card {
  margin-left: 0 !important;
  padding: 8px 24px !important;
  background: rgba(170, 136, 255, 0.08) !important;
  border-left: 3px solid rgba(170, 136, 255, 0.6) !important;
  position: relative !important;
  border-radius: 4px !important;
  display: flex;
  flex-direction: column !important;
}

.current-player-turn-log .turn-log-entries .log-entry.log-entry-power-card .log-message {
  text-align: left;
}

.current-player-turn-log .turn-log-entries .log-entry.log-entry-power-card::before {
  content: '↳' !important;
  position: absolute !important;
  left: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: rgba(170, 136, 255, 1) !important;
  font-size: 18px !important;
  font-weight: bold !important;
}

/* Result entries - with updated roll label */
.current-player-turn-log .turn-log-entries .log-entry.log-entry-power-card-result {
  margin-left: 0 !important;
  padding: 8px 24px !important;
  background: rgba(136, 204, 136, 0.08) !important;
  border-left: 3px solid rgba(136, 204, 136, 0.6) !important;
  position: relative !important;
  border-radius: 4px !important;
  display: flex;
  flex-direction: column !important;
}

.current-player-turn-log .turn-log-entries .log-entry.log-entry-power-card-result .log-message {
  text-align: left;
}
