/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Replace colorful emojis with black and white alternatives */
.receipt-content .emoji {
    filter: grayscale(1) contrast(3) brightness(0.3);
    font-family: 'Courier New', monospace;
}

/* Target specific emoji characters for thermal printer compatibility */
.receipt-content {
    /* Convert common emojis to black symbols */
    font-variant-emoji: text;
}

/* Virtual printer animation - applied directly to receipt container */
.virtual-receipt {
    animation: printSlideUp 3s ease-out 1s forwards;
    animation-fill-mode: both;
    transform: translateY(100%);
    position: relative;
    overflow: visible;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* OBS Transparency Mode - Make everything transparent except the receipt paper */
body.obs-transparent-mode {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Hide debug panel and warnings in OBS mode */
body.obs-transparent-mode .debug-panel,
body.obs-transparent-mode .warning-chip,
body.obs-transparent-mode .help-popup {
    display: none !important;
}

/* Remove shadows in OBS mode for cleaner transparency */
body.obs-transparent-mode .virtual-printer-wrapper {
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Virtual printer overlays */
.printer-back {
    position: fixed;
    bottom: -300px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    pointer-events: none;
    animation: printerSlideUp 1s ease-out forwards;
}

.printer-front {
    position: fixed;
    bottom: -300px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    pointer-events: none;
    animation: printerSlideUp 1s ease-out forwards;
}

/* Ensure receipt is above back but below front */
.virtual-receipt {
    z-index: 10;
}

.printer-back img,
.printer-front img {
    display: block;
    max-width: 100vw;
    height: auto;
}

@keyframes printerSlideUp {
    0% {
        bottom: -550px; /* Start 550px below viewport bottom */
    }
    100% {
        bottom: -300px; /* End at normal printer position */
    }
}

@keyframes printSlideUp {
    0% {
        transform: translateY(100vh); /* Start from bottom of viewport */
        opacity: 0.8;
    }
    10% {
        opacity: 0.9;
    }
    20% {
        opacity: 1;
    }
    100% {
        /* Stop 100px above viewport bottom - receipt comes out of printer */
        transform: translateY(calc(100vh - var(--receipt-height, 400px) - 100px));
        opacity: 1;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #f0f0f0;
    padding: 20px;
    line-height: 1.4;
}

/* Print page setup */
@page {
    size: var(--paper-size, 80mm) auto;
    margin: 0;
}

/* Receipt container */
#receipt-container {
    background: white;
    width: var(--paper-width-mm, 80mm);
    max-width: var(--paper-width-px, 640px);
    padding: var(--paper-margin, 2mm);
    margin: 0 auto 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

/* Common receipt elements */
.receipt-logo {
    display: block;
    max-width: 80px;
    height: auto;
    margin: 0 auto 8px;
}

.receipt-title {
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 12px;
}

.user-info {
    margin: 12px 0;
}

.user-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}

.user-display-name {
    font-weight: bold;
    font-size: 14px;
}

.user-handle {
    font-size: 12px;
    color: #666;
}

.event-headline {
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    margin: 12px 0;
}

.event-amount {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
}

.receipt-footer {
    margin-top: 16px;
    padding-top: 8px;
    border-top: 1px dashed #000;
    text-align: center;
    font-size: 12px;
}

.positive-message {
    font-style: italic;
    margin: 8px 0;
    background: white;
    color: black;
    padding: 4px 8px;
    border-radius: 3px;
}

.timestamp {
    font-size: 10px;
    color: #666;
}

/* Design 1: Classic Register */
.design-1 .receipt-title {
    border-bottom: 2px solid #000;
    padding-bottom: 4px;
}

.design-1 .info-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0;
    position: relative;
}

.design-1 .info-line::after {
    content: '................................................................................................';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    font-size: 10px;
    letter-spacing: 1px;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
}

.design-1 .info-label,
.design-1 .info-value {
    background: white;
    padding: 0 4px;
}

.design-1 .user-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}

.design-1 .receipt-footer {
    background: #000;
    color: white;
    margin: 16px -8px -8px;
    padding: 8px;
}

/* Design 2: Arcade Ticket */
.design-2 {
    border-top: 6px solid #000;
    border-bottom: 6px solid #000;
    position: relative;
}

.design-2::before,
.design-2::after {
    content: '◢◣◢◣◢◣◢◣◢◣◢◣◢◣◢◣';
    display: block;
    text-align: center;
    font-size: 12px;
    letter-spacing: 2px;
    margin: 4px 0;
}

.design-2 .user-avatar {
    width: 128px;
    height: 128px;
    display: block;
    margin: 0 auto 8px;
    border: 3px solid #000;
}

.design-2 .user-display-name {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.design-2 .event-headline {
    background: #000;
    color: white;
    padding: 8px;
    margin: 12px 0;
    border-radius: 20px;
}

.design-2 .ticket-code {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    margin-top: 12px;
    opacity: 0.7;
}

/* Design 3: Polaroid Stamp */
.design-3 .photo-frame {
    background: white;
    border: 8px solid #000;
    border-bottom: 20px solid #000;
    width: fit-content;
    margin: 0 auto 12px;
    box-shadow: inset 0 0 0 2px white;
}

.design-3 .user-avatar {
    width: 160px;
    height: 160px;
    border-radius: 0;
    display: block;
}

.design-3 .stamp-block {
    border: 3px solid #000;
    padding: 8px;
    margin: 12px 0;
    position: relative;
}

.design-3 .stamp-block::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 1px solid #000;
    pointer-events: none;
}

.design-3 .photo-caption {
    text-align: center;
    font-size: 12px;
    margin-top: 8px;
}

/* Design 4: Magazine Column */
.design-4 {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 8px;
    align-items: start;
}

.design-4 .icon-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
}

