/* =========================================================
   ECSL COA Manager – Frontend Styles
   Dark biotech palette: #0d1f2d bg, #2dcfb3 teal accent
   ========================================================= */

/* ---- Single product COA block ---- */
.ecsl-coa-single-block {
    background: #0d1f2d;
    border: 1px solid #1e3a50;
    border-left: 4px solid #2dcfb3;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 20px 0;
    color: #e0eaf2;
    font-family: inherit;
}

.ecsl-coa-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ecsl-coa-badge-svg {
    height: 36px;
    width: auto;
    flex-shrink: 0;
}

.ecsl-coa-details {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
}

.ecsl-coa-row {
    display: flex;
    gap: 8px;
    font-size: 0.875rem;
}

.ecsl-coa-label {
    color: #8baabb;
    white-space: nowrap;
    min-width: 150px;
}

.ecsl-coa-value {
    color: #e0eaf2;
    font-weight: 600;
}

/* ---- Download / action buttons ---- */
.ecsl-coa-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2dcfb3;
    color: #0d1f2d !important;
    font-weight: 700;
    font-size: 0.875rem;
    padding: 9px 18px;
    border-radius: 6px;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.03em;
}

.ecsl-coa-download-btn:hover,
.ecsl-coa-download-btn:focus {
    background: #20b89f;
    transform: translateY(-1px);
}

.ecsl-coa-download-btn--small {
    font-size: 0.8rem;
    padding: 6px 12px;
}

.ecsl-coa-coming-soon {
    font-size: 0.85rem;
    color: #8baabb;
    font-style: italic;
}

/* ---- Shop card meta ---- */
.ecsl-coa-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 6px 0;
}

.ecsl-coa-card-badge .ecsl-coa-badge-svg {
    height: 26px;
    width: auto;
}

.ecsl-coa-card-purity {
    font-size: 0.8rem;
    font-weight: 700;
    color: #2dcfb3;
    background: rgba(45,207,179,0.12);
    padding: 2px 7px;
    border-radius: 4px;
}

/* ---- COA Library shortcode ---- */
.ecsl-coa-library {
    font-family: inherit;
    margin: 24px 0;
}

.ecsl-coa-library-form {
    margin-bottom: 18px;
}

.ecsl-coa-library-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.ecsl-coa-search-input,
.ecsl-coa-cat-select {
    padding: 8px 12px;
    border: 1px solid #1e3a50;
    border-radius: 6px;
    background: #0d1f2d;
    color: #e0eaf2;
    font-size: 0.9rem;
    min-width: 180px;
}

.ecsl-coa-search-input:focus,
.ecsl-coa-cat-select:focus {
    outline: 2px solid #2dcfb3;
    outline-offset: 2px;
}

.ecsl-coa-search-btn {
    padding: 8px 18px;
    background: #2dcfb3;
    color: #0d1f2d;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.ecsl-coa-search-btn:hover { background: #20b89f; }

.ecsl-coa-reset-btn {
    padding: 8px 14px;
    color: #8baabb;
    font-size: 0.85rem;
    text-decoration: underline;
}

/* Table */
.ecsl-coa-table-wrap {
    overflow-x: auto;
}

.ecsl-coa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ecsl-coa-table th {
    background: #0d1f2d;
    color: #2dcfb3;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    padding: 10px 14px;
    border-bottom: 2px solid #1e3a50;
    text-align: left;
}

.ecsl-coa-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #1e3a50;
    vertical-align: middle;
}

.ecsl-coa-table tbody tr:hover td {
    background: rgba(45,207,179,0.04);
}

.ecsl-coa-table td a:not(.ecsl-coa-download-btn) {
    color: #2dcfb3;
    text-decoration: none;
    font-weight: 600;
}

.ecsl-coa-table td a:not(.ecsl-coa-download-btn):hover {
    text-decoration: underline;
}

