@page {
    size: A4 landscape;
    margin: 0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Certificate View Styles */
body {
    font-family: 'Arial', sans-serif;
    background: #f0f0f0;
    height: 100vh;
    padding: 10px;
    /* BỎ flex trên mobile */
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Chỉ center trên màn hình rộng (desktop) */
@media (min-width: 1100px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Container wrapper để scroll ngang */
.certificate-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
}

.certificate {
    width: 1000px;
    height: 700px;
    min-width: 1000px;
    background: url('./certificate-background.jpg') center/cover;
    background-repeat: no-repeat;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
    transform-origin: center center;
    flex-shrink: 0;
    margin: 0;              /* đảm bảo sát trái */
}

/* Scroll hint cho mobile */
@media (max-width: 1020px) {
    body::before {
        content: "→ Vuốt sang phải để xem hết →";
        position: fixed;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0,0,0,0.8);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 12px;
        z-index: 1000;
        animation: fadeInOut 3s ease-in-out;
    }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Responsive - đơn giản */
@media (max-width: 500px) {
    body::before {
        content: "→ Vuốt sang phải →";
        font-size: 11px;
        top: 5px;
    }
}

/* QR Code ở góc trên phải */
.qr-corner {
    position: absolute;
    top: 558px;
    right: 461px;
    text-align: center;
    z-index: 10;
}

.qr-corner img {
    width: 80px;
    height: 80px;
    border: 2px solid #333;
    border-radius: 8px;
    background: white;
    padding: 3px;
}

.qr-corner-text {
    font-size: 8px;
    color: #333;
    margin-top: 2px;
    font-weight: bold;
}

/* Tên người nhận - container cố định */
.recipient-name {
    position: absolute;
    top: 324px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 60px;
    z-index: 10;
}

/* Căn giữa tên trong container */
.recipient-value {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 42px;
    font-weight: bold;
    color: #000;
    font-style: italic;
    font-family: 'Times New Roman', serif;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    text-align: center;
}

/* Thông tin chi tiết - positioning tuyệt đối cho từng element */
.details-overlay {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 80px;
    z-index: 10;
}

/* Container cho từng detail - cố định vị trí và kích thước */
.detail-certificate-code {
    position: absolute;
    left: 155px;
    top: -12px;
    width: 150px;
    height: 30px;
}

.detail-donor-name {
    position: absolute;
    left: 10px;
    top: 55px;
    width: 300px;
    height: 30px;
}

.detail-amount {
    position: absolute;
    left: 300px;
    top: -12px;
    width: 200px;
    height: 30px;
}

.detail-date {
    position: absolute;
    left: 325px;
    top: 158px;
    width: 150px;
    height: 30px;
}

.detail-trees {
    position: absolute;
    left: 497px;
    top: -12px;
    width: 150px;
    height: 30px;
}

.detail-company {
    position: absolute;
    left: 600px;
    top: 35px;
    width: 150px;
    height: 30px;
}

/* Căn giữa text bên trong container */
.detail-value {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 20px;
    font-weight: bold;
    color: #000;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    text-align: center;
}

/* Styling riêng cho từng loại text */
.detail-certificate-code .detail-value {
    font-size: 20px;
}

.detail-donor-name .detail-value {
    font-size: 22px;
    color: #333;
    font-weight: 700;
}

.detail-amount .detail-value {
    font-size: 24px;
    color: #e74c3c;
}

.detail-date .detail-value {
    font-size: 22px;
    color: #333;
    font-weight: 700;
}

.detail-trees .detail-value {
    font-size: 24px;
    color: #27ae60;
}

.detail-company .detail-value {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

/* Print styles */
.print-actions {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.print-actions button {
    margin-right: 10px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.btn-print {
    background: #2196F3;
    color: white;
}

.btn-print:hover {
    background: #1976D2;
}

.btn-back {
    background: #f0f0f0;
    color: #333;
}

.btn-back:hover {
    background: #e0e0e0;
}

@media print {
    body {
        background: white;
        overflow: visible;
    }
    
    .certificate {
        box-shadow: none;
        transform: none !important;
    }
    
    .print-actions {
        display: none;
    }
    
    .btn-print:hover,
    .btn-back:hover {
        background: initial;
    }
}

/* Gỡ rule cũ chặn overflow */
body#error-page {
    overflow-x: auto !important;
    overflow-y: hidden;
}

/* 
 * HƯỚNG DẪN CUSTOM VỊ TRÍ:
 * 
 * 1. Để di chuyển tên chính: thay đổi .recipient-name { top: 450px; left: 50%; }
 * 2. Để di chuyển mã chứng chỉ: thay đổi .detail-certificate-code { left: 100px; top: 0; }
 * 3. Để di chuyển tên người: thay đổi .detail-donor-name { left: 100px; top: 35px; }
 * 4. Để di chuyển số tiền: thay đổi .detail-amount { left: 350px; top: 0; }
 * 5. Để di chuyển ngày: thay đổi .detail-date { left: 350px; top: 35px; }
 * 6. Để di chuyển số cây: thay đổi .detail-trees { left: 600px; top: 0; }
 * 7. Để di chuyển tên công ty: thay đổi .detail-company { left: 600px; top: 35px; }
 * 
 * Lưu ý: left = vị trí ngang, top = vị trí dọc (đơn vị px)
 * Text sẽ tự động căn giữa trong container có kích thước cố định
 * QR code giờ sẽ trỏ trực tiếp đến trang donor-page
 * 
   * Certificate giờ có thể scroll ngang để xem hết toàn bộ nội dung
  */  