.design-4 .event-icon {
    width: 24px;
    height: 24px;
    background: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.design-4 .content-column {
    border-left: 1px solid #ccc;
    padding-left: 8px;
}

.design-4 .event-headline {
    text-align: left;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
    border-bottom: 1px solid #000;
    padding-bottom: 4px;
}

.design-4 .metadata-row {
    font-size: 10px;
    color: #666;
    margin: 2px 0;
    padding: 2px 0;
    border-bottom: 1px solid #eee;
}

/* Design 5: Bold Blocks */
.design-5 .block {
    margin: 0 -8px;
    padding: 12px 8px;
}

.design-5 .block:nth-child(odd) {
    background: #000;
    color: white;
}

.design-5 .block:nth-child(even) {
    background: white;
    color: #000;
    border: 2px solid #000;
}

.design-5 .dot-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    margin: 8px 0;
}

.design-5 .dot {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
}

.design-5 .dot.empty {
    background: transparent;
    border: 1px solid currentColor;
}

/* Debug panel styles */
.debug-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.debug-header h3 {
    margin: 0;
    font-size: 16px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.debug-content {
    padding: 16px;
}

.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #333;
}

.control-group input,
.control-group select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.control-group.toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group.toggles label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.control-group.toggles input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.control-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: white;
    color: #333;
}

.btn-secondary:hover {
    background: #f8f9fa;
}

