/* Billing Pie Catalog Plugin - Frontend Styles */

/* Basket Button Styling */
.billingpie-basket-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: inline-block;
    text-decoration: none;
}

.billingpie-basket-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    color: #fff;
    text-decoration: none;
}

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

/* Basket List Styling */
.billingpie-basket-list {
    background: #ffffff;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.billingpie-basket-list-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.billingpie-basket-list-item:hover {
    background: #f8f9fa;
    border-radius: 6px;
    padding-left: 10px;
    padding-right: 10px;
}

.billingpie-basket-list-item:last-child {
    border-bottom: none;
}

.billingpie-remove-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    margin-left: 10px;
    transition: all 0.2s;
}

.billingpie-remove-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Download Popup Styling */
.billingpie-download-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none !important; /* Hidden by default - use !important to override any inline styles */
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
}

/* Show popup when explicitly set to flex via JavaScript */
.billingpie-download-popup.show-popup {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.billingpie-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.billingpie-popup-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
    animation: slideUp 0.3s ease;
}

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

.billingpie-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.billingpie-popup-close:hover {
    background: #e5e7eb;
    color: #374151;
    transform: rotate(90deg);
}

.billingpie-popup-content h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

.billingpie-download-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.billingpie-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    text-decoration: none;
}

.billingpie-btn-pdf {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.billingpie-btn-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.billingpie-btn-zip {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.billingpie-btn-zip:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.billingpie-btn-image {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.billingpie-btn-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.billingpie-icon {
    font-size: 20px;
}

/* Utility Classes */
.hide {
    display: none !important;
}

/* Download Basket Styles */
.billingpie-basket-wrapper {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.billingpie-basket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.billingpie-basket-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
}

.billingpie-clear-all-btn {
    background: #ef4444;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.billingpie-clear-all-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    color: #fff;
    text-decoration: none;
}

.billingpie-basket-table-wrapper {
    overflow-x: auto;
    margin-bottom: 30px;
}

.billingpie-basket-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    table-layout: auto; /* Changed from fixed to auto for better word wrapping */
}

.billingpie-basket-table th,
.billingpie-basket-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.billingpie-basket-table .product-thumbnail {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

.billingpie-basket-table .product-name {
    width: 200px;
    max-width: 100%;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    padding-right: 20px; /* Add padding to prevent overlap with next column */
}

.billingpie-basket-table .product-status {
    width: 120px;
    min-width: 120px;
}

.billingpie-basket-table .product-remove {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    text-align: center;
}

.billingpie-basket-table thead {
    background: #f8f9fa;
}

.billingpie-basket-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
}

.billingpie-basket-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.billingpie-basket-item:hover {
    background: #f9fafb;
}

.billingpie-remove-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 50%;
    text-decoration: none;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s;
}

.billingpie-remove-item:hover {
    background: #dc2626;
    color: #fff;
    transform: scale(1.1);
    text-decoration: none;
}

.billingpie-product-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s;
    display: block;
    max-width: 100%;
}

.billingpie-product-thumbnail:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.billingpie-basket-table .product-name a {
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: color 0.2s;
    display: inline-block;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.5;
}

.billingpie-basket-table .product-name a:hover {
    color: #667eea;
    text-decoration: none;
}

.stock-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-status.in-stock {
    background: #d1fae5;
    color: #065f46;
}

.stock-status.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

.stock-status.on-backorder {
    background: #fef3c7;
    color: #92400e;
}

/* Download Options Section */
.billingpie-download-options {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
    border: 2px solid #e5e7eb;
}

.billingpie-out-of-stock-option {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.billingpie-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 15px;
    color: #374151;
}

.billingpie-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.billingpie-checkbox-custom {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 24px;
    background: #fff;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    margin-right: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.billingpie-checkbox:checked ~ .billingpie-checkbox-custom {
    background: #667eea;
    border-color: #667eea;
}

.billingpie-checkbox:checked ~ .billingpie-checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.billingpie-checkbox-label:hover .billingpie-checkbox-custom {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.billingpie-checkbox-text {
    flex: 1;
    line-height: 1.5;
}

.billingpie-download-button-wrapper {
    text-align: center;
}

.billingpie-theme-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.billingpie-theme-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    color: #fff;
    text-decoration: none;
}

.billingpie-theme-button:active {
    transform: translateY(0);
}

.billingpie-download-icon {
    font-size: 20px;
}

/* Empty Basket */
.billingpie-empty-basket {
    text-align: center;
    padding: 60px 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px dashed #d1d5db;
}

.billingpie-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.billingpie-empty-message {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 25px;
}

