#comparisonModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

#comparisonModal.active {
    display: flex;
}

#comparisonModal .modal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    animation: comparisonFadeIn 0.2s ease;
}

#comparisonModal .modal-content {
    position: relative;
    background: white;
    border-radius: 0.75rem;
    max-width: 98vw;
    width: 98vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: comparisonSlideIn 0.3s ease;
}

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

@keyframes comparisonSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

#comparisonModal .modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
    width: 100%;
}

#comparisonModal .modal-description {
    font-size: 0.875rem;
    color: #64748b;
    text-align: center;
    margin-top: 0.25rem;
}

#comparisonModal .close-button {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #64748b;
    transition: color 0.2s ease;
    border-radius: 0.25rem;
}

#comparisonModal .close-button:hover {
    color: #0f172a;
    background-color: #f1f5f9;
}

#comparisonModal .modal-body {
    padding: 1.5rem;
    max-height: calc(95vh - 120px);
}

/* Table Container */
.table-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 65vh;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.comparison-table thead {
    position: sticky;
    top: 0;
    z-index: 15;
    background: white;
}

.comparison-table thead th {
    padding-bottom: 1rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    text-align: center;
    vertical-align: top;
    min-width: 120px;
    border-bottom: 2px solid #e2e8f0;
}

.comparison-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
    background: white;
    text-align: left;
    min-width: 200px;
    padding-right: 1rem;
}

.package-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.package-name-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.package-name {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.package-name.highlighted {
    color: #1d4ed8;
}

.popular-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    background-color: #2563eb;
    border-radius: 0.25rem;
}

.package-price {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
}

.features-label {
    font-size: 0.875rem;
    color: #475569;
}

/* Table Body */
.category-row td {
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
}

.category-row td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
}

.feature-row {
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s ease;
}

.feature-row:hover {
    background-color: rgba(248, 250, 252, 0.5);
}

.feature-row td {
    padding: 0.75rem;
}

.feature-row td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background: white;
    font-size: 0.875rem;
    color: #334155;
    padding-right: 1rem;
    transition: background-color 0.15s ease;
}

.feature-row:hover td:first-child {
    background-color: rgba(248, 250, 252, 0.5);
}

.feature-row td:not(:first-child) {
    text-align: center;
}