/* Warning chip */
.warning-chip {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffc107;
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Help popup */
.help-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.help-content {
    background: white;
    border-radius: 8px;
    max-width: 800px;
    max-height: 80vh;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.help-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.help-body {
    overflow-y: auto;
    padding: 20px 24px;
    flex: 1;
}

.help-body pre {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.help-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #eee;
    text-align: center;
    flex-shrink: 0;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.font-mono {
    font-family: 'Courier New', monospace;
}

.font-bold {
    font-weight: bold;
}

/* High-ink mode (debug toggle) */
.high-ink-mode * {
    font-weight: bold !important;
}

/* Show outlines mode (debug toggle) */
.show-outlines * {
    outline: 1px solid red !important;
}

/* Extra sections styling */
.extra-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px dashed #000;
}

.extra-section.fortune-cookie {
    text-align: center;
}

.fortune-icon {
    font-size: 16px;
    margin-bottom: 8px;
}

.fortune-slip {
    border: 2px solid #000;
    padding: 12px;
    margin: 8px auto;
    max-width: 200px;
    position: relative;
    background: white;
}

.fortune-slip::before,
.fortune-slip::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border: 2px solid #000;
    top: -2px;
}

.fortune-slip::before {
    left: 20px;
    transform: rotate(45deg);
}

.fortune-slip::after {
    right: 20px;
    transform: rotate(45deg);
}

.fortune-text {
    font-size: 11px;
    line-height: 1.3;
}

.fortune-author {
    font-size: 10px;
    text-transform: uppercase;
    margin-top: 6px;
    opacity: 0.8;
}

.extra-section.dad-joke {
    text-align: center;
}

.joke-banner {
    background: #000;
    color: white;
    padding: 6px 12px;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 12px;
}

.joke-setup {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    margin-bottom: 8px;
    padding: 0 8px;
}

.joke-punchline {
    background: #000;
    color: white;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
}

.extra-section.timeline {
    font-size: 10px;
}

.timeline-header {
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.timeline-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0;
    position: relative;
}

.timeline-row::after {
    content: '.............................................................................................';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    font-size: 8px;
    letter-spacing: 1px;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
}

.timeline-icon,
.timeline-value {
    background: white;
    padding: 0 4px;
}

.timeline-totals {
    border-top: 1px solid #000;
    margin-top: 8px;
    padding-top: 8px;
    font-weight: bold;
}

.extra-section.word-search {
    text-align: center;
}

.puzzle-title {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 12px;
}

.puzzle-grid {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.puzzle-words {
    font-size: 10px;
    text-transform: uppercase;
}

.extra-section.newspaper {
    font-size: 10px;
}

.newspaper-masthead {
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    border-bottom: 3px solid #000;
    margin-bottom: 12px;
    padding-bottom: 4px;
}

.newspaper-headline {
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.newspaper-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.newspaper-columns.single-column {
    grid-template-columns: 1fr;
}

.newspaper-column {
    padding: 8px;
    border: 1px solid #000;
}

.newspaper-column h4 {
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.newspaper-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 8px;
}

.stat-box {
    border: 1px solid #000;
    padding: 4px;
    text-align: center;
    font-size: 9px;
}

.stat-value {
    font-weight: bold;
    font-size: 11px;
}

/* Stream Baby styling */
.stream-baby {
    margin-top: 16px;
    padding: 12px 8px;
    border: 3px solid #000;
    text-align: center;
    background: white;
}

.baby-icon {
    font-size: 20px;
    margin-bottom: 8px;
}

.baby-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 6px;
}

.baby-class {
    font-size: 12px;
    margin-bottom: 8px;
}

.baby-class.mythic {
    background: #000;
    color: white;
    padding: 4px 8px;
    margin: 6px auto;
    display: inline-block;
}

.baby-traits {
    font-size: 10px;
    margin-bottom: 8px;
    line-height: 1.3;
}

.baby-flavor {
    font-size: 10px;
    font-style: italic;
    margin-bottom: 6px;
}

.baby-footer {
    font-size: 9px;
    opacity: 0.8;
    border-top: 1px solid #000;
    padding-top: 6px;
    margin-top: 8px;
}

/* Status Shout-out styling */
.status-shoutout {
    background: #000;
    color: white;
    text-align: center;
    padding: 4px 8px;
    margin: 8px 0;
    font-size: 11px;
    font-weight: bold;
}

.status-shoutout .status-badge {
    margin-right: 4px;
}

/* Print styles */
@media print {
    body {
        background: white;
        padding: 0;
        margin: 0;
    }
    
    #receipt-container {
        box-shadow: none;
        margin: 0;
        width: 100%;
        max-width: none;
    }
    
    .debug-panel,
    .warning-chip,
    .help-popup {
        display: none !important;
    }
    
    /* Ensure images print in black and white */
    img {
        filter: none;
        -webkit-filter: none;
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .debug-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: none;
    }
}