.billingpie-shop-link {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.billingpie-shop-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: #fff;
    text-decoration: none;
}

/* Popup Improvements */
.billingpie-popup-header {
    text-align: center;
    margin-bottom: 25px;
}

.billingpie-popup-header h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

.billingpie-popup-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.billingpie-btn-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    flex: 1;
}

.billingpie-btn-content strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.billingpie-btn-content small {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    font-weight: normal;
}

.billingpie-download-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
    padding: 18px 24px;
}

.billingpie-btn-detailed-pdf {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.billingpie-btn-detailed-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

/* Category / Tag PDFs UI – compact */
.billingpie-category-pdfs-wrapper {
    background: #ffffff;
    border-radius: 10px;
    padding: 16px 20px;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.billingpie-tag-pdfs-wrapper {
    margin-top: 12px;
}

/* Header row: title left, List/Grid toggle right */
.billingpie-pdf-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.billingpie-pdf-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    line-height: 1.3;
}

.billingpie-pdf-view-toggle {
    display: flex;
    gap: 0;
    flex-shrink: 0;
}

.billingpie-view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    min-height: 44px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.billingpie-view-icon {
    font-size: 16px;
    line-height: 1;
    opacity: 0.9;
}

.billingpie-view-toggle-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.billingpie-view-toggle-btn:last-child {
    border-radius: 0 6px 6px 0;
    border-left-width: 0;
}

.billingpie-view-toggle-btn:hover {
    background: #f9fafb;
    color: #374151;
}

.billingpie-view-toggle-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.billingpie-pdf-intro {
    color: #6b7280;
    font-size: 14px;
    margin: 0 0 14px 0;
    line-height: 1.5;
}

.billingpie-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 4px 0;
}

.billingpie-section-description {
    color: #6b7280;
    margin: 0 0 12px 0;
    font-size: 13px;
}

/* Default: List view */
.billingpie-view-list .billingpie-category-pdfs-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.billingpie-view-list .billingpie-category-pdf-item {
    flex-direction: row;
    min-height: auto;
    width: 100%;
    padding: 10px 12px;
}

.billingpie-view-list .billingpie-category-pdf-content {
    flex-direction: row;
    flex: 1;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.billingpie-view-list .billingpie-category-pdf-thumbnail {
    width: 72px;
    min-width: 72px;
    height: 72px;
    margin-bottom: 0;
}

.billingpie-view-list .billingpie-category-pdf-name-wrap {
    flex: 1;
    min-height: 0;
    margin-bottom: 0;
}

.billingpie-view-list .billingpie-download-pdf-btn,
.billingpie-view-list .billingpie-download-pdf-btn-disabled,
.billingpie-view-list .billingpie-pdf-not-available {
    margin-top: 0;
    width: auto;
    min-width: 120px;
}

/* Grid view (explicit class when user switches) */
.billingpie-view-grid .billingpie-category-pdfs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.billingpie-view-grid .billingpie-category-pdf-item {
    flex-direction: column;
    min-height: 220px;
}

.billingpie-view-grid .billingpie-category-pdf-content {
    flex-direction: column;
}

.billingpie-view-grid .billingpie-category-pdf-thumbnail {
    width: 100%;
    min-width: 0;
    height: 100px;
    margin-bottom: 8px;
}

.billingpie-view-grid .billingpie-category-pdf-name-wrap {
    margin-bottom: 8px;
}

.billingpie-view-grid .billingpie-download-pdf-btn,
.billingpie-view-grid .billingpie-download-pdf-btn-disabled,
.billingpie-view-grid .billingpie-pdf-not-available {
    margin-top: auto;
    width: 100%;
}

.billingpie-category-pdfs-section {
    margin-bottom: 14px;
}

.billingpie-category-pdfs-section:last-child {
    margin-bottom: 0;
}

.billingpie-subsection-title {
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
    margin: 0 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
    text-transform: none;
}

.billingpie-categories-parent .billingpie-subsection-title {
    color: #374151;
}

.billingpie-categories-sub .billingpie-subsection-title {
    color: #6b7280;
}

.billingpie-category-pdf-name-wrap {
    min-height: 2.6em;
    margin-bottom: 8px;
}

.billingpie-parent-label {
    display: block;
    font-size: 11px;
    font-weight: normal;
    color: #6b7280;
    margin: 0 0 2px 0;
    line-height: 1.2;
    text-transform: none;
}

.billingpie-category-pdfs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 0;
}

.billingpie-category-pdf-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    transition: all 0.2s;
    min-height: 220px;
    display: flex;
    flex-direction: column;
}

.billingpie-category-pdf-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.billingpie-subcategory-item {
    border-left: 3px solid #667eea;
}