/* Pagination */
.ecsl-coa-pagination {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.ecsl-coa-page-link {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #1e3a50;
    border-radius: 5px;
    color: #8baabb;
    text-decoration: none;
    font-size: 0.875rem;
    transition: border-color 0.2s, color 0.2s;
}

.ecsl-coa-page-link:hover,
.ecsl-coa-page-link.is-current {
    border-color: #2dcfb3;
    color: #2dcfb3;
    font-weight: 700;
}

.ecsl-coa-no-results {
    color: #8baabb;
    font-style: italic;
    padding: 20px 0;
}

/* =========================================================
   v1.2.0 Additions – Batch History Toggle & Library
   ========================================================= */

/* ---- Single product: history section ---- */
.ecsl-history-section {
    margin-top: 14px;
    border-top: 1px solid #1e3a50;
    padding-top: 12px;
}

.ecsl-history-toggle {
    background: none;
    border: 1px solid #2dcfb3;
    color: #2dcfb3;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.18s, color 0.18s;
}

.ecsl-history-toggle:hover,
.ecsl-history-toggle[aria-expanded="true"] {
    background: #2dcfb3;
    color: #0d1f2d;
}

.ecsl-toggle-arrow {
    font-size: 0.65rem;
    transition: transform 0.2s;
    display: inline-block;
}

.ecsl-history-toggle[aria-expanded="true"] .ecsl-toggle-arrow {
    transform: rotate(180deg);
}

/* ---- History table (inside single product) ---- */
.ecsl-history-list {
    margin-top: 12px;
    animation: ecslFadeIn 0.2s ease;
}

@keyframes ecslFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ecsl-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    color: #e0eaf2;
}

.ecsl-history-table th {
    color: #2dcfb3;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 10px;
    border-bottom: 1px solid #1e3a50;
    text-align: left;
}

.ecsl-history-table td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(30,58,80,0.6);
    color: #adc0cc;
}

.ecsl-history-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- COA Library: inline history panel ---- */
.ecsl-lib-history-toggle {
    background: none;
    border: 1px solid #1e3a50;
    border-radius: 4px;
    color: #8baabb;
    font-size: 0.78rem;
    padding: 3px 8px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.ecsl-lib-history-toggle:hover,
.ecsl-lib-history-toggle[aria-expanded="true"] {
    border-color: #2dcfb3;
    color: #2dcfb3;
}

.ecsl-lib-history-panel {
    margin-top: 8px;
    animation: ecslFadeIn 0.18s ease;
}

.ecsl-lib-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.ecsl-lib-history-table th {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #2dcfb3;
    padding: 5px 8px;
    border-bottom: 1px solid #1e3a50;
    text-align: left;
}

.ecsl-lib-history-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #1e3a50;
    color: #8baabb;
}

.ecsl-no-history {
    color: #3a5568;
    font-size: 0.85rem;
}

/* =========================================================
   v1.3.0 – COA Shop Shortcode  [ecsl_coa_shop]
   ========================================================= */

/* ---- Wrapper & filter bar ---- */
.ecsl-coa-shop-wrap {
    font-family: inherit;
    margin: 24px 0;
}

.ecsl-shop-filters {
    margin-bottom: 20px;
}

.ecsl-shop-filter-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ecsl-shop-search,
.ecsl-shop-cat-filter {
    padding: 9px 13px;
    border: 1px solid #1e3a50;
    border-radius: 6px;
    background: #0d1f2d;
    color: #e0eaf2;
    font-size: 0.9rem;
}

.ecsl-shop-search { min-width: 220px; }
.ecsl-shop-cat-filter { min-width: 160px; }

.ecsl-shop-search:focus,
.ecsl-shop-cat-filter:focus {
    outline: 2px solid #2dcfb3;
    outline-offset: 1px;
}