/* Icons */
.feature-value {
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-number {
    font-weight: 500;
    color: #0f172a;
}

svg.icon-book {
    stroke: #2563eb;
}

svg.icon-video {
    stroke: #9333ea;
}

svg.icon-audio {
    stroke: #16a34a;
}

svg.icon-check {
    stroke: #059669;
}

svg.icon-x {
    stroke: #cbd5e1;
}
svg.icon-online {
    stroke: #f97316;
}

/* Legend */
.legend {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #475569;
}

/* Desktop - Full Width Responsive */
@media (min-width: 769px) {
    #comparisonModal .modal-content {
        max-width: 98vw;
        width: 98vw;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    #comparisonModal .modal-content {
        max-width: 97vw;
        width: 97vw;
    }
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    #comparisonModal {
        padding: 0.5rem;
    }
    
    #comparisonModal .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 0.5rem;
        width: 100%;
    }
    
    #comparisonModal .modal-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #comparisonModal .modal-title {
        font-size: 1.25rem;
        text-align: center;
    }
    
    #comparisonModal .modal-description {
        font-size: 0.8rem;
    }
    
    #comparisonModal .close-button {
        position: absolute;
        right: 0.75rem;
        top: 0.75rem;
        padding: 0.5rem;
    }
    
    #comparisonModal .modal-body {
        padding: 0.75rem;
        max-height: calc(95vh - 100px);
    }
    
    /* Mobile Table Container */
    .table-container {
        max-height: 60vh;
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Mobile Table Styling */
    .comparison-table {
        min-width: 600px;
        font-size: 0.8rem;
    }
    
    .comparison-table thead th {
        padding: 0.5rem 0.25rem;
        min-width: 80px;
        font-size: 0.75rem;
    }
    
    .comparison-table thead th:first-child {
        min-width: 120px;
        padding-right: 0.5rem;
    }
    
    .package-header {
        gap: 0.25rem;
    }
    
    .package-name {
        font-size: 0.8rem;
        line-height: 1.2;
        text-align: center;
    }
    
    .package-price {
        font-size: 0.9rem;
    }
    
    .popular-badge {
        font-size: 0.65rem;
        padding: 0.1rem 0.3rem;
    }
    
    .features-label {
        font-size: 0.75rem;
    }
    
    /* Mobile Table Body */
    .category-row td {
        padding: 0.4rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .feature-row td {
        padding: 0.4rem 0.25rem;
    }
    
    .feature-row td:first-child {
        font-size: 0.75rem;
        padding-right: 0.5rem;
        line-height: 1.3;
    }
    
    /* Mobile Icons */
    .feature-value svg {
        width: 14px;
        height: 14px;
    }
    
    .feature-number {
        font-size: 0.8rem;
    }
    
    /* Mobile Legend */
    .legend {
        margin-top: 1rem;
        padding-top: 1rem;
        gap: 1rem;
        /* flex-direction: column; */
        align-items: center;
    }
    
    .legend-item {
        font-size: 0.75rem;
    }
    
    .legend-item svg {
        width: 14px;
        height: 14px;
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    #comparisonModal {
        padding: 0.25rem;
    }
    
    #comparisonModal .modal-content {
        max-height: 98vh;
    }
    
    #comparisonModal .modal-header {
        padding: 0.75rem;
    }
    
    #comparisonModal .modal-body {
        padding: 0.5rem;
        max-height: calc(98vh - 80px);
    }
    
    .comparison-table {
        min-width: 500px;
        font-size: 0.75rem;
    }
    
    .comparison-table thead th {
        padding: 0.4rem 0.2rem;
        min-width: 70px;
        font-size: 0.7rem;
    }
    
    .comparison-table thead th:first-child {
        min-width: 100px;
    }
    
    .package-name {
        font-size: 0.75rem;
    }
    
    .package-price {
        font-size: 0.8rem;
    }
    
    .category-row td {
        padding: 0.3rem 0.2rem;
        font-size: 0.7rem;
    }
    
    .feature-row td {
        padding: 0.3rem 0.2rem;
    }
    
    .feature-row td:first-child {
        font-size: 0.7rem;
    }
    
    .feature-value svg {
        width: 12px;
        height: 12px;
    }
    
    .feature-number {
        font-size: 0.75rem;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #comparisonModal .modal-content {
        max-height: 90vh;
    }
    
    #comparisonModal .modal-body {
        max-height: calc(90vh - 80px);
    }
    
    .table-container {
        max-height: 50vh;
    }
}

/* Scrollbar Styling */
#comparisonModal .modal-body::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#comparisonModal .modal-body::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#comparisonModal .modal-body::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#comparisonModal .modal-body::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Better touch targets */
    .comparison-table thead th,
    .comparison-table tbody td {
        min-height: 44px; /* iOS minimum touch target */
    }
    
    /* Improved scrolling on mobile */
    .table-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Better visual hierarchy on mobile */
    .category-row td {
        font-weight: 700;
        background-color: #f1f5f9;
        border-left: 3px solid #2563eb;
    }
    
    /* Enhanced package headers for mobile */
    .package-header {
        min-height: 60px;
        justify-content: center;
    }
    
    /* Better spacing for mobile */
    .comparison-table tbody tr:not(.category-row) {
        border-bottom: 1px solid #e2e8f0;
    }
    
    /* Mobile swipe hint styling */
    .mobile-swipe-hint {
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0,0,0,0.8);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 500;
        z-index: 1000;
        pointer-events: none;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
}

/* High DPI mobile displays */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    .comparison-table {
        font-size: 0.85rem;
    }
    
    .feature-value svg {
        width: 16px;
        height: 16px;
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    .comparison-table thead th:focus,
    .comparison-table tbody td:focus {
        outline: 2px solid #2563eb;
        outline-offset: -2px;
    }
    
    /* Ensure text is readable on mobile */
    .comparison-table tbody td {
        line-height: 1.4;
    }
    
    /* Better contrast for mobile */
    .feature-row:hover {
        background-color: rgba(37, 99, 235, 0.05);
    }
}
