/* =========================================
   🎨 THEME & VARIABLES
   ========================================= */
:root {
    --bg-color: #2c3e50;
    --receipt-bg: #fff;
    --text-primary: #333;
    --text-secondary: #666;
    --accent-font: 'Impact', sans-serif;
    --mono-font: 'Courier New', monospace;
    --base-font: 'Microsoft YaHei', sans-serif;
    
    --spacing-sm: 5px;
    --spacing-md: 10px;
    --spacing-lg: 20px;
    --receipt-width: 380px;
}

/* =========================================
   🛠️ RESET & LAYOUT
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-color);
    font-family: var(--mono-font), var(--base-font);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
    color: var(--text-primary);
}

/* =========================================
   🧾 RECEIPT CONTAINER
   ========================================= */
.receipt-container {
    background: var(--receipt-bg);
    width: 100%;
    max-width: var(--receipt-width);
    padding: 30px 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative; /* 保持相对定位用于装饰元素 */
    filter: drop-shadow(0px 2px 3px rgba(0,0,0,0.2));
    z-index: 1;
}

/* 锯齿边缘效果 */
.receipt-container::before,
.receipt-container::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 10px;
    background-size: 20px 20px;
    background-image: 
        linear-gradient(135deg, transparent 33%, var(--receipt-bg) 33%, var(--receipt-bg) 66%, transparent 66%),
        linear-gradient(45deg, transparent 33%, var(--receipt-bg) 33%, var(--receipt-bg) 66%, transparent 66%);
}

.receipt-container::before { top: -10px; background-position: top; }
.receipt-container::after { bottom: -10px; background-position: bottom; transform: rotate(180deg); }

/* =========================================
   📝 TYPOGRAPHY & COMPONENTS
   ========================================= */
.header { 
    text-align: center; 
    margin-bottom: var(--spacing-lg); 
    border-bottom: 2px dashed var(--text-primary); 
    padding-bottom: 15px; 
}

.title { 
    font-size: 24px; 
    font-weight: 900; 
    letter-spacing: 2px; 
    margin-bottom: var(--spacing-sm); 
    text-transform: uppercase; 
}

/* 标题点击交互 */
.title span {
    cursor: pointer;       
    user-select: none;     
    transition: opacity 0.2s;
    border-bottom: 1px solid transparent;
}
.title span:hover {
    opacity: 0.6;          
    border-bottom: 1px dashed #000;
}

.sub-title { font-size: 12px; color: var(--text-secondary); }
.mt-5 { margin-top: 5px; }
.mt-10 { margin-top: 10px; }

.divider { border-top: 1px dashed var(--text-primary); margin: 15px 0; width: 100%; }
.double-divider { border-top: 3px double var(--text-primary); margin: 15px 0; }

.row { 
    display: flex; 
    justify-content: space-between; 
    align-items: baseline; 
    margin-bottom: 8px; 
    font-size: 14px; 
}
.row.large { margin-top: 5px; align-items: center; }
.row.center-row { justify-content: center; }

.label { font-weight: bold; color: #000; }
.value { text-align: right; width: 100%; }

.highlight-num { 
    font-size: 28px; 
    font-weight: bold; 
    font-family: var(--accent-font); 
}
.highlight-num span { 
    font-size: 14px; 
    font-weight: normal; 
    font-family: var(--mono-font); 
    margin-left: 2px; 
}
.highlight-num.large-text { font-size: 24px; }

.countdown-section { margin-top: 5px; }
.event-name { font-weight: bold; font-size: 16px; margin-bottom: 2px; }
.date-small { font-size: 12px; color: var(--text-secondary); }
.small-text { font-size: 12px; }

/* =========================================
   📊 GRAPHICS & ANIMATION
   ========================================= */
#barcode { width: 100%; height: 40px; margin-top: 20px; cursor: pointer; }

/* =========================================
   💬 MESSAGE PAGE STYLES
   ========================================= */
.input-group { margin-bottom: 15px; width: 100%; }
input[type="text"], textarea {
    width: 100%;
    padding: 8px;
    font-family: var(--mono-font);
    border: 1px solid #333;
    background: #f9f9f9;
    outline: none;
    resize: none;
    font-size: 14px;
}
input[type="text"]:focus, textarea:focus { background: #fff; border-color: #000; }

button {
    width: 100%;
    padding: 12px;
    background: #000;
    color: #fff;
    font-family: var(--mono-font);
    font-weight: bold;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: opacity 0.2s;
}
button:hover { opacity: 0.8; }
button:disabled { background: #999; cursor: not-allowed; }

.message-list { margin-top: 20px; max-height: 400px; overflow-y: auto; }
.message-item { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px dashed #ccc; }
.center-text { text-align: center; width: 100%; }

/* =========================================
   ⚙️ CONFIG MODAL (修复定位问题)
   ========================================= */
.modal-overlay {
    position: fixed; /* 强制固定在视口 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* 半透明遮罩 */
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    z-index: 9999; /* 确保在最上层 */
    backdrop-filter: blur(2px);
}

.modal-content {
    background: #fff;
    width: 360px; /* 稍微宽一点 */
    max-width: 90%;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    position: relative;
    /* 同样添加锯齿边框效果 */
}
.modal-content::before, .modal-content::after {
    content: ""; position: absolute; left: 0; width: 100%; height: 6px; background-size: 12px 12px;
    background-image: linear-gradient(135deg, transparent 33%, #fff 33%, #fff 66%, transparent 66%),
                      linear-gradient(45deg, transparent 33%, #fff 33%, #fff 66%, transparent 66%);
}
.modal-content::before { top: -6px; background-position: top; }
.modal-content::after { bottom: -6px; background-position: bottom; transform: rotate(180deg); }

/* 修复弹窗标题光标 */
.modal-content .title span {
    cursor: default !important;
    border-bottom: none !important;
}
.modal-content .title span:hover { opacity: 1 !important; }

/* 编辑列表样式 */
.config-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 15px 0;
    padding-right: 5px;
}

.edit-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    width: 100%;
}

.edit-input {
    flex: 1;
    min-width: 0;
    padding: 5px;
    font-family: var(--mono-font);
    border: none;
    border-bottom: 1px solid #ccc;
    background: transparent;
    outline: none;
    font-size: 14px;
}
.edit-input:focus { border-bottom: 1px solid #000; }

/* 删除按钮优化：防止误触 */
.btn-delete {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0;
    padding: 0 !important;
    background: transparent !important;
    color: #ccc !important;
    font-size: 18px;
    line-height: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-delete:hover {
    color: #ff4444 !important;
    background: rgba(0,0,0,0.05) !important;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}
.btn-secondary { background: #ccc; color: #333; }
.btn-secondary:hover { background: #bbb; }
