.cell-active {
    background-color: #dcfce7;
    border-left: 4px solid #16a34a;
}

.conflict {
    background-color: #fee2e2;
    border-left: 4px solid #dc2626;
}

/* Custom scrollbar for table */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    body {
        background: white;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    /* Hide unnecessary elements */
    header,
    .md\:col-span-4,
    #tabContainer,
    .flex.gap-2.pb-1,
    .mt-4.p-4.bg-blue-50 {
        display: none !important;
    }

    /* Maximize Main Content */
    .max-w-7xl {
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .grid {
        display: block !important;
    }

    .md\:col-span-8 {
        width: 100% !important;
    }

    /* Table Styling for Print */
    .bg-white.rounded-b-2xl {
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    table {
        width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
    }

    th,
    td {
        border: 1px solid #000 !important;
        color: #000 !important;
    }

    /* Ensure background colors print */
    .cell-active,
    .conflict {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        border: 1px solid #000 !important;
        /* Force border on cells */
    }

    /* Typography */
    .text-\[10px\] {
        font-size: 10pt !important;
        /* Increase font size */
    }

    .font-bold.truncate {
        font-size: 12pt !important;
        white-space: normal !important;
        /* Allow wrapping */
    }

    /* Hide Syllabus Link in Print */
    a[href*="syllabus"] {
        display: none !important;
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    #timetableGrid td {
        font-size: 10px !important;
        padding: 2px !important;
    }

    .font-bold.truncate {
        white-space: normal !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.1;
    }

    .cell-active,
    .conflict {
        padding: 4px !important;
    }
}

/* Wallpaper Export Styles */
#wallpaper-export-root {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 360px;
    height: 640px;
    overflow: hidden;
    background: #e0f2fe;
    /* Fallback color */
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    font-family: 'sans-serif';
}

.wallpaper-content {
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.wallpaper-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.wallpaper-title-box {
    background: white;
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    border: 2px solid #3b82f6;
    text-align: right;
}

.wallpaper-plan-name {
    font-size: 18px;
    font-weight: bold;
    color: #1e40af;
}

.wallpaper-subtitle {
    font-size: 10px;
    color: #64748b;
}

.wallpaper-table-container {
    background: white;
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    border: 1px solid #e2e8f0;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.wallpaper-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8px;
}

.wallpaper-table th,
.wallpaper-table td {
    border: 1px solid #f1f5f9;
    padding: 0;
    height: 80px;
    vertical-align: top;
}

.wallpaper-table th {
    height: 20px;
    background: #f8fafc;
    font-weight: bold;
    color: #64748b;
}

.wallpaper-footer {
    height: 100px;
    position: relative;
    margin-top: 20px;
}

.wallpaper-char-space {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    position: absolute;
    left: 0;
    bottom: 0;
    overflow: hidden;
}

.wallpaper-pen-decoration {
    position: absolute;
    right: 10px;
    bottom: 20px;
    width: 60px;
    height: 8px;
    background: #3b82f6;
    border-radius: 4px;
    transform: rotate(-15deg);
}

.wallpaper-pen-decoration::after {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 10px solid #3b82f6;
}

.wp-lecture {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 4px;
    box-sizing: border-box;
}

.wp-cell-active {
    background-color: #f0fdf4;
    border-left: 2px solid #22c55e !important;
}

.wp-conflict {
    background-color: #fef2f2;
    border-left: 2px solid #ef4444 !important;
}

.wp-lecture-title {
    font-weight: bold;
    line-height: 1.1;
    color: #0f172a;
    font-size: 8px;
}

.wp-teacher {
    font-size: 7px;
    color: #475569;
    margin-top: 2px;
    line-height: 1;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* html2canvas Fixes for Wallpaper */
#wallpaper-export-root * {
    overflow: visible !important;
    white-space: normal !important;
}

#wallpaper-export-root .truncate {
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: clip !important;
}