/* Bootstrap 4 Modal Styles */

/* Modal backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  background-color: #000;
}

.modal-backdrop.fade {
  opacity: 0;
}

.modal-backdrop.show {
  opacity: 0.5;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1050;
  display: none;
  overflow: hidden;
  outline: 0;
}

.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
  transform: translate(0, -25%);
}

.modal.show .modal-dialog {
  transform: translate(0, 0);
}

.modal-open .modal {
  overflow-x: hidden;
  overflow-y: auto;
}

.modal#open_case_result {
  max-width: max-content;
  margin: 0 auto;
  height: max-content;
  background: var(--bg-card);
}

/* Modal dialog */
.modal-dialog {
  position: relative;
  width: auto;
  margin: 10px;
  pointer-events: none;
}

.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - (10px * 2));
}

.modal-dialog-centered::before {
  display: block;
  height: calc(100vh - (10px * 2));
  content: "";
}

/* Modal content */
.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
}

/* Modal header */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 15px;
  border-top-left-radius: 0.3rem;
  border-top-right-radius: 0.3rem;
}

.modal-header .close {
  padding: 15px;
  margin: -15px -15px -15px auto;
}

/* Modal body */
.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 15px;
}

/* Modal footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 15px;
  border-top: 1px solid #e9ecef;
  border-bottom-right-radius: 0.3rem;
  border-bottom-left-radius: 0.3rem;
}

.modal-footer > :not(:first-child) {
  margin-left: 0.25rem;
}

.modal-footer > :not(:last-child) {
  margin-right: 0.25rem;
}

/* Modal title */
.modal-title {
  margin-bottom: 0;
  line-height: 1.5;
}

/* Close button */
.close {
  float: right;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: #000;
  text-shadow: 0 1px 0 #fff;
  opacity: 0.5;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
  opacity: 0.75;
}

.close:not(:disabled):not(.disabled) {
  cursor: pointer;
}

button.close {
  padding: 0;
  background-color: transparent;
  border: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}


/* Modal animations */
@keyframes modalSlideIn {
  from {
    transform: translate3d(0, -25%, 0);
    opacity: 0;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes modalSlideOut {
  from {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
  to {
    transform: translate3d(0, -25%, 0);
    opacity: 0;
  }
}

.modal.fade .modal-dialog {
  animation: modalSlideIn 0.3s ease-out;
}

.modal.fade:not(.show) .modal-dialog {
  animation: modalSlideOut 0.3s ease-in;
}

/* Custom modal styles for rw18 template */
.modal-dialog-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
}

.modal-dialog-centered::before {
  display: none;
}

.modal#prize {
  max-width: 580px;
  margin: 0 auto;
}

.modal-title {
  color: #fff;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  font-size: 20px;
}

.modal-body {
  background: transparent;
  padding: 30px 20px;
  text-align: center;
}

.modal-footer {
  border-top: 1px solid #444;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0 0 8px 8px;
  justify-content: center;
}

.close {
  color: #fff;
  opacity: 0.7;
  text-shadow: none;
  font-size: 24px;
}

.close:hover,
.close:focus {
  color: #fff;
  opacity: 1;
}

/* Custom styles for win modal */
#win-modal .modal-content {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border: 1px solid #444;
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
  max-width: 450px;
}

#win-modal .modal-header {
  border-bottom: 1px solid #444;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px 12px 0 0;
  padding: 20px;
}

#win-modal .modal-title {
  color: #fff;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  font-size: 22px;
  margin: 0;
}

#win-modal .modal-body {
  background: transparent;
  padding: 40px 30px;
  position: relative;
}

#win-modal .win-subtitle {
  color: #ccc;
  margin-bottom: 25px;
  font-size: 18px;
  font-weight: 500;
}

#win-modal .win-item-name {
  color: #fff;
  margin: 25px 0;
  font-size: 26px;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  line-height: 1.3;
}

#win-modal .win-item-description {
  color: #aaa;
  margin: 20px 0 30px;
  font-size: 14px;
  line-height: 1.4;
}

#win-modal .win-light-beam {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 250px;
  border-radius: 50%;
  z-index: -1;
  opacity: 0.4;
  pointer-events: none;
}

#win-modal #continue-btn {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  border: none;
  border-radius: 30px;
  padding: 15px 35px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
  color: #fff;
  font-size: 14px;
  min-width: 150px;
}

#win-modal #continue-btn:hover {
  background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
  color: #fff;
}

