/**
 * WooCommerce Download Centre Styles
 * 
 * Handles styling for:
 * - Search and filter containers
 * - Product and file listings
 * - Download button and selection counter
 * - Error and loading states
 */

/* Main Container */
.wdc-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
}

/* Top Bar - Table of products, search, selection, download (matches mockup) */
.wdc-top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 30px;
    margin-bottom: 24px;
    padding: 16px 0;
}

.wdc-top-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #222;
    flex-shrink: 0;
}

.wdc-search-inline {
    position: relative;
    flex: 1;
    min-width: 180px;
    max-width: 280px;
}

.wdc-search-inline .wdc-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #666;
    pointer-events: none;
}

.wdc-search-rounded {
    width: 100%;
    padding: 10px 16px 10px 42px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 50px;
    box-sizing: border-box;
}

.wdc-search-rounded:focus {
    outline: none;
    border-color: #555;
}

.wdc-selection-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 13px;
}

.wdc-selection-count {
    font-weight: 600;
    color: #222;
}

.wdc-selection-size {
    color: #555;
    font-size: 12px;
}

.wdc-max-size-label {
    color: #666;
    font-size: 12px;
    font-weight: 500;
}

.wdc-size-limit-error {
    color: #c00;
    font-weight: 600;
    font-size: 12px;
}

.wdc-max-limit-label.wdc-limit-exceeded {
    color: #c00;
}

.wdc-download-btn-black {
    padding: 10px 28px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.wdc-download-btn-black .wdc-download-icon {
    font-size: 16px;
}

.wdc-download-btn-black:hover:not(:disabled) {
    background: #333;
}

.wdc-download-btn-black:disabled {
    background: #999;
    cursor: not-allowed;
}

.wdc-category-row {
    margin-bottom: 15px;
}

.wdc-category-row .wdc-category-select {
    max-width: 250px;
}

/* Filter By Categories */
.wdc-filter-by-categories {
    margin-bottom: 24px;
}

.wdc-filter-heading {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 700;
    color: #222;
}

.wdc-category-boxes {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.wdc-category-box-wrap {
    position: relative;
}

.wdc-category-box {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-width: 180px;
    min-height: 120px;
    padding: 0;
    background: #f5f5f5;
    background-size: cover;
    background-position: center;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    text-align: center;
    overflow: hidden;
}

.wdc-category-box--has-bg {
    background-color: #555;
}

.wdc-category-box-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.93));
    pointer-events: none;
    z-index: 0;
}

.wdc-category-box-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 20px 18px;
    flex: 1;
}

.wdc-category-box-icon {
    margin-bottom: 8px;
    line-height: 0;
}

.wdc-category-box-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    background: #fff;
    padding: 4px;
}

.wdc-category-box-name {
    display: block;
    font-weight: 700;
    font-size: 15px;
    color: #222;
    margin-bottom: 10px;
    line-height: 1.25;
}

.wdc-category-toggle,
.wdc-category-direct {
    font-size: 13px;
    color: #0073aa;
    text-decoration: none;
}

.wdc-category-toggle:hover,
.wdc-category-direct:hover {
    text-decoration: underline;
}

.wdc-subcategory-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 100%;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 20;
    padding: 6px 0;
}

.wdc-category-box-wrap.open .wdc-subcategory-dropdown {
    display: block;
}

.wdc-subcategory-link {
    display: block;
    position: relative;
    padding: 0;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    overflow: hidden;
    min-height: 48px;
}

.wdc-subcategory-link--has-bg {
    background-size: cover;
    background-position: center;
    background-color: #e8e8e8;
}

.wdc-subcategory-link-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.88));
    pointer-events: none;
    z-index: 0;
}

.wdc-subcategory-link-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    min-height: 48px;
}

.wdc-subcategory-icon {
    flex-shrink: 0;
    line-height: 0;
}

.wdc-subcategory-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    background: #fff;
    padding: 2px;
}

.wdc-subcategory-text {
    font-weight: 600;
    color: #222;
}

.wdc-subcategory-link:hover {
    background-color: #f0f7fc;
    color: #0073aa;
}

.wdc-subcategory-link--has-bg:hover .wdc-subcategory-link-overlay {
    background: linear-gradient(to right, rgba(240, 247, 252, 0.95), rgba(240, 247, 252, 0.9));
}

.wdc-subcategory-link:hover .wdc-subcategory-text {
    color: #0073aa;
}

