/* style-print.css - Print styles */
/* Version: 9.9.3 (Latest Update) */

/* ================================== */
/* ======== ?�쇄 ?��???(?�합) ======== */
/* ================================== */
@media print {
    /* --- 공통 인쇄 설정 --- */
    @page {
        size: A4 portrait;
        margin: 0.7cm;
    }

    /* 태블릿·모바일 브라우저는 인쇄 레이아웃 폭을 기기 화면 기준으로 잡아
       모바일처럼 세로로 쌓인 인쇄물이 나온다 — A4 콘텐츠 폭으로 강제해
       어떤 기기서든 PC와 같은 지면 배치가 나오게 한다 */
    html, body {
        width: 196mm !important;
    }
    body, .container {
        background: #fff !important; color: #000 !important;
        font-size: 9pt;
        box-shadow: none !important; padding: 0 !important;
        margin: 0 !important; border: none !important;
    }

    /* 인쇄 시 결과 영역 등장 애니메이션 비활성화 (시작 프레임에서 멈추는 문제 방지) */
    #result.result-section,
    #result.result-section #result-summary-section,
    #result.result-section #discount-breakdown,
    #result.result-section .monthly-detail-toggle-wrapper,
    #result.result-section .winner {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    /* 다크모드 상태에서 인쇄 시 회색 배경이 나오는 문제 해결 */
    body.dark-mode, 
    body.dark-mode .container, 
    body.dark-mode .section,
    body.dark-mode .result-section,
    body.dark-mode .breakdown-card,
    body.dark-mode .monthly-table-wrapper,
    body.dark-mode .monthly-table th,
    body.dark-mode .monthly-table td {
        background: #fff !important;
        color: #000 !important;
        border-color: #ccc !important;
        box-shadow: none !important;
    }

    body.dark-mode h1, 
    body.dark-mode h2, 
    body.dark-mode h3, 
    body.dark-mode h4, 
    body.dark-mode h5,
    body.dark-mode p,
    body.dark-mode span,
    body.dark-mode li,
    body.dark-mode strong {
        color: #000 !important;
    }

    /* 1. 인쇄 시 불필요한 모든 UI 요소를 숨깁니다. */
    .footer-container, .page-footer, .landing-footer,
    #popup-notice-reopen-btn, #mobile-tooltip-popup, #toast-container,
    #popup-notice-overlay, .pc-scroll-top-container,
    h1, .page-header, .landing-container, .content-wrapper,
    .top-right-buttons, .top-left-buttons, .action-buttons, .view-mode-buttons,
    #back-to-choice-btn,
    .intro-text,
    .section, .card-section,
    #error-message, .calc-button, #side-menu, .modal-overlay, #menu-overlay,
    .comparison-toggle, #prorate-option-group,
    #penalty-calculator-wrapper > h2, #penalty-calculator-wrapper > .info-box-red, #calculateAllPenaltiesBtn,
    #calculator-choice-wrapper, .choice-grid {
        display: none !important;
    }

    /* 2. '결과' 영역의 불필요한 여백 등을 제거합니다. */
    #result, #penalty-calc-table-wrapper {
        padding: 0 !important; background: none !important; border-radius: 0 !important;
        margin: 0 !important; box-shadow: none !important; border: none !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
    }
    
    #result .action-buttons {
        display: none !important;
    }

    /* --- internet.html ?�쇄 ?��???--- */
    #printable-area {
        display: block !important;
        width: 100%;
        height: 270mm; 
        overflow: hidden;
        transform: scale(0.9);
        transform-origin: top left;
    }
    #summary-section-print {
        width: 42%;
        padding-right: 10px;
        float: left;
        box-sizing: border-box;
    }
    #table-section-print {
        width: 58%;
        float: left;
        box-sizing: border-box;
    }

    /* --- ?��? ?�약�?계산�??�쇄 ?��???--- */
    body.print-termination-view * {
        visibility: hidden !important;
    }
    body.print-termination-view #termination-penalty-result,
    body.print-termination-view #termination-penalty-result * {
        visibility: visible !important;
    }
    body.print-termination-view #termination-penalty-result {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        border: 1px solid #000 !important;
        padding: 0.7cm !important;
        box-shadow: none !important;
        margin: 0 !important;
    }

    /* --- phone.html ?�요금표 ?�쇄 ?��???--- */
    body.print-phone-monthly * {
        visibility: hidden !important;
    }
    body.print-phone-monthly #result,
    body.print-phone-monthly #result-title,
    body.print-phone-monthly .monthly-table-wrapper,
    body.print-phone-monthly .monthly-table-wrapper * {
        visibility: visible !important;
    }
    /* 토글로 숨겨져 있어도 인쇄 시에는 표가 보이도록 강제 표시 */
    body.print-phone-monthly #monthly-table-wrapper {
        display: block !important;
    }
    body.print-phone-monthly #result {
        position: static !important;
    }
    body.print-phone-monthly #result > *:not(#result-title):not(.monthly-table-wrapper) {
        display: none !important;
    }
    body.print-phone-monthly #result-title {
        font-size: 14pt !important;
        text-align: center !important;
        color: #000 !important;
        margin-bottom: 10px !important;
    }
    body.print-phone-monthly .monthly-table-wrapper {
        height: 95% !important;
    }
    body.print-phone-monthly .monthly-table {
        height: 100% !important;
        width: 100% !important;
    }

    /* --- phone.html ?�세?�역???�쇄 ?��???(좌우 비교) --- */
    body.print-phone-breakdown {
        transform: scale(0.95) !important;
        transform-origin: top center !important;
    }
    body.print-phone-breakdown * {
        visibility: hidden !important;
    }
    body.print-phone-breakdown #result,
    body.print-phone-breakdown #result-title,
    body.print-phone-breakdown .winner,
    body.print-phone-breakdown #discount-breakdown,
    body.print-phone-breakdown #discount-breakdown * {
        visibility: visible !important;
    }
    body.print-phone-breakdown #result {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
    }
    body.print-phone-breakdown #result > *:not(#result-title):not(.winner):not(#discount-breakdown) {
        display: none !important;
    }
    body.print-phone-breakdown #discount-breakdown {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: space-around !important;
        gap: 10px !important;
        padding-top: 10px !important;
        border-top: 1px solid #ccc !important;
    }
    /* 좌우 비교 컬럼이 min-width(320px) 탓에 좁은 렌더폭에서 줄바꿈되지 않도록 */
    body.print-phone-breakdown .carrier-breakdown-column { min-width: 0 !important; flex: 1 !important; }
    body.print-phone-breakdown .breakdown-card {
        flex: 1 !important;
        page-break-inside: avoid !important;
        border: 1px solid #ccc !important;
        padding: 5px !important; /* Reduced padding */
        font-size: 7pt !important; /* Reduced font size */
        line-height: 1.2 !important; /* Reduced line height */
    }
    body.print-phone-breakdown .breakdown-card h4 {
        font-size: 9pt !important; /* Reduced font size */
        margin: 0 0 4px 0 !important; /* Reduced margin */
        padding-bottom: 2px !important; /* Reduced padding */
    }
    body.print-phone-breakdown .breakdown-card h5 {
        font-size: 8pt !important;
        margin: 5px 0 2px 0 !important;
        padding-bottom: 2px !important;
    }
    body.print-phone-breakdown .timeline-container {
        padding-left: 12px !important;
    }
    body.print-phone-breakdown .timeline-container::before {
        left: 3px !important;
        background: #999 !important;
    }
    body.print-phone-breakdown .timeline-header h5::before {
        left: -13px !important;
        width: 8px !important;
        height: 8px !important;
        background: #555 !important;
        border-width: 1px !important;
        box-shadow: 0 0 0 1px #555 !important;
    }
    body.print-phone-breakdown .timeline-badge {
        background: transparent !important;
        color: #333 !important;
        border: 1px solid #999 !important;
        padding: 1px 5px !important;
        font-size: 7pt !important;
    }
    body.print-phone-breakdown .breakdown-card li {
        padding: 2px 0 !important; /* Reduced list item padding */
    }
    /* 인쇄본은 클릭할 수 없으므로 요금제명 강조(펄스/반짝임 아이콘)는 표기하지 않음 */
    body.print-phone-breakdown .result-plan-name {
        color: inherit !important;
        text-decoration: none !important;
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
        animation: none !important;
    }
    body.print-phone-breakdown .result-plan-name::after {
        content: none !important;
        animation: none !important;
    }
    body.print-phone-breakdown .total-cost-section {
        padding: 5px 0 !important;
        margin-bottom: 5px !important;
    }
    body.print-phone-breakdown .total-cost-section p {
        margin: 0 !important;
        font-size: 1.1em !important;
    }
    body.print-phone-breakdown .total-cost-section strong {
        font-size: 1.6em !important; /* Slightly larger to maintain prominence */
        margin-top: 2px !important;
    }
    body.print-phone-breakdown .breakdown-card.winner-card {
        border: 2px solid #1a73e8 !important;
    }
    body.print-phone-breakdown .winner-badge {
        display: block !important;
        position: static !important; /* No absolute positioning in print */
        text-align: center;
        margin: 0 auto 5px auto; /* Center it */
        padding: 2px 8px;
        border-radius: 4px;
        background-color: #1a73e8 !important;
        color: #fff !important;
        font-size: 8pt !important;
        font-weight: bold;
    }
}