.ecsl-shop-filter-btn {
    padding: 9px 20px;
    background: #2dcfb3;
    color: #0d1f2d;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.ecsl-shop-filter-btn:hover { background: #20b89f; }

.ecsl-shop-reset-btn {
    color: #8baabb;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

.ecsl-shop-count {
    color: #8baabb;
    font-size: 0.82rem;
    margin: 0 0 16px;
}

/* ---- Card grid ---- */
.ecsl-coa-card-grid {
    display: grid;
    gap: 20px;
}

.ecsl-coa-card-grid--cols-1 { grid-template-columns: 1fr; }
.ecsl-coa-card-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.ecsl-coa-card-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.ecsl-coa-card-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }

@media ( max-width: 900px ) {
    .ecsl-coa-card-grid--cols-3,
    .ecsl-coa-card-grid--cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media ( max-width: 560px ) {
    .ecsl-coa-card-grid--cols-2,
    .ecsl-coa-card-grid--cols-3,
    .ecsl-coa-card-grid--cols-4 { grid-template-columns: 1fr; }
}

/* ---- Individual card ---- */
.ecsl-coa-card {
    background: #0d1f2d;
    border: 1px solid #1e3a50;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.ecsl-coa-card:hover {
    border-color: #2dcfb3;
    box-shadow: 0 4px 24px rgba(45,207,179,0.12);
}

.ecsl-coa-card--verified {
    border-top: 3px solid #2dcfb3;
}

/* Product image */
.ecsl-card-image-link { display: block; }

.ecsl-card-image {
    background: #081420;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ecsl-card-image img.ecsl-product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.ecsl-coa-card:hover .ecsl-product-img {
    transform: scale(1.04);
}

.ecsl-card-image--placeholder svg {
    width: 60px;
    height: 60px;
    opacity: 0.4;
}

/* Card header */
.ecsl-card-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #1e3a50;
}

.ecsl-card-verified-badge {
    display: block;
    margin-bottom: 8px;
}

.ecsl-card-verified-badge .ecsl-coa-badge-svg {
    height: 28px;
    width: auto;
}

.ecsl-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 6px;
    line-height: 1.3;
}

.ecsl-card-title a {
    color: #e0eaf2;
    text-decoration: none;
}

.ecsl-card-title a:hover { color: #2dcfb3; }

.ecsl-card-price {
    font-size: 0.9rem;
    color: #2dcfb3;
    font-weight: 600;
}

.ecsl-card-price .amount { color: inherit; }

/* Purity highlight strip */
.ecsl-card-coa-data {
    padding: 12px 16px;
    flex: 1;
}

.ecsl-card-purity-highlight {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    background: rgba(45,207,179,0.08);
    border: 1px solid rgba(45,207,179,0.25);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.ecsl-purity-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8baabb;
}

.ecsl-purity-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: #2dcfb3;
    letter-spacing: -0.01em;
}

/* COA data definition list */
.ecsl-card-dl {
    margin: 0;
    display: grid;
    gap: 5px;
}

.ecsl-dl-row {
    display: flex;
    gap: 8px;
    font-size: 0.82rem;
    line-height: 1.4;
}

.ecsl-card-dl dt {
    color: #8baabb;
    white-space: nowrap;
    min-width: 88px;
    font-weight: 600;
}

.ecsl-card-dl dd {
    color: #c9d8e3;
    margin: 0;
    word-break: break-word;
}

/* Actions */
.ecsl-card-actions {
    padding: 12px 16px;
    border-top: 1px solid #1e3a50;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.ecsl-card-view-btn {
    display: inline-flex;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: #8baabb;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid #1e3a50;
    border-radius: 5px;
    transition: border-color 0.18s, color 0.18s;
}

.ecsl-card-view-btn:hover {
    border-color: #2dcfb3;
    color: #2dcfb3;
}

/* Batch history inside card */
.ecsl-card-history {
    padding: 0 16px 14px;
}

/* ---- Admin field rows: extra grid rows for new fields ---- */
.ecsl-entry-fields--core,
.ecsl-entry-fields--lab {
    display: grid;
    grid-template-columns: 1fr 120px 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.ecsl-entry-fields--extra {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 4px;
}

.ecsl-field--wide {
    grid-column: 1 / -1;
}

@media ( max-width: 1100px ) {
    .ecsl-entry-fields--core,
    .ecsl-entry-fields--lab { grid-template-columns: 1fr 1fr; }
}
