/* 
  ANIMATED RECEIPT STYLES 
  Inspired by the provided reference video
*/

.receipt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(245, 245, 240, 0.98);
  z-index: 10000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  font-family: var(--font-body);
  overflow-y: auto;
  cursor: none;
  padding: 60px 0;
}

.receipt-overlay.active {
  display: flex;
}

.printer-container {
  position: relative;
  width: 340px;
  perspective: 1000px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The actual printer slot - Modern Minimalist Design */
.printer-machine {
  width: 360px;
  height: 120px;
  background: linear-gradient(145deg, #e6e6e6, #ffffff);
  border-radius: 12px 12px 0 0;
  position: relative;
  z-index: 20;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.1),
    inset 0 1px 1px rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ddd;
}

/* Golden accents to match video aesthetic */
.printer-machine::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #d4af37, #f1c40f, #d4af37);
  border-radius: 12px 12px 0 0;
}

/* The slot where paper comes out */
.printer-slot-wrapper {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 20px;
  background: #eee;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.printer-slot {
  width: 290px;
  height: 6px;
  background: #222;
  border-radius: 3px 3px 0 0;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* The paper that rolls out */
.receipt-paper {
  width: 280px;
  background: #fff;
  padding: 40px 25px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 10;
  transform: translateY(-100%);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  border-bottom: 2px dashed #ddd;
  background-image: radial-gradient(#eee 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  background-position: 0 0;
}

/* Serrated edge at the bottom */
.receipt-paper::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 100%;
  height: 10px;
  background: linear-gradient(-45deg, transparent 5px, #fff 5px), linear-gradient(45deg, transparent 5px, #fff 5px);
  background-size: 10px 10px;
  background-repeat: repeat-x;
}

.receipt-paper.printing {
  animation: printReceipt 4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes printReceipt {
  0% {
    transform: translateY(-100%);
    opacity: 0;
    max-height: 0;
  }

  10% {
    opacity: 1;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
    max-height: 800px;
  }
}

/* Receipt Content Typography */
.receipt-header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
}

.receipt-logo-container {
  margin-bottom: 15px;
}

.receipt-logo-container img {
  width: 100px;
  height: auto;
  filter: grayscale(1);
}

.receipt-status {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #22c55e;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.1em;
}

.receipt-price-large {
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1;
  color: var(--black);
  margin-bottom: 10px;
}

.receipt-date {
  font-family: var(--font-mono);
  font-size: 9px;
  opacity: 0.4;
  margin-top: 5px;
}

.receipt-divider {
  border-top: 1px dashed #ccc;
  margin: 20px 0;
  position: relative;
}

.receipt-items {
  margin-bottom: 30px;
}

.receipt-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.receipt-item-name {
  font-weight: 600;
  color: #444;
}

.receipt-item-price {
  font-weight: 700;
  color: var(--black);
}

.receipt-totals {
  border-top: 1px solid #000;
  padding-top: 15px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.receipt-row span:first-child {
  opacity: 0.6;
}

.receipt-row.total {
  font-weight: 800;
  font-size: 18px;
  margin-top: 12px;
  color: var(--black);
}

.receipt-row.total span:first-child {
  opacity: 1;
}

/* Success Message */
.print-success-message {
  text-align: center;
  margin-top: 50px;
  opacity: 0;
  transform: translateY(20px);
}

.print-success-message.visible {
  animation: fadeUp 0.8s ease 0s forwards;
  position: relative;
  z-index: 999999;
}

.print-btn-group {
  margin-top: 30px;
  display: flex;
  gap: 15px;
  position: relative;
  z-index: 999999;
}

.receipt-download-btn {
  padding: 14px 28px;
  background: var(--black);
  color: var(--white);
  border: 1px solid var(--black);
  font-family: var(--font-condensed);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: 0.3s;
  cursor: pointer;
}

.receipt-download-btn:hover {
  background: transparent;
  color: var(--black);
}

.receipt-download-btn svg {
  transition: transform 0.3s;
}

.receipt-download-btn:hover svg {
  transform: translateY(2px);
}

/* Micro-animations */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Paper "wiggle" as it comes out */
@keyframes paperWiggle {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(1px);
  }

  75% {
    transform: translateX(-1px);
  }
}

.receipt-paper.printing {
  animation:
    printReceipt 4s cubic-bezier(0.25, 1, 0.5, 1) forwards,
    paperWiggle 0.2s infinite;
}

/* Printer "In Use" Light */
.printer-machine::after {
  content: "";
  position: absolute;
  top: 20px;
  right: 20px;
  width: 8px;
  height: 8px;
  background: #ff0000;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

.receipt-overlay.active .printer-machine::after {
  animation: blink 0.5s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
  }

  50% {
    opacity: 0.4;
  }
}