/* public/event-modal.css — Vietnamese ancient theme, matching game UI */

/* ===== BACKDROP ===== */
.event-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: eventBackdropFadeIn 0.3s ease;
}

.event-modal.hidden {
  display: none;
}

/* ===== MAIN CONTENT PANEL ===== */
.event-content {
  position: relative;
  background: linear-gradient(170deg, #2a1a08 0%, #3d2610 40%, #2a1a08 100%);
  border: 1px solid #8a6525;
  border-radius: 8px;
  padding: 28px 24px 24px;
  max-width: 480px;
  max-height: 85vh;
  width: 90%;
  color: #e8d5a3;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(160, 110, 40, 0.12) inset;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(138, 101, 37, 0.4) transparent;
  animation: eventScrollUnroll 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: top center;
}

/* Inner warm glow */
.event-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(220, 175, 80, 0.08) 0%, transparent 70%);
  pointer-events: none;
  border-radius: 8px;
}

/* Bottom gold gradient line */
.event-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 168, 39, 0.4), transparent);
  pointer-events: none;
}

/* Custom scrollbar (WebKit) */
.event-content::-webkit-scrollbar {
  width: 6px;
}
.event-content::-webkit-scrollbar-track {
  background: transparent;
}
.event-content::-webkit-scrollbar-thumb {
  background: rgba(138, 101, 37, 0.4);
  border-radius: 3px;
}

/* ===== HEADER ===== */
.event-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  position: relative;
}

/* ===== CATEGORY BADGE ===== */
.event-category {
  padding: 4px 14px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 11px;
  font-family: 'Cinzel', Georgia, serif;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.category-WORLD {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.4);
}

.category-CONFLICT {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.4);
}

.category-DISASTER {
  background: rgba(243, 156, 18, 0.2);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.4);
}

.category-INTERNAL {
  background: rgba(155, 89, 182, 0.2);
  color: #9b59b6;
  border: 1px solid rgba(155, 89, 182, 0.4);
}

/* ===== CLOSE BUTTON (game-themed round circle) ===== */
.event-close {
  background-color: rgba(139, 69, 19, 0.9);
  color: #f5e6d3;
  border: 2px solid #d4af37;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.event-close:hover {
  background-color: #a0522d;
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* ===== TITLE ===== */
.event-title {
  margin: 0 0 12px 0;
  font-size: 22px;
  font-weight: 700;
  color: #d4a827;
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 1px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  animation: eventContentReveal 0.5s ease-out both;
  animation-delay: 0.15s;
}

/* ===== DESCRIPTION ===== */
.event-description {
  margin: 0 0 18px 0;
  font-size: 15px;
  line-height: 1.7;
  color: #e8d5a3;
  font-family: 'Segoe UI', Arial, sans-serif;
  animation: eventContentReveal 0.5s ease-out both;
  animation-delay: 0.25s;
}

/* ===== ACTION BUTTONS ===== */
.event-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  animation: eventContentReveal 0.5s ease-out both;
  animation-delay: 0.35s;
}

.event-btn {
  flex: 1;
  min-width: 120px;
  padding: 11px 18px;
  background: linear-gradient(180deg, rgba(184, 115, 51, 0.85), rgba(139, 94, 60, 0.85));
  color: #f2e8d5;
  border: 1px solid rgba(191, 161, 74, 0.4);
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.25s ease;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 215, 0, 0.1);
}

.event-btn:hover {
  background: linear-gradient(180deg, rgba(200, 130, 60, 0.95), rgba(160, 110, 70, 0.95));
  border-color: rgba(255, 215, 0, 0.4);
  transform: translateY(-1px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 215, 0, 0.15);
}

