/* Responsive Pricing Table CSS */

/* Base Styles - Desktop */
.pricing-table-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

.pricing-table {
    width: 100%;
    border-collapse: collapse;
}

.pricing-table thead {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.pricing-table th,
.pricing-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.pricing-table th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pricing-table tbody tr:hover {
    background: #f7fafc;
    transition: background 0.3s ease;
}

.pricing-table .price-cell {
    font-weight: 600;
    color: #667eea;
    font-size: 1.1rem;
}

.pricing-table .category-row {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.pricing-table .category-row td {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 1rem;
}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .pricing-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .pricing-table {
        min-width: 700px;
        font-size: 0.95rem;
    }
    
    .pricing-table th,
    .pricing-table td {
        padding: 0.875rem 0.75rem;
    }
    
    .pricing-table th {
        font-size: 0.8rem;
    }
    
    .pricing-table .price-cell {
        font-size: 1rem;
    }
}

/* Mobile (< 768px) - Card Layout */
@media (max-width: 768px) {
    .pricing-table-container {
        overflow: visible;
        box-shadow: none;
        background: transparent;
        border-radius: 0;
    }
    
    /* Hide table header */
    .pricing-table thead {
        display: none;
    }
    
    /* Convert table to cards */
    .pricing-table,
    .pricing-table tbody,
    .pricing-table tr,
    .pricing-table td {
        display: block;
        width: 100%;
    }
    
    .pricing-table tbody tr {
        background: white;
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        border: 1px solid #e2e8f0;
        overflow: visible;
    }
    
    .pricing-table tbody tr:hover {
        background: white;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
        transform: translateY(-2px);
        transition: all 0.3s ease;
    }
    
    /* Category rows */
    .pricing-table .category-row {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        padding: 1rem;
        margin-bottom: 0.5rem;
        border-radius: 12px;
    }
    
    .pricing-table .category-row td {
        padding: 0;
        border: none;
        text-align: center;
        font-size: 1.1rem;
    }
    
    /* Regular rows */
    .pricing-table tbody tr:not(.category-row) td {
        padding: 0.75rem 0;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        padding-left: 45%;
        text-align: left;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    
    .pricing-table tbody tr:not(.category-row) td:last-child {
        border-bottom: none;
    }
    
    /* Add labels before content */
    .pricing-table tbody tr:not(.category-row) td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 0.75rem;
        width: 40%;
        padding-right: 10px;
        font-weight: 600;
        color: #4a5568;
        font-size: 0.85rem;
        text-align: left;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    
    /* Price cells styling */
    .pricing-table .price-cell {
        font-size: 1.1rem;
        font-weight: 700;
        color: #667eea;
        min-height: 2rem;
        display: flex;
        align-items: center;
    }
    
    /* Service type (first column) */
    .pricing-table tbody tr:not(.category-row) td:first-child {
        font-weight: 600;
        color: #2d3748;
        font-size: 1rem;
        padding-left: 0;
        padding-bottom: 0.5rem;
        padding-top: 0.5rem;
        border-bottom: 2px solid #667eea;
        margin-bottom: 0.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        line-height: 1.4;
    }
    
    .pricing-table tbody tr:not(.category-row) td:first-child:before {
        display: none;
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
    .pricing-table tbody tr {
        padding: 0.875rem;
        margin-bottom: 0.875rem;
    }
    
    .pricing-table tbody tr:not(.category-row) td {
        padding: 0.75rem 0;
        padding-left: 0;
        font-size: 0.9rem;
        display: block;
        width: 100%;
    }
    
    .pricing-table tbody tr:not(.category-row) td:before {
        position: static;
        display: block;
        font-size: 0.8rem;
        width: 100%;
        margin-bottom: 0.25rem;
        color: #718096;
    }
    
    .pricing-table tbody tr:not(.category-row) td:first-child {
        font-size: 0.95rem;
        padding-bottom: 0.75rem;
    }
    
    .pricing-table .price-cell {
        font-size: 1rem;
        display: block;
        min-height: auto;
    }
    
    .pricing-table .category-row td {
        font-size: 1rem;
        padding: 0.875rem 0;
    }
}

/* Horizontal Scroll Indicator for Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .pricing-table-container:after {
        content: '← เลื่อนดูเพิ่มเติม →';
        display: block;
        text-align: center;
        padding: 0.5rem;
        background: #f7fafc;
        color: #718096;
        font-size: 0.85rem;
        font-style: italic;
    }
    
    .pricing-table-container.scrolled:after {
        display: none;
    }
}

/* Handle line breaks in notes */
@media (max-width: 768px) {
    .pricing-table tbody tr:not(.category-row) td {
        line-height: 1.6;
    }
    
    /* Ensure br tags work properly */
    .pricing-table tbody tr:not(.category-row) td br {
        display: block;
        content: "";
        margin: 0.25rem 0;
    }
}

/* Print Styles */
@media print {
    .pricing-table-container {
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
    
    .pricing-table tbody tr:hover {
        background: white;
    }
    
    .pricing-table {
        font-size: 10pt;
    }
}