.wdc-subcategory-link--show-all {
    background-color: #fff7e6;
    border-bottom: 1px solid #f0e0c0;
}

.wdc-subcategory-link--show-all .wdc-subcategory-text {
    color: #b35900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 12px;
}

.wdc-subcategory-link--show-all .wdc-subcategory-icon--all {
    font-size: 18px;
    line-height: 1;
    color: #b35900;
}

.wdc-subcategory-link--show-all:hover {
    background-color: #ffeccb;
    color: #b35900;
}

.wdc-subcategory-link--show-all:hover .wdc-subcategory-text,
.wdc-subcategory-link--show-all:hover .wdc-subcategory-icon--all {
    color: #8a4400;
}

/* Depth-based indentation: L2 = 0, L3 = 1, L4 = 2, ... */
.wdc-subcategory-link--depth-1 .wdc-subcategory-link-inner {
    padding-left: 32px;
}
.wdc-subcategory-link--depth-1 .wdc-subcategory-text {
    font-weight: 500;
    font-size: 12.5px;
    color: #444;
}
.wdc-subcategory-link--depth-1 .wdc-subcategory-text::before {
    content: "└ ";
    color: #999;
    margin-right: 4px;
    font-weight: 400;
}

.wdc-subcategory-link--depth-2 .wdc-subcategory-link-inner {
    padding-left: 48px;
}
.wdc-subcategory-link--depth-2 .wdc-subcategory-text {
    font-weight: 400;
    font-size: 12px;
    color: #555;
}
.wdc-subcategory-link--depth-2 .wdc-subcategory-text::before {
    content: "└ ";
    color: #b3b3b3;
    margin-right: 4px;
}

.wdc-subcategory-link--depth-3 .wdc-subcategory-link-inner {
    padding-left: 64px;
}
.wdc-subcategory-link--depth-3 .wdc-subcategory-text {
    font-weight: 400;
    font-size: 11.5px;
    color: #666;
}
.wdc-subcategory-link--depth-3 .wdc-subcategory-text::before {
    content: "└ ";
    color: #c4c4c4;
    margin-right: 4px;
}

.wdc-active-filter-wrap {
    scroll-margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.wdc-active-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.wdc-active-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.wdc-active-filter-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    color: #1565c0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}

.wdc-active-filter-clear:hover {
    background: rgba(21, 101, 192, 0.2);
    color: #0d47a1;
}

/* Search Section (legacy/fallback) */
.wdc-search-section {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.wdc-search-box {
    flex: 1;
    min-width: 250px;
}

.wdc-search-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wdc-search-input:focus {
    outline: none;
    border-color: #0073aa;
}

.wdc-filter-box {
    min-width: 200px;
}

.wdc-category-select {
    padding: 12px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
}

/* Results Section */
.wdc-results {
    background: #fff;
    margin-bottom: 20px;
    min-height: 80px;
    overflow-x: auto;
    padding: 20px;
}

.wdc-results-scroll-anchor {
    height: 0;
    width: 100%;
    scroll-margin-top: 100px;
    pointer-events: none;
}


.wdc-results .wdc-table-container {
    margin: 0;
    padding: 0;
}

/* Table Container */
.wdc-table-container {
    width: 100%;
}

/* Select All Section */
.wdc-select-all-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.wdc-select-all-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    user-select: none;
    font-weight: 500;
}

.wdc-select-all-label:hover {
    color: #0073aa;
}

.wdc-select-all-checkbox {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

/* Results Table */
.wdc-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.wdc-results-table-rounded {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #d9d9d9;
    background: #fff;
}

.wdc-results-table thead {
    background-color: #e8e8e8;
    border-bottom: 1px solid #d9d9d9;
}

.wdc-product-thumb {
    width: 80px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
    background: #f5f5f5;
}

.wdc-product-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.wdc-product-thumb-placeholder {
    font-size: 11px;
    color: #999;
    text-align: center;
}

.wdc-col-thumb {
    width: 100px;
}

.wdc-table-scroll-anchor {
    scroll-margin-top: 100px;
}

.wdc-col-product-images {
    min-width: 140px;
}

.wdc-results-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #222;
    border-bottom: 2px solid #ddd;
    white-space: nowrap;
}

.wdc-results-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    vertical-align: top;
    transition: background-color 0.2s;
}

