/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #334155;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

/* Left and Right Sidebar Ads - Hidden but space preserved */
.left-sidebar-ad,
.right-sidebar-ad {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    z-index: 100;
    /* Hide ads but preserve space */
    visibility: hidden;
    opacity: 0;
}

.left-sidebar-ad {
    left: 20px;
}

.right-sidebar-ad {
    right: 20px;
}

.ad-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ad-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.ad-placeholder {
    padding: 1rem;
    text-align: center;
}

.ad-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.ad-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.ad-visual {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.ad-icon {
    width: 24px;
    height: 24px;
    color: #64748b;
    stroke-width: 1.5;
}

.ad-text h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin: 0 0 0.25rem 0;
}

.ad-text p {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
    line-height: 1.3;
}

.ad-cta {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.ad-cta:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
}

/* Container */
.container {
    max-width: 100vw;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    /* 减少左右内边距，让更多空间给表格 */
    padding-left: 1rem;
    padding-right: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    width: 100%;
    max-width: 1200px;
}

.header .title {
    text-align: center;
}

.title {
    font-size: 3.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 8px rgba(59, 130, 246, 0.1);
}

.description {
    font-size: 1.25rem;
    color: #64748b;
    max-width: 800px;
    margin: 0 auto 1.5rem;
    font-weight: 400;
    line-height: 1.6;
    text-align: left;
}

.description:last-child {
    margin-bottom: 0;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
}

/* Sidebar */
.sidebar {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    position: sticky;
    top: 2rem;
    height: fit-content;
    width: fit-content;
    min-width: 240px;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-right: 0;
}

/* Action Buttons - Modern ScheduleMaker.io style */
.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    background: #ffffff;
    width: 100%;
    position: relative;
    overflow: hidden;
    justify-content: flex-start;
}

.action-btn:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.action-btn:active {
    transform: translateY(0);
}

.btn-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* Button Variants - Optimized colors with less red */
.action-btn.primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.action-btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.action-btn.secondary {
    background: #f9fafb;
    color: #374151;
    border-color: #e5e7eb;
}