.event-btn:active {
  transform: translateY(1px) scale(0.97);
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ===== EFFECTS SECTION ===== */
.event-effects {
  margin: 16px 0;
  animation: eventContentReveal 0.5s ease-out both;
  animation-delay: 0.3s;
}

.event-effects.hidden {
  display: none;
}

.effects-section {
  background: rgba(30, 18, 8, 0.5);
  border: 1px solid rgba(138, 101, 37, 0.35);
  border-radius: 6px;
  padding: 14px;
}

.effects-title {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-family: 'Cinzel', Georgia, serif;
  color: #d4a827;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.effects-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.effect-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  background: rgba(42, 26, 8, 0.4);
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.effect-item:hover {
  background: rgba(42, 26, 8, 0.6);
}

.effect-negative {
  border-color: rgba(231, 76, 60, 0.35);
}

.effect-positive {
  border-color: rgba(46, 204, 113, 0.35);
}

.effect-icon {
  font-size: 28px;
  min-width: 36px;
  text-align: center;
}

.effect-details {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.effect-resource {
  font-size: 14px;
  font-weight: 600;
  color: #e8d5a3;
  font-family: 'Segoe UI', Arial, sans-serif;
}

.effect-value {
  font-size: 20px;
  font-weight: 700;
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 0.5px;
}

.effect-negative .effect-value {
  color: #e74c3c;
  text-shadow: 0 0 8px rgba(231, 76, 60, 0.3);
}

.effect-positive .effect-value {
  color: #2ecc71;
  text-shadow: 0 0 8px rgba(46, 204, 113, 0.3);
}

/* Count-up glow pulse on effect values */
.effect-value.counting {
  animation: effectCountPulse 0.8s ease-out;
}

.effect-positive .effect-value.counted {
  animation: effectGlowPositive 1.2s ease-out;
}

.effect-negative .effect-value.counted {
  animation: effectGlowNegative 1.2s ease-out;
}

/* ===== ANIMATIONS ===== */

@keyframes eventBackdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes eventScrollUnroll {
  0% {
    opacity: 0;
    transform: scaleY(0.3);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes eventContentReveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes effectCountPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes effectGlowPositive {
  0% { text-shadow: 0 0 8px rgba(46, 204, 113, 0.3); }
  50% { text-shadow: 0 0 18px rgba(46, 204, 113, 0.6), 0 0 30px rgba(46, 204, 113, 0.2); }
  100% { text-shadow: 0 0 8px rgba(46, 204, 113, 0.3); }
}

@keyframes effectGlowNegative {
  0% { text-shadow: 0 0 8px rgba(231, 76, 60, 0.3); }
  50% { text-shadow: 0 0 18px rgba(231, 76, 60, 0.6), 0 0 30px rgba(231, 76, 60, 0.2); }
  100% { text-shadow: 0 0 8px rgba(231, 76, 60, 0.3); }
}

/* ===== MOBILE RESPONSIVE ===== */

/* Touch devices — no sticky hover */
@media (hover: none) {
  .event-btn:hover {
    background: linear-gradient(180deg, rgba(184, 115, 51, 0.85), rgba(139, 94, 60, 0.85));
    border-color: rgba(191, 161, 74, 0.4);
    transform: none;
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 215, 0, 0.1);
  }

  .effect-item:hover {
    background: rgba(42, 26, 8, 0.4);
  }
}

/* Tablets */
@media (max-width: 768px) {
  .event-content {
    max-width: 92%;
    padding: 22px 18px 18px;
  }

  .event-title {
    font-size: 20px;
  }

  .event-description {
    font-size: 14px;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .event-content {
    max-width: 96%;
    padding: 18px 14px 14px;
    border-radius: 6px;
  }

  .event-title {
    font-size: 18px;
    letter-spacing: 0.5px;
  }

  .event-description {
    font-size: 13px;
    line-height: 1.6;
  }

  .event-btn {
    padding: 10px 14px;
    font-size: 12px;
  }

  .effect-icon {
    font-size: 24px;
    min-width: 30px;
  }

  .effect-value {
    font-size: 17px;
  }

  .effect-resource {
    font-size: 13px;
  }

  .effects-title {
    font-size: 12px;
  }
}

/* Landscape compact */
@media (max-height: 500px) and (orientation: landscape) {
  .event-content {
    max-height: 90vh;
    padding: 14px 16px;
  }

  .event-title {
    font-size: 17px;
    margin-bottom: 8px;
  }

  .event-description {
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.5;
  }

  .event-header {
    margin-bottom: 10px;
  }

  .event-effects {
    margin: 10px 0;
  }

  .effect-item {
    padding: 6px 10px;
  }

  .effect-icon {
    font-size: 22px;
    min-width: 28px;
  }

  .effect-value {
    font-size: 16px;
  }

  .event-btn {
    padding: 8px 14px;
    font-size: 12px;
  }
}

/* Very small landscape */
@media (max-height: 400px) and (orientation: landscape) {
  .event-content {
    padding: 10px 12px;
    max-height: 95vh;
  }

  .event-title {
    font-size: 15px;
    margin-bottom: 6px;
  }

  .event-description {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .effect-item {
    padding: 4px 8px;
    gap: 8px;
  }
}

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .event-content {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

.no-effects {
  text-align: center;
  color: #999;
  font-style: italic;
  margin: 10px 0;
}

.effects-actions {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}

.btn-back {
  min-width: 150px;
}

.event-buttons.hidden {
  display: none;
}

/* Responsive design */
@media (max-width: 600px) {
  .event-content {
    width: 95%;
    padding: 15px;
  }
  
  .event-title {
    font-size: 20px;
  }
  
  .event-description {
    font-size: 14px;
  }
  
  .event-btn {
    font-size: 14px;
    padding: 10px 15px;
  }
  
  .effect-icon {
    font-size: 28px;
    min-width: 35px;
  }
  
  .effect-resource {
    font-size: 14px;
  }
  
  .effect-value {
    font-size: 18px;
  }
}

/* Mobile landscape mode - compact vertical spacing */
@media (max-width: 900px) and (max-height: 500px) {
  .event-content {
    max-height: 90vh;
    padding: 12px;
    max-width: 650px;
  }
  
  .event-header {
    margin-bottom: 8px;
  }
  
  .event-title {
    font-size: 18px;
    margin: 0 0 8px 0;
  }
  
  .event-description {
    font-size: 13px;
    margin: 0 0 12px 0;
    line-height: 1.4;
  }
  
  .event-category {
    padding: 4px 12px;
    font-size: 10px;
  }
  
  .event-close {
    font-size: 28px;
    width: 28px;
    height: 28px;
  }
  
  .event-effects {
    margin: 12px 0;
  }
  
  .effects-section {
    padding: 10px;
    margin-bottom: 10px;
  }
  
  .effects-title {
    font-size: 15px;
    margin: 0 0 10px 0;
  }
  
  .effects-list {
    gap: 6px;
  }
  
  .effect-item {
    padding: 8px;
    gap: 10px;
  }
  
  .effect-icon {
    font-size: 24px;
    min-width: 30px;
  }
  
  .effect-resource {
    font-size: 13px;
  }
  
  .effect-value {
    font-size: 16px;
  }
  
  .effects-actions {
    margin-top: 10px;
  }
  
  .event-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
  
  .btn-back {
    min-width: 120px;
  }
  
  .effects-image {
    margin-bottom: 12px;
    max-height: 150px;
  }
  
  .effects-image img {
    object-fit: contain;
  }
}

/* Very small landscape screens */
@media (max-width: 700px) and (max-height: 400px) {
  .event-content {
    padding: 10px;
    max-width: 550px;
  }
  
  .event-title {
    font-size: 16px;
    margin: 0 0 6px 0;
  }
  
  .event-description {
    font-size: 12px;
    margin: 0 0 10px 0;
  }
  
  .effects-title {
    font-size: 14px;
    margin: 0 0 8px 0;
  }
  
  .effect-item {
    padding: 6px;
  }
  
  .effect-icon {
    font-size: 20px;
    min-width: 25px;
  }
  
  .effect-resource {
    font-size: 12px;
  }
  
  .effect-value {
    font-size: 14px;
  }
  
  .event-btn {
    padding: 6px 12px;
    font-size: 12px;
    min-width: 100px;
  }
  
  .effects-image {
    max-height: 120px;
  }
}
