/**
 * CarbonGuru Product Footprints - Styles
 * Minimal styling that inherits from theme
 */

.carbonguru-product-footprints {
    max-width: 100%;
    margin: 0 auto;
}

.carbonguru-product-footprints h2 {
    margin-bottom: 1.5em;
}

/* Search form */
.carbonguru-search-form {
    margin-bottom: 2em;
    display: flex;
    gap: 0.5em;
    flex-wrap: wrap;
}

.carbonguru-search-form input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 0.5em;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.carbonguru-search-form button {
    padding: 0.5em 1.5em;
}

.carbonguru-search-form .clear-search {
    padding: 0.5em 1em;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    display: inline-block;
}

/* Result count */
.result-count {
    margin-bottom: 1em;
    color: #666;
    font-size: 0.9em;
}

/* Products table - inherits WooCommerce styling */
.carbonguru-footprints-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2em;
    background: #fff;
}

.carbonguru-footprints-table thead th {
    text-align: left;
    padding: 1em;
    background: #f7f7f7;
    border-bottom: 2px solid #ddd;
    font-weight: 600;
}

.carbonguru-footprints-table thead th a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.carbonguru-footprints-table thead th a:hover {
    color: #3A7CA5; /* CG Blue 500 */
}

.carbonguru-footprints-table tbody td {
    padding: 1em;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.carbonguru-footprints-table tbody tr:hover {
    background: #f9f9f9;
}

/* Responsive table */
@media screen and (max-width: 768px) {
    .carbonguru-footprints-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .carbonguru-footprints-table thead,
    .carbonguru-footprints-table tbody,
    .carbonguru-footprints-table tr,
    .carbonguru-footprints-table td,
    .carbonguru-footprints-table th {
        display: block;
    }

    .carbonguru-footprints-table thead {
        display: none;
    }

    .carbonguru-footprints-table tbody tr {
        margin-bottom: 1.5em;
        border: 1px solid #ddd;
        border-radius: 3px;
    }

    .carbonguru-footprints-table tbody td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        white-space: normal;
    }

    .carbonguru-footprints-table tbody td::before {
        content: attr(data-label);
        position: absolute;
        left: 1em;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
    }
}

/* Offset button (legacy) */
.offset-btn {
    padding: 0.5em 1em;
    background: #067F38; /* CG Green 600 */
    color: #fff;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9em;
}

.offset-btn:hover {
    background: #056830; /* CG Green 700 */
}

.offset-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ==========================================================================
   Product Action Buttons - CG Brand Colors
   ========================================================================== */

/* Offset button - CG Green */
.cg-product-button-group .carbonguru-product-add-btn[data-action-type="offset"],
.cg-product-button-group button.carbonguru-product-add-btn[data-action-type="offset"],
.cg-product-button-group button.wp-element-button[data-action-type="offset"],
button.carbonguru-product-add-btn[data-action-type="offset"] {
    background: #067F38 !important; /* CG Green 600 */
    background-color: #067F38 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 0 !important;
}

.cg-product-button-group .carbonguru-product-add-btn[data-action-type="offset"]:hover,
.cg-product-button-group button.carbonguru-product-add-btn[data-action-type="offset"]:hover,
button.carbonguru-product-add-btn[data-action-type="offset"]:hover {
    background: #056830 !important; /* CG Green 700 */
    background-color: #056830 !important;
}

/* Removal button - CG Blue 700 */
/* Override WordPress theme.json button styles via CSS custom properties */
.cg-product-button-group .carbonguru-product-add-btn[data-action-type="removal"],
.cg-product-button-group button.carbonguru-product-add-btn[data-action-type="removal"],
.cg-product-button-group button.wp-element-button[data-action-type="removal"],
button.carbonguru-product-add-btn[data-action-type="removal"],
button.wp-element-button[data-action-type="removal"],
.wp-element-button[data-action-type="removal"] {
    --wp--preset--color--cg-green-600: #1A4A73;
    --wp--preset--color--cg-green-300: #153d5e;
    background: #1A4A73 !important; /* CG Blue 700 */
    background-color: #1A4A73 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 0 !important;
}

.cg-product-button-group .carbonguru-product-add-btn[data-action-type="removal"]:hover,
.cg-product-button-group button.carbonguru-product-add-btn[data-action-type="removal"]:hover,
button.carbonguru-product-add-btn[data-action-type="removal"]:hover,
button.wp-element-button[data-action-type="removal"]:hover,
.wp-element-button[data-action-type="removal"]:hover {
    background: #153d5e !important; /* CG Blue 800 */
    background-color: #153d5e !important;
}

/* Pagination */
.carbonguru-pagination {
    text-align: center;
    margin-top: 2em;
}

.carbonguru-pagination .page-numbers {
    display: inline-block;
    padding: 0.5em 1em;
    margin: 0 0.25em;
    background: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: #333;
}

.carbonguru-pagination .page-numbers:hover {
    background: #067F38; /* CG Green 600 */
    color: #fff;
    border-color: #067F38;
}

.carbonguru-pagination .page-numbers.current {
    background: #067F38; /* CG Green 600 */
    color: #fff;
    border-color: #067F38;
}

.carbonguru-pagination .page-numbers.dots {
    border: none;
    background: transparent;
}

/* ==========================================================================
   Batch Action Buttons - CG Brand Colors
   ========================================================================== */

.cg-batch-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
    line-height: 1.4;
}

/* Offset Cart — CG Green 600 */
.cg-batch-btn--offset {
    background: #067F38;
    color: #fff;
}
.cg-batch-btn--offset:hover {
    background: #056830;
    color: #fff;
}

/* Removals Cart — CG Blue 700 */
.cg-batch-btn--removal {
    background: #1A4A73;
    color: #fff;
}
.cg-batch-btn--removal:hover {
    background: #133A5C;
    color: #fff;
}

/* Delete Items — Outline / Danger on hover */
.cg-batch-btn--delete {
    background: transparent;
    color: #4A5568;
    border: 1px solid #D4D8DD;
}
.cg-batch-btn--delete:hover {
    background: #F6F8FA;
    color: #E5484D;
    border-color: #E5484D;
}

/* Disabled state for all batch buttons */
.cg-batch-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Product button group - matches WooCommerce button styling */
.cg-product-button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.cg-product-button-group .wc-block-components-button {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 48px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    box-sizing: border-box;
}

.cg-product-button-group .cg-product-status {
    font-size: 0.9rem;
}

/* Responsive adjustments for product buttons */
@media (max-width: 480px) {
    .cg-product-button-group {
        flex-direction: column;
        gap: 10px;
    }

    .cg-product-button-group .wc-block-components-button {
        width: 100%;
    }
}

/* Offset status styling */
.offset-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.offset-status.offset-purchased {
    background: #E6F5EC; /* CG Green 050 */
    color: #067F38; /* CG Green 600 */
    border: 1px solid #C2E8D2; /* CG Green 100 */
}

.offset-status.offset-not-purchased {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.offset-icon {
    font-size: 14px;
    font-weight: bold;
}

.offset-cert-link {
    text-decoration: none;
    font-size: 16px;
    margin-left: 4px;
    transition: transform 0.2s;
}

.offset-cert-link:hover {
    transform: scale(1.2);
}

/* Mobile responsive for offset status */
@media (max-width: 768px) {
    .offset-status {
        font-size: 11px;
        padding: 3px 6px;
    }

    .offset-text {
        display: none;
    }

    .offset-icon {
        font-size: 16px;
    }
}