.action-btn.secondary:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.action-btn.danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.action-btn.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.action-btn.success {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.action-btn.success:hover {
    background: #059669;
    border-color: #059669;
}

.action-btn.warning {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.action-btn.warning:hover {
    background: #4b5563;
    border-color: #4b5563;
}

.action-btn.info {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

.action-btn.info:hover {
    background: #7c3aed;
    border-color: #7c3aed;
}

.action-btn.share {
    background: #1f2937;
    color: white;
    border-color: #1f2937;
}

.action-btn.share:hover {
    background: #111827;
    border-color: #111827;
}

/* Schedule Container */
.schedule-container {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: flex-start;
    min-height: 800px;
}

/* Custom scrollbar for better UX */
.schedule-container::-webkit-scrollbar {
    height: 8px;
}

.schedule-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.schedule-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.schedule-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Schedule Grid - Modern ScheduleMaker.io style */
.schedule-grid {
    display: grid;
    /* Default grid template - will be dynamically adjusted by JavaScript */
    grid-template-columns: 120px repeat(7, 120px);
    min-height: 800px;
    min-width: 960px; /* Reduced width for better display */
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    margin: 0 auto;
    flex-shrink: 0;
}

/* Time Column */
.time-column {
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.time-header {
    padding: 1rem;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.time-slot {
    padding: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    font-weight: 500;
}

/* Day Columns */
.day-column {
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    min-height: 100%;
}

.day-column:last-child {
    border-right: none;
}

.day-header {
    padding: 1rem;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-content {
    flex: 1;
    position: relative;
    min-height: 960px; /* Increased from 720px to 12 hours * 80px */
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

/* Course Blocks - Modern ScheduleMaker.io style */
.course-block {
    position: absolute;
    left: 4px;
    right: 4px;
    background: #3b82f6;
    color: white;
    border-radius: 6px;
    padding: 0.25rem 0.375rem;
    font-size: 0.625rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 35px; /* Optimized for multi-line content */
    box-sizing: border-box;
    line-height: 1.2;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.course-block:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100 !important; /* Ensure hovered block is on top */
}

/* Overlapping course styles */
.course-block.overlapping {
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out, z-index 0s;
}

.course-block.overlapping:hover {
    /* Keep a simple hover for non-JS fallback, but main effect is via JS classes */
    border-color: #3b82f6;
    z-index: 999 !important; /* High z-index on hover */
}

/* JS-driven hover effects */
.course-block.is-hovered {
    width: calc(100% - 8px) !important; /* Expand to full width */
    left: 4px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: #3b82f6;
}

.course-block.is-dimmed {
    opacity: 0.4;
    filter: blur(1px);
}

/* Enhanced styles for narrow overlapping courses - Gizmoa style */
.course-block.overlapping .course-code {
    font-size: 0.55rem;
    margin-bottom: 0.08rem;
}

.course-block.overlapping .course-time-compact {
    font-size: 0.45rem;
    margin-bottom: 0.04rem;
}

.course-block.overlapping .course-location-compact,
.course-block.overlapping .course-instructor-compact {
    font-size: 0.4rem;
    margin-bottom: 0.04rem;
}

.course-block.overlapping .course-type-compact {
    font-size: 0.35rem;
}

/* Legacy overlapping styles */
.course-block.overlapping .course-name {
    font-size: 0.7rem;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}

.course-block.overlapping .course-time {
    font-size: 0.55rem;
    font-weight: 500;
    opacity: 0.95;
}

/* Specific styles for very short duration courses (15 minutes or less) */
.course-block[data-short-duration="true"] {
    padding: 0.2rem 0.3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 30px; /* Increased from 15px to ensure content visibility */
    line-height: 1;
    box-sizing: border-box;
}

.course-block[data-short-duration="true"] .course-name {
    font-size: 0.65rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}

.course-block[data-short-duration="true"] .course-time {
    font-size: 0.6rem;
    opacity: 0.95;
    margin-bottom: 0;
    white-space: nowrap;
    line-height: 1.1;
    font-weight: 500;
}

.course-block[data-short-duration="true"] .course-location {
    display: none; /* Hide location for very short courses to save space */
}

/* Gizmoa-style ultra-compact information layout */
.course-code {
    font-weight: 700;
    font-size: 0.65rem;
    margin-bottom: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.course-time-compact {
    font-size: 0.5rem;
    font-weight: 600;
    opacity: 0.95;
    margin-bottom: 0.05rem;
    white-space: nowrap;
    color: #f1f5f9;
    line-height: 1.1;
}

.course-location-compact {
    font-size: 0.45rem;
    opacity: 0.85;
    margin-bottom: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e2e8f0;
    line-height: 1.1;
}

.course-instructor-compact {
    font-size: 0.45rem;
    opacity: 0.85;
    margin-bottom: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e2e8f0;
    line-height: 1.1;
}

.course-type-compact {
    font-size: 0.4rem;
    font-weight: 500;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #cbd5e1;
    line-height: 1;
}

/* Legacy styles for backwards compatibility */
.course-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-time {
    font-size: 0.625rem;
    opacity: 0.9;
    margin-bottom: 0.125rem;
}

.course-location {
    font-size: 0.625rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1rem 2rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

input[type="text"],
input[type="time"],
input[type="color"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
    background: white;
}

input[type="text"]:focus,
input[type="time"]:focus,
select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="color"] {
    height: 48px;
    padding: 0.25rem;
    cursor: pointer;
}

/* Checkbox and Radio Styles */
.day-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: normal;
    margin-bottom: 0;
}

.checkbox-label:hover,
.radio-label:hover {
    border-color: #3b82f6;
    background: #f9fafb;
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
    margin: 0;
    width: auto;
}

.checkbox-label input[type="checkbox"]:checked + span,
.radio-label input[type="radio"]:checked + span {
    color: #3b82f6;
    font-weight: 500;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn.primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn.secondary {
    background: #f9fafb;
    color: #374151;
    border-color: #d1d5db;
}

.btn.secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn.danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.btn.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn.share {
    background: #1f2937;
    color: white;
    border-color: #1f2937;
}

.btn.share:hover {
    background: #111827;
    border-color: #111827;
}

/* Course List */
.course-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.course-item {
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.course-item:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.course-color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.course-item-info h4 {
    margin: 0 0 0.25rem 0;
    font-weight: 600;
    color: #1e293b;
}

.course-item-info p {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
}

/* Warning Text */
.warning-text {
    color: #dc2626;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Share Card */
.share-preview {
    margin-bottom: 1.5rem;
}

.share-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: white;
}

.share-card-header {
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.share-card-header h4 {
    margin: 0 0 0.5rem 0;
    color: #1e293b;
    font-weight: 600;
}

.share-card-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.875rem;
}

.share-card-image {
    padding: 1rem;
    min-height: 200px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
}

.input-group .btn {
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        max-width: 100%;
        margin-left: 1rem;
    }
    
    .sidebar {
        position: static;
        order: 2;
        max-width: 600px;
        margin: 0 auto;
    }
    
    .button-group {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 0.75rem;
    }
    
    /* Hide sidebar ads on smaller screens */
    .left-sidebar-ad,
    .right-sidebar-ad {
        display: none;
    }
    
    /* Reset container margins */
    .container {
        margin-left: 2rem;
        margin-right: 2rem;
        align-items: center;
    }
    
    .schedule-container {
        max-width: 100%;
        margin: 0 auto;
        padding: 1.5rem;
    }
    
    .schedule-grid {
        min-width: 1000px;
        grid-template-columns: 100px repeat(7, 120px);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin-left: 1rem;
        margin-right: 1rem;
        align-items: center;
    }
    
    .main-content {
        max-width: 100%;
        margin: 0 auto;
        margin-left: 0.5rem;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .description {
        font-size: 1.125rem;
        text-align: left;
    }
    
    .schedule-grid {
        /* Reduce minimum column width for mobile */
        grid-template-columns: 80px repeat(7, 100px);
        font-size: 0.875rem;
        min-width: 780px; /* Adjusted for mobile */
        min-height: 600px;
    }
    
    .time-slot {
        height: 60px;
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .day-content {
        min-height: 720px;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
    
    /* Ensure horizontal scrolling works well on mobile */
    .schedule-container {
        border-radius: 8px;
        margin: 0 auto;
        overflow-x: auto;
        max-width: 100%;
        padding: 1rem;
    }
    
    .schedule-container::-webkit-scrollbar {
        height: 4px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }
    
    .schedule-grid {
        grid-template-columns: 60px repeat(7, 90px);
        font-size: 0.75rem;
        min-width: 690px;
    }
    
    .day-header,
    .time-header {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .course-block {
        padding: 0.15rem 0.2rem;
        font-size: 0.5rem;
        min-height: 30px;
    }
    
    /* Ultra-compact mobile styles */
    .course-code {
        font-size: 0.5rem;
    }
    
    .course-time-compact {
        font-size: 0.4rem;
    }
    
    .course-location-compact,
    .course-instructor-compact {
        font-size: 0.35rem;
    }
    
    .course-type-compact {
        font-size: 0.3rem;
    }
    
    .day-checkboxes {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .checkbox-label {
        font-size: 0.875rem;
        padding: 0.5rem;
        text-align: center;
    }
    
    /* Enhanced horizontal scrolling for very short screens */
    .schedule-container {
        margin: 0 -1rem;
        border-radius: 4px;
    }
    
    /* Custom scrollbar styles */
    .schedule-container::-webkit-scrollbar {
        height: 8px;
    }
    
    .schedule-container::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 4px;
    }
    
    .schedule-container::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }
    
    .schedule-container::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .modal {
        display: none !important;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .schedule-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    /* Print-specific course block styles */
    .course-block {
        position: static !important;
        width: auto !important;
        left: auto !important;
        right: auto !important;
        margin: 2px 4px !important;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #333 !important;
    }
    
    .course-block.overlapping {
        margin-bottom: 4px !important;
        border: 1px solid #000 !important;
    }
    
    /* Force full content display in print */
    .course-block .course-name,
    .course-block .course-time,
    .course-block .course-location {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        font-size: 0.75rem !important;
        line-height: 1.2 !important;
    }
    
    .course-block .course-name {
        font-weight: 600 !important;
        margin-bottom: 0.2rem !important;
    }
    
    .course-block .course-time {
        font-size: 0.65rem !important;
        margin-bottom: 0.1rem !important;
    }
    
    .course-block .course-location {
        font-size: 0.65rem !important;
    }
    
    /* Adjust day content for overlapping courses */
    .day-content {
        min-height: auto !important;
        position: relative !important;
    }
    
    /* Remove hover effects in print */
    .course-block.is-hovered,
    .course-block.is-dimmed {
        width: auto !important;
        left: auto !important;
        opacity: 1 !important;
        filter: none !important;
        box-shadow: none !important;
    }
    
    /* Ensure text is black for print */
    .course-block,
    .course-block * {
        color: #000 !important;
        text-shadow: none !important;
    }
    
    /* Print optimization */
    body {
        background: white !important;
        color: black !important;
    }
    
    .title {
        color: black !important;
        background: none !important;
        -webkit-text-fill-color: initial !important;
        text-shadow: none !important;
    }
    
    /* Print-specific course stack container */
    .print-course-stack {
        display: block !important;
        position: relative !important;
    }
    
    .print-course {
        position: relative !important;
        width: 100% !important;
        left: 0 !important;
        margin: 1px 0 !important;
        padding: 4px !important;
    }
    
    /* Ensure day content expands for stacked courses */
    .day-content {
        min-height: auto !important;
        height: auto !important;
    }
    
    /* Make sure course stacks don't overlap */
    .print-course-stack + .print-course-stack {
        margin-top: 8px !important;
    }
}

/* Focus and Accessibility */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading state for dynamic content */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success states */
.success-message {
    background: #dcfce7;
    color: #166534;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
    margin-bottom: 1rem;
}

/* Error states */
.error-message {
    background: #fef2f2;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #fecaca;
    margin-bottom: 1rem;
}