.wdc-results-table tbody tr:hover {
    background-color: #f9f9f9;
}

.wdc-results-table tbody tr:last-child {
    border-bottom: none;
}

.wdc-results-table td {
    padding: 12px;
    vertical-align: middle;
}

/* Column Styles */
.wdc-col-checkbox {
    width: 50px;
    text-align: center;
}

.wdc-col-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.wdc-col-product {
    font-weight: 600;
    color: #222;
    width: 200px;
    min-width: 150px;
}

.wdc-product-name-link {
    color: inherit;
    text-decoration: none;
}

.wdc-product-name-link:hover,
.wdc-product-name-link:focus {
    color: #e97d2b;
    text-decoration: underline;
}

.wdc-product-name-link strong {
    font-weight: inherit;
}

.wdc-file-label--category .wdc-file-category-hint {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.wdc-file-pill--category {
    border-style: dashed;
}

.wdc-col-section {
    min-width: 150px;
}

/* File Label */
.wdc-file-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    user-select: none;
    margin-bottom: 8px;
    line-height: 1.4;
}

.wdc-file-label:last-child {
    margin-bottom: 0;
}

.wdc-file-label:hover {
    color: #0073aa;
}

.wdc-file-label input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.wdc-file-name {
    word-break: break-word;
    flex: 1;
}

.wdc-loading-message,
.wdc-empty-state {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: 20px 0;
}

.wdc-empty-state {
    padding: 28px 20px;
    background: #f7f7f7;
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    color: #555;
}

.wdc-loading {
    text-align: center;
    padding: 40px 20px;
}

.wdc-loading p {
    color: #0073aa;
    font-size: 16px;
    margin: 0;
}

/* Download Section */
.wdc-download-section {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.wdc-download-btn {
    padding: 12px 30px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    white-space: nowrap;
}

.wdc-download-btn:hover:not(:disabled) {
    background-color: #005a87;
    transform: translateY(-2px);
}

.wdc-download-btn:active:not(:disabled) {
    transform: translateY(0);
}

.wdc-download-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.wdc-selection-count {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

/* Error Messages */
.wdc-error-message {
    padding: 15px 20px;
    margin-bottom: 20px;
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
    border-radius: 4px;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .wdc-results-table {
        font-size: 13px;
    }

    .wdc-results-table th,
    .wdc-results-table td {
        padding: 10px;
    }

    .wdc-col-product {
        min-width: 120px;
        width: 150px;
    }

    .wdc-col-section {
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .wdc-top-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .wdc-search-inline {
        max-width: none;
    }

    .wdc-download-btn-black {
        justify-content: center;
    }

    .wdc-search-section {
        flex-direction: column;
    }

    .wdc-search-box,
    .wdc-filter-box {
        width: 100%;
        min-width: unset;
    }

    .wdc-download-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .wdc-download-btn {
        width: 100%;
        text-align: center;
    }

    .wdc-results-table {
        font-size: 12px;
    }

    .wdc-results-table th,
    .wdc-results-table td {
        padding: 8px;
    }

    .wdc-col-product {
        min-width: 100px;
        width: 120px;
    }

    .wdc-col-section {
        min-width: 100px;
    }

    .wdc-file-label {
        font-size: 12px;
    }

    .wdc-file-label input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .wdc-search-input,
    .wdc-category-select,
    .wdc-download-btn {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .wdc-search-section,
    .wdc-download-section {
        display: none;
    }
}

/* ========================================
   Product Files Shortcode [download_centre_files]
   Section headings + pill-shaped file buttons
   ======================================== */
.wdc-product-files {
    margin: 24px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.wdc-files-header {
    text-align: right;
    margin-bottom: 20px;
}

.wdc-enquire-btn {
    display: inline-block;
    padding: 10px 24px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.wdc-enquire-btn:hover {
    background: #333;
    color: #fff;
}

.wdc-files-section {
    margin-bottom: 24px;
}

.wdc-files-section:last-child {
    margin-bottom: 0;
}

.wdc-files-section-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: #222;
}

.wdc-files-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
}

.wdc-file-pill {
    display: inline-block;
    padding: 8px 18px;
    background: #fff;
    color: #222;
    border: 1px solid #000;
    border-radius: 50px;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.wdc-file-pill:hover {
    background: #f5f5f5;
    color: #222;
}

.wdc-files-empty {
    color: #666;
    font-size: 14px;
}