/* ============================================
   ANB Build Estimator - Print Styles
   Professional invoice/estimate printing
   ============================================ */

@media print {
    /* Page setup */
    @page {
        margin: 0.75in;
        size: letter portrait;
    }
    
    /* Reset and optimize for print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    html, body {
        background: white !important;
        color: #000 !important;
        font-size: 11pt;
        line-height: 1.4;
    }
    
    /* Hide UI elements */
    .sidebar,
    .top-header,
    .no-print,
    .breadcrumb,
    .card-actions,
    .table-actions,
    .btn,
    button,
    .alert,
    .pagination,
    .nav-overlay,
    .dropdown-menu,
    .modal-overlay,
    .theme-toggle,
    .search-box,
    .header-actions,
    .user-menu,
    .menu-toggle,
    .sidebar-toggle {
        display: none !important;
    }
    
    /* Layout adjustments */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .page-content {
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    .app-container {
        display: block !important;
    }
    
    /* Print header - Company letterhead */
    .print-header {
        display: flex !important;
        justify-content: space-between;
        align-items: flex-start;
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
        border-bottom: 3px solid #2563eb;
        page-break-after: avoid;
    }
    
    .print-company {
        display: block !important;
    }
    
    .print-logo {
        font-size: 28pt;
        font-weight: 700;
        color: #2563eb;
        margin-bottom: 0.5rem;
    }
    
    .print-company-details {
        font-size: 9pt;
        line-height: 1.6;
        color: #333;
    }
    
    .print-estimate-info {
        display: block !important;
        text-align: right;
    }
    
    .print-title {
        font-size: 22pt;
        font-weight: 700;
        margin-bottom: 0.5rem;
        color: #000;
    }
    
    .print-subtitle {
        font-size: 10pt;
        color: #666;
    }
    
    /* Cover page */
    .print-cover-page {
        page-break-after: always;
        display: block !important;
    }
    
    /* Client and contractor info boxes */
    .print-info-section {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
        page-break-inside: avoid;
    }
    
    .print-info-box {
        border: 1px solid #ddd;
        padding: 1rem;
        border-radius: 4px;
        background: #f9f9f9 !important;
        page-break-inside: avoid;
    }
    
    .print-info-box h3 {
        font-size: 11pt;
        font-weight: 700;
        margin-bottom: 0.75rem;
        color: #000;
        text-transform: uppercase;
        letter-spacing: 0.5pt;
    }
    
    .print-info-box p {
        margin: 0.25rem 0;
        font-size: 10pt;
        color: #333;
    }
    
    .print-info-label {
        color: #666;
        font-weight: 600;
        display: inline-block;
        width: 100px;
    }
    
    /* Budget summary for cover */
    .print-budget-summary {
        display: block !important;
        margin: 2rem 0;
        padding: 1.5rem;
        background: #f0f7ff !important;
        border: 2px solid #2563eb;
        border-radius: 8px;
        page-break-inside: avoid;
    }
    
    .print-budget-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0.75rem;
        font-size: 11pt;
    }
    
    .print-budget-total {
        font-size: 18pt !important;
        font-weight: 700;
        color: #2563eb !important;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 2px solid #2563eb;
    }
    
    /* Expense items table */
    .print-items-page {
        page-break-before: always;
        display: block !important;
    }
    
    /* Cards */
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        margin-bottom: 1.5rem;
        background: white !important;
    }
    
    .card-header {
        background: #f5f5f5 !important;
        border-bottom: 2px solid #ddd !important;
        padding: 0.75rem 1rem !important;
    }
    
    .card-title {
        color: #000 !important;
        font-size: 13pt;
        font-weight: 700;
    }
    
    .card-body {
        color: #000 !important;
        padding: 1rem !important;
    }
    
    /* Tables */
    .table-container {
        border: none !important;
    }
    
    .table {
        font-size: 9pt;
        width: 100%;
        border-collapse: collapse;
    }
    
    .table th {
        background: #e8e8e8 !important;
        color: #000 !important;
        border: 1px solid #999 !important;
        padding: 0.5rem !important;
        font-weight: 700;
        text-align: left;
    }
    
    .table td {
        color: #000 !important;
        border: 1px solid #ccc !important;
        padding: 0.5rem !important;
    }
    
    .table tbody tr {
        background: white !important;
    }
    
    .table tbody tr:nth-child(even) {
        background: #f9f9f9 !important;
    }
    
    .table tfoot tr {
        background: #e8e8e8 !important;
        font-weight: 700;
        border-top: 2px solid #000 !important;
    }
    
    .table tfoot td {
        font-size: 11pt;
        padding: 0.75rem !important;
    }
    
    /* Badges and status indicators */
    .badge, .status {
        border: 1px solid #000 !important;
        color: #000 !important;
        background: white !important;
        padding: 2px 6px;
        font-size: 8pt;
        page-break-inside: avoid;
    }
    
    .badge::before, .status::before {
        display: none !important;
    }
    
    /* Notes and terms section */
    .print-notes {
        page-break-inside: avoid;
        margin-top: 2rem;
        padding: 1rem;
        border: 1px solid #ddd;
        background: #f9f9f9 !important;
    }
    
    .print-notes h4 {
        font-size: 11pt;
        font-weight: 700;
        margin-bottom: 0.5rem;
        color: #000;
    }
    
    .print-notes ul {
        margin: 0.5rem 0 0 1.5rem;
        padding: 0;
    }
    
    .print-notes li {
        margin-bottom: 0.25rem;
        color: #333;
    }
    
    /* Signature section */
    .print-signature {
        display: block !important;
        margin-top: 3rem;
        page-break-inside: avoid;
    }
    
    .signature-area {
        display: flex;
        justify-content: space-between;
        margin-top: 2rem;
    }
    
    .signature-box {
        width: 45%;
    }
    
    .signature-line {
        border-top: 2px solid #000;
        margin-top: 2.5rem;
        padding-top: 0.5rem;
        font-size: 9pt;
        color: #666;
    }
    
    /* Footer on each page */
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0.5rem 0;
        text-align: center;
        font-size: 8pt;
        color: #666;
        border-top: 1px solid #ddd;
    }
    
    /* Page breaks */
    .page-break-before {
        page-break-before: always;
    }
    
    .page-break-after {
        page-break-after: always;
    }
    
    .page-break-avoid {
        page-break-inside: avoid;
    }
    
    /* Grid adjustments */
    .grid {
        break-inside: avoid;
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    /* Typography */
    h1, h2, h3 {
        page-break-after: avoid;
        color: #000 !important;
    }
    
    p {
        orphans: 3;
        widows: 3;
    }
    
    /* Stat cards and summaries */
    .stat-card {
        border: 1px solid #ddd !important;
        background: white !important;
        text-align: center;
        page-break-inside: avoid;
    }
    
    .stat-label {
        color: #666 !important;
        font-size: 9pt;
    }
    
    .stat-value {
        color: #000 !important;
        font-size: 16pt;
    }
    
    /* Links */
    a {
        color: #000 !important;
        text-decoration: none !important;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 8pt;
        color: #666;
    }
}