/**
 * NineNiche Print Styles
 * 列印友善樣式
 */

@media print {
    /* 基本設定 */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000 !important;
        background: #fff !important;
    }

    /* 隱藏非必要元素 */
    header,
    footer,
    nav,
    .no-print,
    [x-data="floatingActions()"],
    [x-data="searchModal()"],
    [x-data="pwaInstall()"],
    .fixed,
    .sticky,
    button:not(.print-show),
    .mobile-menu,
    .preferences-panel,
    .toast-container,
    .network-status,
    .pwa-install-prompt {
        display: none !important;
    }

    /* 顯示列印專用元素 */
    .print-only {
        display: block !important;
    }

    /* 主內容區域 */
    main {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* 頁面標題 */
    h1 {
        font-size: 24pt;
        margin-bottom: 12pt;
        color: #000 !important;
    }

    h2 {
        font-size: 18pt;
        margin-top: 18pt;
        margin-bottom: 12pt;
        color: #000 !important;
    }

    h3 {
        font-size: 14pt;
        margin-top: 12pt;
        margin-bottom: 8pt;
        color: #000 !important;
    }

    /* 卡片和容器 */
    .bg-white,
    .dark\:bg-gray-800 {
        background: #fff !important;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    /* 文字顏色 */
    .text-gray-900,
    .text-gray-800,
    .text-gray-700,
    .dark\:text-white,
    .dark\:text-gray-100,
    .dark\:text-gray-200 {
        color: #000 !important;
    }

    .text-gray-600,
    .text-gray-500,
    .text-gray-400,
    .dark\:text-gray-300,
    .dark\:text-gray-400 {
        color: #333 !important;
    }

    /* 連結 */
    a {
        color: #000 !important;
        text-decoration: underline;
    }

    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }

    /* 表格 */
    table {
        border-collapse: collapse;
        width: 100%;
    }

    th, td {
        border: 1px solid #ddd;
        padding: 8pt;
        text-align: left;
    }

    th {
        background: #f5f5f5 !important;
        font-weight: bold;
    }

    /* 結果區域 */
    .result-card,
    [data-result] {
        page-break-inside: avoid;
        border: 2px solid #000 !important;
        padding: 16pt;
        margin: 12pt 0;
    }

    /* 數值高亮 */
    .result-value,
    .text-2xl,
    .text-3xl,
    .text-4xl {
        font-size: 18pt;
        font-weight: bold;
        color: #000 !important;
    }

    /* 圖表（隱藏或顯示靜態版本） */
    canvas,
    .chart-container {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* 分頁控制 */
    .page-break {
        page-break-before: always;
    }

    .no-page-break {
        page-break-inside: avoid;
    }

    /* 頁首頁尾 */
    @page {
        margin: 2cm;
    }

    @page :first {
        margin-top: 3cm;
    }

    /* 列印標題區 */
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 24pt;
        padding-bottom: 12pt;
        border-bottom: 2px solid #000;
    }

    .print-header h1 {
        margin: 0;
    }

    .print-header .print-date {
        font-size: 10pt;
        color: #666;
        margin-top: 8pt;
    }

    /* 列印頁尾 */
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 9pt;
        color: #666;
        padding: 8pt 0;
        border-top: 1px solid #ddd;
    }

    /* 進度條 */
    .progress-bar,
    [class*="bg-gradient"] {
        background: #ddd !important;
    }

    .progress-bar > div {
        background: #666 !important;
    }

    /* 輸入欄位（顯示值） */
    input,
    select,
    textarea {
        border: 1px solid #000 !important;
        background: #fff !important;
        padding: 4pt 8pt;
    }

    /* 按鈕轉為文字 */
    button.print-show {
        display: inline !important;
        background: none !important;
        border: none !important;
        color: #000 !important;
        padding: 0 !important;
    }

    /* 網格佈局調整 */
    .grid {
        display: block !important;
    }

    .grid > * {
        margin-bottom: 12pt;
    }

    /* Flex 佈局調整 */
    .flex {
        display: block !important;
    }

    /* 聲明區塊 */
    .disclaimer,
    [class*="disclaimer"] {
        border: 1px solid #666 !important;
        background: #f9f9f9 !important;
        padding: 12pt;
        margin-top: 24pt;
        font-size: 10pt;
    }

    /* 隱藏深色模式樣式 */
    .dark {
        background: #fff !important;
    }

    /* 圖片 */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* SVG 圖示 */
    svg {
        fill: currentColor !important;
        stroke: currentColor !important;
    }

    /* 摘要資訊 */
    .summary-box {
        border: 2px solid #000;
        padding: 16pt;
        margin: 16pt 0;
        background: #f9f9f9 !important;
    }

    .summary-box h3 {
        margin-top: 0;
        border-bottom: 1px solid #000;
        padding-bottom: 8pt;
    }

    /* 步驟/流程 */
    .step-indicator {
        display: inline-block;
        width: 24pt;
        height: 24pt;
        line-height: 24pt;
        text-align: center;
        border: 2px solid #000;
        border-radius: 50%;
        margin-right: 8pt;
        font-weight: bold;
    }
}

/* 列印按鈕（螢幕上顯示） */
@media screen {
    .print-only {
        display: none !important;
    }

    .print-button {
        cursor: pointer;
    }
}
