/**
 * Print View Styles
 * PDF-style layout for printing Saju results
 */

/* Print Button */
.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-print:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.3);
}

.print-icon {
    font-size: 1.2rem;
}

/* Hide print container in normal view */
#print-container {
    display: none;
}

/* Print Media Styles */
@media print {
    /* Hide everything except print container */
    body.printing > *:not(#print-container) {
        display: none !important;
    }
    
    /* Show print container */
    #print-container {
        display: block !important;
    }
    
    /* Reset body styles for print */
    body {
        margin: 0;
        padding: 0;
        background: white;
        color: black;
        font-family: 'Noto Sans KR', 'Nanum Myeongjo', serif;
        font-size: 11pt;
        line-height: 1.5;
    }
    
    /* Page setup */
    @page {
        size: A4;
        margin: 15mm 10mm;
    }
    
    /* Print page container */
    .print-page {
        width: 100%;
        max-width: 210mm;
        margin: 0 auto;
        background: white;
        color: black;
    }
    
    /* Print header */
    .print-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding-bottom: 10pt;
        border-bottom: 2pt solid #333;
        margin-bottom: 20pt;
    }
    
    .print-logo h1 {
        margin: 0;
        font-size: 24pt;
        font-weight: 700;
        color: #333;
        font-family: 'Nanum Myeongjo', serif;
    }
    
    .print-subtitle {
        margin: 5pt 0 0 0;
        font-size: 10pt;
        color: #666;
        font-style: italic;
    }
    
    .print-date {
        text-align: right;
        font-size: 10pt;
        color: #666;
    }
    
    /* Print sections */
    .print-section {
        margin-bottom: 20pt;
        page-break-inside: avoid;
    }
    
    .print-section-title {
        font-size: 14pt;
        font-weight: 700;
        color: #333;
        margin: 0 0 10pt 0;
        padding-bottom: 5pt;
        border-bottom: 1pt solid #ddd;
    }
    
    /* Info table */
    .print-info-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 10pt;
    }
    
    .print-info-table td {
        padding: 5pt 10pt;
        border: 1pt solid #ddd;
    }
    
    .print-info-table td.label {
        background: #f5f5f5;
        font-weight: 600;
        width: 20%;
        color: #555;
    }
    
    .print-info-table td.value {
        width: 30%;
        color: #333;
    }
    
    /* Pillars table */
    .pillars-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 10pt;
    }
    
    .pillars-table th,
    .pillars-table td {
        padding: 8pt;
        text-align: center;
        border: 1pt solid #ddd;
    }
    
    .pillars-table th {
        background: #333;
        color: white;
        font-weight: 600;
        font-size: 10pt;
    }
    
    .pillars-table td.label {
        background: #f5f5f5;
        font-weight: 600;
        width: 15%;
    }
    
    .pillars-table .stem,
    .pillars-table .branch {
        font-size: 16pt;
        font-weight: 700;
        font-family: 'Nanum Myeongjo', serif;
    }
    
    .pillars-table .day-master {
        color: #d32f2f;
        font-size: 18pt;
    }
    
    .pillars-table .element {
        font-size: 10pt;
        color: #666;
    }
    
    /* Elements table */
    .elements-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 10pt;
    }
    
    .elements-table th,
    .elements-table td {
        padding: 8pt;
        text-align: center;
        border: 1pt solid #ddd;
    }
    
    .elements-table th {
        background: #f5f5f5;
        font-weight: 600;
    }
    
    .elements-table td {
        font-size: 14pt;
        font-weight: 700;
    }
    
    .elements-table .percentage-row td {
        font-size: 10pt;
        color: #666;
        font-weight: normal;
    }
    
    /* Element bars */
    .element-bars {
        margin-top: 10pt;
    }
    
    .element-bar-row {
        display: flex;
        align-items: center;
        margin-bottom: 5pt;
    }
    
    .element-label {
        width: 40pt;
        font-weight: 600;
    }
    
    .element-bar {
        flex: 1;
        height: 15pt;
        background: #f0f0f0;
        border: 1pt solid #ddd;
        margin: 0 10pt;
        position: relative;
    }
    
    .element-fill {
        height: 100%;
        position: absolute;
        left: 0;
        top: 0;
    }
    
    .element-value {
        width: 30pt;
        text-align: right;
        font-weight: 600;
    }
    
    /* Ten gods table */
    .ten-gods-table {
        width: 100%;
        border-collapse: collapse;
    }
    
    .ten-gods-table th,
    .ten-gods-table td {
        padding: 6pt 10pt;
        border: 1pt solid #ddd;
    }
    
    .ten-gods-table th {
        background: #f5f5f5;
        font-weight: 600;
    }
    
    /* Interpretation content */
    .interpretation-content {
        padding: 10pt;
        background: #fafafa;
        border: 1pt solid #ddd;
    }
    
    .interpretation-item {
        margin-bottom: 10pt;
    }
    
    .interpretation-item h4 {
        font-size: 11pt;
        font-weight: 600;
        margin: 0 0 5pt 0;
        color: #333;
    }
    
    .interpretation-item p {
        margin: 0;
        color: #555;
        line-height: 1.6;
    }
    
    /* Major fortune table */
    .major-fortune-table {
        width: 100%;
        border-collapse: collapse;
    }
    
    .major-fortune-table th,
    .major-fortune-table td {
        padding: 6pt 10pt;
        text-align: center;
        border: 1pt solid #ddd;
    }
    
    .major-fortune-table th {
        background: #333;
        color: white;
        font-weight: 600;
    }
    
    /* Print footer */
    .print-footer {
        margin-top: 30pt;
        padding-top: 10pt;
        border-top: 1pt solid #ddd;
    }
    
    .disclaimer {
        margin-bottom: 10pt;
    }
    
    .disclaimer p {
        margin: 3pt 0;
        font-size: 9pt;
        color: #666;
        line-height: 1.4;
    }
    
    .print-copyright {
        text-align: center;
        font-size: 9pt;
        color: #999;
        margin-top: 10pt;
    }
    
    /* Force page breaks */
    .page-break {
        page-break-after: always;
    }
    
    .avoid-break {
        page-break-inside: avoid;
    }
    
    /* Hide non-printable elements */
    .no-print,
    button,
    .ad-container,
    .tabs-header,
    .timeline-controls,
    .btn-print {
        display: none !important;
    }
    
    /* Ensure charts are visible */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Color adjustments for print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}

/* Print preview styles */
@media screen and (min-width: 768px) {
    .print-preview {
        max-width: 210mm;
        margin: 2rem auto;
        padding: 20mm;
        background: white;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }
}