/**
 * Print-Friendly Styles
 * Optimized for printing pages from the UP Medical College Counselling Portal
 */

@media print {
    /* Reset page margins */
    @page {
        margin: 1.5cm;
        size: A4 portrait;
    }

    /* Hide non-essential elements */
    header nav,
    .no-print,
    button,
    input[type="button"],
    input[type="submit"],
    .export-section,
    .action-buttons,
    .filter-buttons,
    .search-bar,
    .modal,
    .toast,
    footer {
        display: none !important;
    }

    /* Reset body styles */
    body {
        background: white !important;
        color: black !important;
        font-size: 10pt !important;
        line-height: 1.4 !important;
    }

    /* Container adjustments */
    .container {
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Header adjustments */
    header {
        background: white !important;
        border-bottom: 2px solid black !important;
        padding: 10px 0 !important;
        margin-bottom: 20px !important;
    }

    header h1 {
        color: black !important;
        font-size: 18pt !important;
        margin: 0 !important;
    }

    /* Section styles */
    section {
        background: white !important;
        border: none !important;
        padding: 0 !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid;
    }

    h2, h3 {
        color: black !important;
        page-break-after: avoid;
        margin-top: 15px;
        margin-bottom: 10px;
    }

    h2 {
        font-size: 14pt !important;
        border-bottom: 1px solid black;
        padding-bottom: 5px;
    }

    h3 {
        font-size: 12pt !important;
    }

    /* Table styles */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        background: white !important;
        page-break-inside: auto;
    }

    thead {
        display: table-header-group;
    }

    tbody {
        display: table-row-group;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    th, td {
        border: 1px solid black !important;
        padding: 6px !important;
        color: black !important;
        background: white !important;
        font-size: 9pt !important;
    }

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

    /* Choice items for planner */
    .choice-item {
        background: white !important;
        border: 1px solid black !important;
        padding: 10px !important;
        margin-bottom: 10px !important;
        page-break-inside: avoid;
    }

    .choice-item h3 {
        color: black !important;
        font-size: 11pt !important;
        margin: 0 0 5px 0 !important;
    }

    /* Priority badges */
    .priority-badge,
    [class*="bg-red-"],
    [class*="bg-yellow-"],
    [class*="bg-blue-"],
    [class*="bg-green-"] {
        background: white !important;
        color: black !important;
        border: 1px solid black !important;
        padding: 2px 6px !important;
    }

    /* Links */
    a {
        color: black !important;
        text-decoration: underline !important;
    }

    /* Remove shadows and special effects */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
        filter: none !important;
    }

    /* Cost displays */
    .cost-display,
    .total-cost,
    .summary-box {
        background: #f5f5f5 !important;
        border: 1px solid black !important;
        padding: 8px !important;
        margin: 10px 0 !important;
    }

    /* Grid layouts */
    .grid {
        display: block !important;
    }

    .grid > * {
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    /* Page breaks */
    .page-break {
        page-break-after: always;
    }

    .page-break-before {
        page-break-before: always;
    }

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

    /* Print header (add to each page) */
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid black;
    }

    /* Print footer */
    .print-footer {
        display: block !important;
        text-align: center;
        margin-top: 20px;
        padding-top: 10px;
        border-top: 1px solid black;
        font-size: 8pt;
    }

    /* Disclaimer */
    .disclaimer {
        display: block !important;
        font-size: 8pt !important;
        color: #666 !important;
        border: 1px solid #ccc !important;
        padding: 8px !important;
        margin: 15px 0 !important;
        background: #f9f9f9 !important;
    }

    /* Notes and text areas */
    .notes,
    textarea {
        border: 1px solid black !important;
        background: white !important;
        color: black !important;
        padding: 5px !important;
        min-height: auto !important;
    }

    /* Emoji and icons - fallback */
    .emoji::after {
        content: "";
    }

    /* Cards */
    .card,
    .info-card {
        background: white !important;
        border: 1px solid black !important;
        padding: 10px !important;
        margin-bottom: 10px !important;
    }

    /* Statistics summary */
    .stats-summary {
        display: flex !important;
        justify-content: space-between;
        border: 2px solid black;
        padding: 10px;
        margin: 15px 0;
        background: #f0f0f0 !important;
    }

    .stat-item {
        text-align: center;
    }

    .stat-value {
        font-size: 14pt !important;
        font-weight: bold !important;
        color: black !important;
    }

    .stat-label {
        font-size: 8pt !important;
        color: #333 !important;
    }

    /* Watermark */
    body::before {
        content: "UP Medical College Counselling Portal - Printed on " attr(data-print-date);
        position: fixed;
        bottom: 10px;
        left: 10px;
        font-size: 7pt;
        color: #999;
        opacity: 0.5;
    }

    /* Force page breaks for long tables */
    table tbody tr:nth-child(25n) {
        page-break-after: always;
    }

    /* Optimize for black and white printing */
    .color-indicator {
        filter: grayscale(100%) !important;
    }

    /* Year separator in planner */
    .year-section {
        page-break-before: always;
        margin-top: 20px;
    }

    /* Comparison tables */
    .comparison-table {
        width: 100% !important;
        font-size: 8pt !important;
    }

    .comparison-table th {
        background: #e0e0e0 !important;
    }

    /* Highlight important information */
    .important,
    .highlight {
        background: #ffffcc !important;
        border: 1px dashed black !important;
        padding: 5px !important;
    }

    /* Rankings and cutoffs */
    .rank-display,
    .cutoff-display {
        font-family: 'Courier New', monospace !important;
        font-weight: bold !important;
    }

    /* Locked items indicator */
    .locked::before {
        content: "🔒 ";
    }
}

/* Print-specific utility classes (use in HTML) */
@media print {
    .print-only {
        display: block !important;
    }

    .screen-only {
        display: none !important;
    }

    .print-landscape {
        size: A4 landscape !important;
    }

    .print-portrait {
        size: A4 portrait !important;
    }
}