#win-modal #continue-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}

/* Rarity colors for continue button */
#win-modal #continue-btn.orange {
  background: linear-gradient(135deg, #f7e3a0 0%, #d8b38a 100%);
  box-shadow: 0 4px 15px rgba(247, 227, 160, 0.3);
  color: #333;
}

#win-modal #continue-btn.orange:hover {
  background: linear-gradient(135deg, #d8b38a 0%, #c4a574 100%);
  box-shadow: 0 6px 20px rgba(247, 227, 160, 0.4);
  color: #333;
}

#win-modal #continue-btn.red {
  background: linear-gradient(135deg, #fbabb8 0%, #ec8492 100%);
  box-shadow: 0 4px 15px rgba(251, 171, 184, 0.3);
  color: #333;
}

#win-modal #continue-btn.red:hover {
  background: linear-gradient(135deg, #ec8492 0%, #e06b7e 100%);
  box-shadow: 0 6px 20px rgba(251, 171, 184, 0.4);
  color: #333;
}

#win-modal #continue-btn.purple {
  background: linear-gradient(135deg, #fb9ed5 0%, #ec85d7 100%);
  box-shadow: 0 4px 15px rgba(251, 158, 213, 0.3);
  color: #333;
}

#win-modal #continue-btn.purple:hover {
  background: linear-gradient(135deg, #ec85d7 0%, #e06cc9 100%);
  box-shadow: 0 6px 20px rgba(251, 158, 213, 0.4);
  color: #333;
}

#win-modal #continue-btn.blue {
  background: linear-gradient(135deg, #b2a9fa 0%, #5655d3 100%);
  box-shadow: 0 4px 15px rgba(178, 169, 250, 0.3);
  color: #fff;
}

#win-modal #continue-btn.blue:hover {
  background: linear-gradient(135deg, #5655d3 0%, #4a4bb8 100%);
  box-shadow: 0 6px 20px rgba(178, 169, 250, 0.4);
  color: #fff;
}

#win-modal #continue-btn.military {
  background: linear-gradient(135deg, #9ebffb 0%, #6695ff 100%);
  box-shadow: 0 4px 15px rgba(158, 191, 251, 0.3);
  color: #fff;
}

#win-modal #continue-btn.military:hover {
  background: linear-gradient(135deg, #6695ff 0%, #4d7cff 100%);
  box-shadow: 0 6px 20px rgba(158, 191, 251, 0.4);
  color: #fff;
}

/* Rarity colors for item name */
#win-modal .win-item-name.orange {
  color: #f7e3a0;
  text-shadow: 0 2px 4px rgba(247, 227, 160, 0.3);
}

#win-modal .win-item-name.red {
  color: #fbabb8;
  text-shadow: 0 2px 4px rgba(251, 171, 184, 0.3);
}

#win-modal .win-item-name.purple {
  color: #fb9ed5;
  text-shadow: 0 2px 4px rgba(251, 158, 213, 0.3);
}

#win-modal .win-item-name.blue {
  color: #b2a9fa;
  text-shadow: 0 2px 4px rgba(178, 169, 250, 0.3);
}

#win-modal .win-item-name.military {
  color: #9ebffb;
  text-shadow: 0 2px 4px rgba(158, 191, 251, 0.3);
}

/* Light beam rarity colors */
#win-modal .win-light-beam.orange {
  background: radial-gradient(circle, rgba(247, 227, 160, 0.3) 0%, transparent 70%);
}

#win-modal .win-light-beam.red {
  background: radial-gradient(circle, rgba(251, 171, 184, 0.3) 0%, transparent 70%);
}

#win-modal .win-light-beam.purple {
  background: radial-gradient(circle, rgba(251, 158, 213, 0.3) 0%, transparent 70%);
}

#win-modal .win-light-beam.blue {
  background: radial-gradient(circle, rgba(178, 169, 250, 0.3) 0%, transparent 70%);
}

#win-modal .win-light-beam.military {
  background: radial-gradient(circle, rgba(158, 191, 251, 0.3) 0%, transparent 70%);
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .modal-dialog-centered {
    padding: 10px;
  }
  
  #win-modal .modal-content {
    max-width: 100%;
    margin: 0;
  }
  
  #win-modal .modal-body {
    padding: 30px 20px;
  }
  
  #win-modal .win-item-name {
    font-size: 22px;
  }
  
  #win-modal .win-light-beam {
    width: 200px;
    height: 200px;
  }
}