/* [VEHICLE:REPORT:STYLES] START */

/* 전역 폰트 설정 */
body {
    font-family: 'Pretendard', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    margin: 0;
    padding: 0;
    background: white;
}

/* 로딩 메시지 */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

/* 컨트롤 버튼 (헤더 내부로 이동) */
.report-controls {
    display: flex;
    gap: 6px;
}

.report-controls button {
    padding: 6px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.report-controls button i {
    font-size: 12px;
}

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

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

.btn-excel {
    background: #28a745;
    color: white;
}

.btn-excel:hover {
    background: #1e7e34;
}

/* 보고서 컨테이너 - A4 가로 */
.report-container {
    width: 297mm;
    max-width: 100%;
    margin: 0 auto;
    background: white;
    padding: 0;
}

/* 차량 페이지 - A4 가로 */
.vehicle-page {
    page-break-after: always;
    page-break-inside: avoid;
    padding: 5px;
    background: white;
}

.vehicle-page:last-child {
    page-break-after: avoid !important;
}

/* 표지가 마지막 페이지일 경우 (데이터 없음) */
.cover-page:last-child {
    page-break-after: avoid !important;
}

/* 페이지 헤더 */
.page-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 2px solid #333;
    margin-bottom: 8px;
}

.print-date {
    font-size: 11px;
    color: #444;
    font-weight: normal;
    justify-self: start;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-self: center;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    color: #000;
    font-weight: bold;
}

.vehicle-number {
    font-size: 22px;
    color: #0056b3;
    font-weight: bold;
}

.page-info {
    font-size: 11px;
    color: #444;
    font-weight: normal;
    justify-self: end;
}

/* 섹션 */
.vehicle-section {
    margin-bottom: 5px;
    page-break-inside: avoid;
}

.vehicle-section h2 {
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    margin-bottom: 8px;
    margin-top: 0;
}

/* 정보 테이블 */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.info-table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    vertical-align: top;
    font-size: 12px;
    background: #ffffff;
}

.info-table .header-cell {
    background: #f8f9fa;
    font-weight: normal;
    width: 120px;
    text-align: center;
}

.info-table .vehicle-number-bold {
    font-weight: bold;
}

/* 데이터 테이블 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
    font-size: 12px;
}

.data-table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.data-table tbody tr:nth-child(even) {
    background: #ffffff;
}

/* 담당자이력 테이블 열 너비 - 날짜 컬럼 120px로 통일 */
.data-table.manager-history th:nth-child(1),
.data-table.manager-history td:nth-child(1) { width: 120px; }
.data-table.manager-history th:nth-child(2),
.data-table.manager-history td:nth-child(2) { width: 200px; }
.data-table.manager-history th:nth-child(3),
.data-table.manager-history td:nth-child(3) { width: auto; }

/* 주행거리 테이블 열 너비 - 날짜 컬럼 120px로 통일 */
.data-table.mileage th:nth-child(1),
.data-table.mileage td:nth-child(1) { width: 120px; }
.data-table.mileage th:nth-child(2),
.data-table.mileage td:nth-child(2) { width: 200px; }
.data-table.mileage th:nth-child(3),
.data-table.mileage td:nth-child(3) { width: auto; }

/* 정비기록 테이블 열 너비 - 날짜 120px, 금액 150px */
.data-table.maintenance th:nth-child(1),
.data-table.maintenance td:nth-child(1) { width: 120px; }
.data-table.maintenance th:nth-child(2),
.data-table.maintenance td:nth-child(2) { width: auto; }
.data-table.maintenance th:nth-child(3),
.data-table.maintenance td:nth-child(3) { width: 150px; }
.data-table.maintenance th:nth-child(4),
.data-table.maintenance td:nth-child(4) { width: 150px; }

/* 메모 섹션 */
.memo-content {
    padding: 15px;
    border: 1px solid #ddd;
    background: #ffffff;
    min-height: 100px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 12px;
    text-align: left !important;
}

/* [VEHICLE:REPORT:COVER_PAGE_STYLES] START */

/* 표지 페이지 스타일 (모던 디자인) */
.cover-page {
    position: relative;
    min-height: 210mm;
    max-height: 210mm;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    page-break-after: always;
}

.cover-page .certificate-top-bar,
.cover-page .certificate-bottom-bar {
    display: none; /* 파란색 바 제거 */
}

.cover-page .certificate-print-datetime {
    text-align: left;
    padding: 10px 20px;
    font-size: 10px;
    color: #999;
    flex-shrink: 0;
}

.cover-page .certificate-doc-number {
    text-align: right;
    padding: 0 20px 10px 20px;
    font-size: 12px;
    color: #666;
    flex-shrink: 0;
}

.cover-page .certificate-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 20px;
    border-bottom: 2px solid #333;
    flex-shrink: 0;
}

.cover-page .certificate-header-right {
    flex-shrink: 0;
}

.cover-page .certificate-title-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.cover-page .certificate-title {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    font-family: 'Pretendard', 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
}

.cover-page .certificate-title i {
    color: #2563eb;
    margin-right: 10px;
    vertical-align: middle;
}

.cover-page .certificate-approval-boxes {
    border-collapse: collapse;
}

.cover-page .approval-label {
    padding: 4px 12px;
    border: 1px solid #333;
    text-align: center;
    font-size: 12px;
    background: #f8f9fa;
}

.cover-page .approval-box-cell {
    width: 70px;
    height: 70px;
    border: 1px solid #333;
}

.cover-page .vehicle-summary-table {
    width: 100%;
    margin: 40px 0 60px 0;
    border-collapse: collapse;
    flex-shrink: 0;
}