.billingpie-category-pdf-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.12);
    transform: translateY(-1px);
}

.billingpie-category-pdf-thumbnail {
    width: 100%;
    height: 100px;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.billingpie-category-placeholder {
    font-size: 36px;
    color: #c3c4c7;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.billingpie-category-pdf-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.billingpie-category-pdf-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-transform: none;
}

.billingpie-download-pdf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s;
    width: 100%;
    margin-top: auto;
}

.billingpie-download-pdf-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
    color: #fff;
    text-decoration: none;
}

.billingpie-download-pdf-btn-disabled {
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.6;
    background: #9ca3af !important;
}

.billingpie-pdf-not-available {
    display: block;
    text-align: center;
    color: #9ca3af;
    font-size: 11px;
    padding: 6px 8px;
    background: #f3f4f6;
    border-radius: 4px;
}

.billingpie-no-categories {
    text-align: center;
    color: #6b7280;
    padding: 20px 16px;
    font-size: 14px;
}

/* Category Download UI – compact */
.billingpie-category-download-wrapper {
    background: #ffffff;
    border-radius: 10px;
    padding: 16px 20px;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.billingpie-category-checkbox-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}

.billingpie-category-checkbox-item {
    margin-bottom: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.billingpie-category-checkbox-item:hover {
    background: #f3f4f6;
}

.billingpie-category-checkbox-item label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.billingpie-category-count {
    color: #6b7280;
    font-size: 13px;
    font-weight: normal;
}

.billingpie-category-download-actions {
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

/* Responsive – Category/Tag PDF sections */
@media (max-width: 768px) {
    .billingpie-category-pdfs-wrapper {
        padding: 12px 14px;
    }
    
    .billingpie-pdf-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .billingpie-pdf-section-title {
        font-size: 18px;
    }
    
    .billingpie-pdf-view-toggle {
        align-self: flex-end;
    }
    
    .billingpie-view-toggle-btn {
        padding: 10px 16px;
        min-height: 44px;
    }
    
    .billingpie-pdf-intro {
        font-size: 13px;
        margin-bottom: 12px;
    }
    
    .billingpie-view-list .billingpie-category-pdf-item {
        padding: 10px 8px;
    }
    
    .billingpie-view-list .billingpie-category-pdf-thumbnail {
        width: 56px;
        min-width: 56px;
        height: 56px;
    }
    
    .billingpie-view-list .billingpie-category-pdf-content {
        gap: 10px;
    }
    
    .billingpie-view-list .billingpie-download-pdf-btn,
    .billingpie-view-list .billingpie-download-pdf-btn-disabled,
    .billingpie-view-list .billingpie-pdf-not-available {
        min-width: 100px;
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .billingpie-view-grid .billingpie-category-pdfs-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .billingpie-view-grid .billingpie-category-pdf-item {
        min-height: 200px;
    }
    
    .billingpie-view-grid .billingpie-category-pdf-thumbnail {
        height: 80px;
    }
    
    .billingpie-category-pdfs-section {
        margin-bottom: 12px;
    }
    
    .billingpie-subsection-title {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .billingpie-view-grid .billingpie-category-pdfs-grid {
        grid-template-columns: 1fr;
    }
    
    .billingpie-view-toggle-btn .billingpie-view-label {
        display: none;
    }
    
    .billingpie-view-toggle-btn {
        padding: 10px 14px;
    }
    
    .billingpie-view-icon {
        font-size: 18px;
    }
}

/* General responsive (basket, popup, etc.) */
@media (max-width: 768px) {
    .billingpie-popup-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .billingpie-download-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .billingpie-basket-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .billingpie-basket-title {
        font-size: 24px;
    }
    
    .billingpie-basket-table {
        font-size: 14px;
    }
    
    .billingpie-basket-table th,
    .billingpie-basket-table td {
        padding: 10px;
    }
    
    .billingpie-product-thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .billingpie-category-pdfs-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 8px;
    }
    
    .billingpie-category-pdf-thumbnail {
        height: 80px;
    }
}

.editpopup {
    display: none !important; /* Hidden by default - use !important to override any inline styles */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
}

/* Show editpopup when explicitly shown via JavaScript */
.editpopup.show-editpopup,
.editpopup[style*="display: flex"],
.editpopup[style*="display:flex"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.div {
    background-color: white;
    text-align: center;
    padding: 20px;
    border: 5px solid #667eea;
    border-radius: 10px;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    margin-top: 20px;
    margin-bottom: 20px;
    margin-left: 20px;
    margin-right: 20px;
    font-size: 16px;
    font-weight: 600;
}