/* 인쇄 설정 - 페이지 번호 및 URL 숨기기 */
@page {
    size: A4 portrait;
    margin: 0;
    /* 페이지 인쇄 머리글/바닥글 숨기기 */
    marks: none;
}

body {
    font-family: 'Malgun Gothic', sans-serif;
    line-height: 1.4;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    font-size: 12px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 모든 요소에 텍스트 렌더링 최적화 적용 */
* {
    text-rendering: optimizeLegibility !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* 텍스트 선명도 향상 */
td, th, p, div, span, li {
    text-shadow: 0 0 0 #000;
}

/* 컨테이너 스타일 */
.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h1, h2 {
    color: #333;
    text-align: center;
    margin-bottom: 15px;
    font-weight: 600;
}

/* 폼 섹션 스타일 */
.form-section {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
}

.hardware-item {
    margin-bottom: 8px;
    padding: 8px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.hardware-item label {
    margin-bottom: 3px;
    font-weight: bold;
    flex: 1;
}

.price-input-container {
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.price-input {
    width: 80px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: right;
    margin-right: 5px;
}

.hardware-details {
    margin-left: 20px;
    margin-top: 10px;
    display: none;
    width: 100%;
}

input[type="checkbox"] {
    margin-right: 6px;
}

/* 버튼 스타일 */
button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 12px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
    font-weight: 500;
}

.select-all-btn {
    background-color: #2196F3;
    margin-bottom: 10px;
}

.save-button {
    background-color: #2196F3;
    width: 200px;
    margin: 15px auto 4px auto;
    display: block;
}

/* 고객 정보 섹션 스타일 */
.customer-input-section {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.customer-input-section label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.customer-input-section input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

/* 보고서 컨테이너 스타일 */
.report-container {
    display: none;
    width: 210mm;
    min-height: 297mm;
    height: auto;
    margin: 0 auto !important;
    background: white;
    padding: 10mm;
    box-sizing: border-box;
    position: relative;
    text-align: center !important; /* 내부 콘텐츠 정렬 */
}

.report-content {
    min-height: 267mm; /* 297mm - 30mm 패딩 */
    display: flex;
    flex-direction: column;
    margin: 0 auto !important;
    text-align: left !important; /* 텍스트는 왼쪽 정렬 유지 */
}

/* 보고서 제목 스타일 - 브레이크 있도록 */
.report-title {
    font-size: 22px;
    font-weight: 700 !important;
    text-align: center;
    margin-bottom: 10px;
    letter-spacing: 1px !important;
    line-height: 1.5;
    text-shadow: 0 0 0 #000 !important;
}

.customer-info {
    margin-bottom: 20px;
    position: relative;
    background-color: #f9f9f9;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.customer-info p {
    margin: 8px 0;
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
}

.customer-info strong {
    display: inline-block;
    width: 70px;
    color: #555;
    font-weight: 600;
}

.customer-info span {
    font-weight: 500;
    color: #2980b9;
    margin-left: 5px;
}

/* 테이블 컨테이너 스타일 */
.table-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin: 0 auto !important;
    width: 100% !important;
}

/* 보고서 항목 테이블 스타일 */
.report-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    font-size: 11px;
}

.report-items th, .report-items td {
    border: 1px solid #ddd;
    padding: 1px !important;
    vertical-align: middle;
}

.report-items th {
    background-color: #f2f2f2;
    text-align: center;
    font-size: 11px;
    font-weight: 600 !important;
}

.report-items td {
    font-size: 11px;
    font-weight: 500 !important;
}

.report-items td:nth-child(2) {
    white-space: normal;
}

.report-items td:first-child, .report-items td:last-child {
    text-align: center;
}

/* 빈 공간 완전 제거하여 공간 확보 */
.empty-space {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 세부 항목 스타일 */
.detail-item {
    display: block;
    margin-bottom: 3px;
    text-indent: -8px;
    padding-left: 8px;
    font-size: 10px;
    line-height: 1.3;
    font-weight: 500;
}

/* 세금 정보 스타일 */
.tax-info {
    margin-top: auto;
    padding-top: 5px;
    width: 100%;
}

.tax-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    border: 1px solid #ddd;
}

.tax-header th {
    background-color: #f8f8f8;
    color: #333;
    font-size: 12px;
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
}

.tax-table td {
    padding: 2px 5px !important;
    border-bottom: 1px solid #eee;
    font-size: 11px;
    vertical-align: middle;
    font-weight: 500;
}

.amount {
    text-align: right;
    font-weight: 600 !important;
}

.total-row {
    background-color: #f8f8f8;
}

.total-amount {
    text-align: right;
    font-weight: 600 !important;
    font-size: 12px;
    color: #e74c3c;
}

.tax-note {
    font-size: 9px;
    color: #666;
    margin-top: 5px;
    padding: 5px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 3px;
    line-height: 1.3;
}

.tax-note p {
    margin: 0;
    font-weight: 500;
}

/* 결제 정보 스타일 */
.payment-info {
    margin-top: 5px !important;
    border-top: 1px solid #eee;
    padding-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.account-info, .receipt-info {
    width: 100%;
    padding: 8px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 3px;
    box-sizing: border-box;
}

.info-title {
    font-weight: bold;
    font-size: 11px;
    margin: 0 0 8px 0;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.account-number {
    font-weight: bold;
    font-size: 12px;
    color: #2980b9;
    margin: 5px 0;
}

.receipt-info ul {
    margin: 5px 0;
    padding-left: 15px;
    font-size: 10px;
    line-height: 1.4;
}

.receipt-info li {
    margin-bottom: 3px;
    font-weight: 500;
}

/* 도장 및 감사 인사 스타일 */
.stamp {
    margin-top: 10px !important;
    padding-top: 5px !important;
    text-align: center !important;
    position: relative;
    border-top: 1px dashed #ddd !important;
}

.thanks-message {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #333 !important;
    margin: 15px 0 10px 0 !important;
    display: block !important; /* 확실히 표시되도록 */
    text-shadow: 0 0 0 #000 !important;
}

.official-seal {
    width: 45px;
    height: 45px;
    position: absolute;
    right: 0;
    top: -5px;
}

/* 회사 정보 헤더 스타일 */
.business-table-container {
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.business-header {
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
}

.business-logo {
    display: flex;
    align-items: center;
}

.logo-placeholder {
    width: 40px;
    height: 40px;
    background-color: #2980b9;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    margin-right: 12px;
}

.business-name {
    font-size: 18px;
    margin: 0;
    color: #333;
    font-weight: 700 !important;
}

.business-stamp {
    display: flex;
    align-items: center;
    position: relative;
}

.representative {
    font-size: 12px;
    margin-right: 50px;
    color: #555;
    font-weight: 500;
}

.business-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 0;
    background-color: white;
}

.business-info-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

.business-info-item:nth-child(odd) {
    border-right: 1px solid #eee;
}

.business-info-item.full-width {
    grid-column: span 2;
    border-right: none;
}

.info-label {
    font-weight: 600 !important;
    color: #555;
    width: 70px;
    font-size: 11px;
}

.info-value {
    flex: 1;
    color: #333;
    font-size: 11px;
    font-weight: 500 !important;
}

/* 서비스 설명 섹션 스타일 */
.simple-service-section {
    margin: 15px 0;
    padding: 12px 15px;
    background-color: #f9f9fa;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.section-title {
    color: #2c3e50;
    font-size: 15px;
    text-align: center;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #eaeaea;
    font-weight: 600;
}

.intro-text {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 10px;
    color: #333;
    font-weight: 500;
}

.bullet-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
}

.bullet-list li {
    display: flex;
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.4;
    font-weight: 500;
}

.bullet-point {
    color: #2980b9;
    font-weight: bold;
    margin-right: 5px;
    flex-shrink: 0;
}

.bullet-text {
    color: #333;
    font-weight: 500;
}

.conclusion-text {
    font-size: 12px;
    line-height: 1.4;
    color: #333;
    background-color: #e8f4f8;
    padding: 10px;
    border-left: 3px solid #3498db;
    margin: 0;
    font-weight: 500;
}

/* 푸터 정보 스타일 */
.footer-info {
    margin-top: 5px !important;
    margin-bottom: 20px !important;
}

/* 모달 창 스타일 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    overflow-y: auto;
}

.modal-container {
    background-color: white;
    width: 95%;
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1001;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background-color: #d32f2f;
}

.modal-body {
    max-height: 80vh;
    overflow-y: auto;
    padding: 10px 0;
}

/* 미디어 쿼리 조정 */
@media (max-width: 768px) {
    .account-info, .receipt-info {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media print {
    html, body {
        width: 210mm;
        height: 297mm;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
        /* URL, 날짜, 페이지 번호 등 숨기기 */
        @page :first {
            margin-top: 0;
            margin-bottom: 0;
        }
        
        @page :left {
            margin-left: 0;
        }
        
        @page :right {
            margin-right: 0;
        }
    
    * {
        text-rendering: optimizeLegibility !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
    }
    
    .report-title, .service-title, .thanks-message {
        text-shadow: 0 0 0 #000 !important;
    }
    
    .container, .modal-close, .save-button {
        display: none !important;
    }
    
    .modal-overlay {
        position: absolute;
        background-color: white;
        overflow: visible;
        height: 297mm; /* A4 높이로 고정 */
        display: block !important;
    }
    
    .modal-container {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        height: 297mm; /* A4 높이로 고정 */
    }
    
    .modal-body {
        max-height: none;
        overflow: hidden;
        height: 297mm; /* A4 높이로 고정 */
    }
    
    .report-container {
        display: block !important;
        margin: 0;
        padding: 5mm !important; /* 10mm에서 5mm로 패딩 감소 */
        width: 194mm; /* 210mm - 16mm(padding) */
        height: 281mm; /* 297mm - 16mm(padding) */
        box-shadow: none;
        overflow: hidden; /* 넘치는 내용 숨김 */
    }
    
    .report-content {
        height: 281mm; /* 컨테이너와 동일 */
        overflow: hidden;
    }
    
    /* 공간 효율성을 위한 크기 조정 */
    .report-title {
        font-size: 18px !important;
        margin-bottom: 5px !important;
        letter-spacing: 2px !important;
    }
    
    .customer-info, .business-table-container {
        margin-bottom: 5px !important;
    }
    
    .business-info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .business-info-item.full-width {
        grid-column: span 3;
    }
    
    /* 서비스 설명 섹션 크기 조정 */
    .service-description {
        margin: 5px !important;
        padding: 8px !important;
    }
    
    .service-title {
        margin-bottom: 5px !important;
        padding-bottom: 5px !important;
    }
    
    .service-point {
        margin-bottom: 3px !important;
        padding: 4px 6px !important;
    }
    
    /* 테이블 크기 자동 조정 */
    .table-container {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .report-items {
        margin-bottom: 5px !important;
    }
    
    /* 빈 공간 자동 조정 */
    .empty-space {
        min-height: 0 !important;
        max-height: 0 !important;
    }
    
    /* 하단 정보 컴팩트하게 */
    .footer-info {
        margin-top: 5px !important;
    }
    
    .payment-info {
        margin-top: 5px !important;
    }
    
    .account-info, .receipt-info {
        padding: 5px;
    }
    
    .stamp {
        margin-top: 5px !important;
        padding-top: 5px !important;
    }
    
    /* 폰트 크기 자동 축소를 위한 클래스 */
    .auto-fit-text {
        transform-origin: top left;
    }
    
    .service-description {
        background-color: #f9f9fa !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .conclusion-text {
        background-color: #e8f4f8 !important;
        border-left: 3px solid #3498db !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    /* 세금 정보 최적화 */
    .tax-note p {
        font-size: 8px !important;
        line-height: 1.2 !important;
        margin: 0 !important;
    }
}

.service-description {
    font-family: 'Malgun Gothic', sans-serif;
    max-width: 800px;
    margin: 5px 0 !important;
    padding: 5px !important;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-left: 4px solid #3498db;
    font-size: 11px;
}
  
.service-title {
    color: #2c3e50;
    font-size: 13px !important;
    font-weight: 700 !important;
    margin: 0 0 8px 0 !important;
    padding-bottom: 5px !important;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
}
  
.service-intro {
    font-size: 11px;
    line-height: 1.4;
    margin-bottom: 10px;
    color: #333;
    font-weight: 500;
}
  
.highlight {
    color: #2980b9;
    font-weight: 700 !important;
}
  
.service-points {
    margin: 0 0 5px 0 !important;
    padding: 0;
    list-style: none;
}
  
.service-point {
    display: flex;
    margin-bottom: 2px !important;
    background-color: white;
    padding: 2px 5px !important;
    border-radius: 4px;
}
  
.bullet {
    color: #3498db;
    font-weight: bold;
    margin-right: 8px;
    flex-shrink: 0;
}
  
.point-content {
    flex: 1;
}
  
.point-title {
    font-weight: 600 !important;
    color: #2c3e50;
    display: inline;
    font-size: 11px;
}
  
.point-description {
    color: #555;
    font-size: 11px;
    line-height: 1.3;
    display: inline;
    font-weight: 500 !important;
}
  
.service-conclusion {
    background-color: #e8f4f8;
    padding: 5px !important;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}
  
.conclusion-content {
    font-size: 11px;
    line-height: 1.4;
    color: #2c3e50;
    margin: 0;
    font-weight: 500;
}
  
.expertise-section {
    margin-top: 8px;
    font-size: 10px;
    color: #666;
    font-style: italic;
    text-align: right;
    font-weight: 500;
}
  
@media print {
    .service-description {
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .service-conclusion {
        background-color: #e8f4f8 !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
}

.report-container * {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* 텔레그램 전송용 이미지 최적화 */
@media print, screen {
    .report-container {
        transform-origin: center top !important;
    }
    
    .report-content {
        transform-origin: center top !important;
    }
    
    /* 감사 인사 확실히 보이도록 마진 추가 */
    .footer-info {
        margin-bottom: 20px !important;
    }
}