.cover-page .vehicle-summary-table th,
.cover-page .vehicle-summary-table td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
}

.cover-page .vehicle-summary-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.cover-page .certificate-footer {
    margin-top: auto;
    padding: 0 40px 8px 40px;
    flex-shrink: 0;
}

.cover-page .certificate-date-section {
    margin-bottom: 3px;
    text-align: center;
}

.cover-page .certificate-date-text {
    font-size: 13px;
    font-weight: 500;
}

.cover-page .certificate-blank-line {
    height: 8px;
}

.cover-page .certificate-reporter-section {
    font-size: 16px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 8px;
}

.cover-page .reporter-label {
    font-weight: 500;
    white-space: nowrap;
}

.cover-page .reporter-space {
    display: inline-block;
    width: 220px;
    text-align: center;
    vertical-align: bottom;
    color: #999;
}

.cover-page .reporter-seal {
    font-weight: 500;
    white-space: nowrap;
    padding-bottom: 2px;
    margin-left: -8px;
    font-size: 15px;
    color: #999;
}

/* [VEHICLE:REPORT:COVER_PAGE_STYLES] END */

/* ============================================================
 * [CARD_USAGE:REPORT] 사용내역통합 보고서 전용 인쇄 설정
 * 용도: 가로 인쇄 (A4 landscape) - 완전 분리 스코프
 * ============================================================ */
@page {
    size: A4 landscape !important;
    margin: 0.8cm !important;
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    html, body {
        width: 297mm;
        height: 210mm;
        margin: 0;
        padding: 0;
        font-size: 12px;
        line-height: 1.4;
        background: white;
        font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif !important;
        /* orientation 제거 - @page에서 이미 landscape 설정됨 */
    }
    
    .no-print {
        display: none !important;
    }
    
    .report-container {
        max-width: none;
        box-shadow: none;
        padding: 0;
    }
    
    .vehicle-page {
        page-break-after: always;
        page-break-inside: avoid;
        min-height: auto !important;
        padding: 0;
    }
    
    .vehicle-page:last-child {
        page-break-after: avoid !important;
        min-height: auto !important;
    }
    
    /* 표지가 마지막 페이지일 경우 (데이터 없음) */
    .cover-page:last-child {
        page-break-after: avoid !important;
    }
    
    /* 인쇄 시 페이지 헤더 레이아웃 강제 */
    .page-header {
        display: grid !important;
        grid-template-columns: 1fr auto 1fr !important;
        align-items: center !important;
    }
    
    .print-date {
        justify-self: start !important;
        text-align: left !important;
        font-size: 11px !important;
        color: #444 !important;
        font-weight: normal !important;
    }
    
    .header-title {
        justify-self: center !important;
        text-align: center !important;
    }
    
    .page-info {
        justify-self: end !important;
        text-align: right !important;
        font-size: 11px !important;
        color: #444 !important;
        font-weight: normal !important;
    }
    
    /* 인쇄 시 배경색 강제 적용 */
    .info-table .header-cell {
        background: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .data-table th {
        background: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* 표지 페이지 인쇄 스타일 */
    .cover-page {
        display: flex !important;
        flex-direction: column !important;
        min-height: 210mm !important;
        max-height: 210mm !important;
        page-break-after: always !important;
    }
    
    .cover-page .certificate-top-bar,
    .cover-page .certificate-bottom-bar {
        display: none !important;
    }
    
    .cover-page .approval-label {
        background: #f8f9fa !important;
        border: 1px solid #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .cover-page .approval-box-cell {
        border: 1px solid #333 !important;
    }
    
    .cover-page .vehicle-summary-table {
        margin: 40px 0 60px 0 !important;
        flex-shrink: 0 !important;
    }
    
    .cover-page .vehicle-summary-table th {
        background: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .cover-page .certificate-print-datetime {
        display: block !important;
        text-align: left !important;
        padding: 10px 20px !important;
        font-size: 10px !important;
        color: #999 !important;
    }
    
    .cover-page .certificate-doc-number {
        padding: 0 20px 10px 20px !important;
    }
    
    .cover-page .certificate-footer {
        margin-top: auto !important;
        padding: 0 40px 8px 40px !important;
        flex-shrink: 0 !important;
        page-break-inside: avoid !important;
        min-height: 50px !important;
    }
    
    .cover-page .certificate-date-section {
        text-align: center !important;
        margin-bottom: 3px !important;
    }
    
    .cover-page .certificate-blank-line {
        height: 8px !important;
        display: block !important;
    }
    
    .cover-page .certificate-reporter-section {
        display: block !important;
        text-align: right !important;
    }
    
    .cover-page .reporter-label {
        display: inline !important;
    }
    
    .cover-page .reporter-space {
        display: inline-block !important;
        width: 220px !important;
        text-align: center !important;
        vertical-align: bottom !important;
        color: #999 !important;
    }
    
    .cover-page .reporter-seal {
        display: inline !important;
        margin-left: -8px !important;
        font-size: 15px !important;
        color: #999 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .cover-page .reporter-space {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .cover-page .certificate-title i {
        color: #2563eb !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .report-controls {
        position: static;
        justify-content: center;
        margin-bottom: 20px;
    }
    
    .report-controls button {
        flex: 1;
        max-width: 120px;
    }
    
    .page-header {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 10px;
    }
    
    .print-date,
    .header-title,
    .page-info {
        justify-self: center;
    }
    
    .page-header h1 {
        margin-bottom: 10px;
    }
}

/* [VEHICLE:REPORT:STYLES] END */

