/**
 * CarbonGuru Theme Blocks Styles
 *
 * Styles for CG Item Cost and CG Offset Status blocks.
 *
 * @package CarbonGuru_Theme_Blocks
 */

/* CG Offset Status Block Styles */
.cg-offset-status-block {
    margin: 0.5em 0;
}

.cg-offset-status-line {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
}

.cg-offset-status-icon {
    color: #067F38; /* CG Green 600 */
    font-weight: bold;
}

.cg-offset-status-label {
    color: #666; /* Match Item Cost label */
    font-weight: 400;
}

.cg-offset-status-value {
    font-weight: 600;
}

.cg-offset-status-yes {
    color: #067F38; /* CG Green 600 */
}

.cg-offset-status-no {
    color: #C13035; /* CG Critical Dark */
}

.cg-offset-status-login a {
    color: #0073aa;
    text-decoration: underline;
}

.cg-offset-status-login a:hover {
    color: #005177;
}

/* CG Offset Cost Block Styles (for future use) */
.cg-offset-cost-block {
    margin: 0.5em 0;
}

.cg-offset-cost-line,
.cg-offset-product-line {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
    margin-bottom: 0.25em;
}

.cg-offset-cost-label,
.cg-offset-product-label {
    color: #666;
}

.cg-offset-cost-value,
.cg-offset-product-value {
    font-weight: 500;
}

/* =====================================================
   CG BREADCRUMBS BLOCK
   ===================================================== */

.cg-breadcrumbs {
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.75em 0;
}

.cg-breadcrumbs__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.cg-breadcrumbs__item {
    display: flex;
    align-items: center;
}

.cg-breadcrumbs__link {
    color: #374151;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cg-breadcrumbs__link:hover {
    color: #111827;
    text-decoration: underline;
}

.cg-breadcrumbs__separator {
    color: #9ca3af;
    margin: 0 0.5em;
    user-select: none;
}

.cg-breadcrumbs__current {
    color: #6b7280;
    font-weight: 500;
}

/* Dark background variant */
.has-contrast-background-color .cg-breadcrumbs__link,
.has-dark-background .cg-breadcrumbs__link {
    color: rgba(255, 255, 255, 0.9);
}

.has-contrast-background-color .cg-breadcrumbs__link:hover,
.has-dark-background .cg-breadcrumbs__link:hover {
    color: #fff;
}

.has-contrast-background-color .cg-breadcrumbs__separator,
.has-dark-background .cg-breadcrumbs__separator {
    color: rgba(255, 255, 255, 0.5);
}

.has-contrast-background-color .cg-breadcrumbs__current,
.has-dark-background .cg-breadcrumbs__current {
    color: rgba(255, 255, 255, 0.7);
}

/* Compact variant for tight spaces */
.cg-breadcrumbs--compact {
    font-size: 0.75rem;
    padding: 0.5em 0;
}

.cg-breadcrumbs--compact .cg-breadcrumbs__separator {
    margin: 0 0.35em;
}

/* =====================================================
   CG RECENT SESSIONS BLOCK (Unified)
   Covers: carts, emails, orders, analyses
   ===================================================== */

/* Shared CSS Custom Properties */
.cg-recent-carts,
.cg-recent-emails,
.cg-recent-orders,
.cg-recent-analyses {
    --cg-green-600: #067F38;
    --cg-green-700: #056830;
    --cg-green-100: #E6F5EC;
    --cg-blue-700: #1A4A73;
    --cg-blue-500: #3A7CA5;
    --cg-blue-800: #153d5e;
    --cg-neutral-500: #6B7785;
    --cg-neutral-200: #EEEEEE;
}

/* Grid Layout */
.cg-recent-carts__grid,
.cg-recent-emails__grid,
.cg-recent-orders__grid,
.cg-recent-analyses__grid {
    display: flex !important;
    flex-wrap: wrap;
    gap: 1.5rem;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Grid Item */
.cg-recent-carts__item,
.cg-recent-emails__item,
.cg-recent-orders__item,
.cg-recent-analyses__item {
    flex: 1 1 calc(20% - 1.5rem);
    min-width: 150px;
    max-width: calc(20% - 1.2rem);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Title Links */
.cg-recent-carts__title-link,
.cg-recent-emails__title-link,
.cg-recent-orders__title-link,
.cg-recent-analyses__title-link {
    text-decoration: none;
    color: var(--cg-blue-700);
}

/* Titles */
.cg-recent-carts__title,
.cg-recent-emails__title,
.cg-recent-orders__title,
.cg-recent-analyses__title {
    font-size: var(--wp--preset--font-size--superbfont-medium, 1rem);
    font-weight: 500;
    margin: 0;
    line-height: 1.4;
    color: var(--cg-blue-700);
}

/* Title Hover */
.cg-recent-carts__title-link:hover .cg-recent-carts__title,
.cg-recent-emails__title-link:hover .cg-recent-emails__title,
.cg-recent-orders__title-link:hover .cg-recent-orders__title,
.cg-recent-analyses__title-link:hover .cg-recent-analyses__title {
    color: var(--cg-blue-500);
}

/* Carbon Footprint */
.cg-recent-carts__carbon,
.cg-recent-emails__carbon,
.cg-recent-orders__carbon,
.cg-recent-analyses__carbon {
    font-size: var(--wp--preset--font-size--superbfont-xsmall, 0.875rem);
    color: var(--cg-green-600);
    margin: 0;
    font-weight: 600;
}

/* Date */
.cg-recent-carts__date,
.cg-recent-emails__date,
.cg-recent-orders__date,
.cg-recent-analyses__date {
    font-size: 0.75rem;
    color: var(--cg-neutral-500);
    margin: 0;
}

/* Action Buttons Container */
.cg-recent-carts__actions,
.cg-recent-emails__actions,
.cg-recent-orders__actions,
.cg-recent-analyses__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* Buttons Base */
.cg-recent-carts__btn,
.cg-recent-emails__btn,
.cg-recent-orders__btn,
.cg-recent-analyses__btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    border-radius: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
    width: auto;
}

/* Offset Button */
.cg-recent-carts__btn--offset,
.cg-recent-emails__btn--offset,
.cg-recent-orders__btn--offset,
.cg-recent-analyses__btn--offset {
    background: var(--cg-green-600);
    color: #fff;
}

.cg-recent-carts__btn--offset:hover,
.cg-recent-emails__btn--offset:hover,
.cg-recent-orders__btn--offset:hover,
.cg-recent-analyses__btn--offset:hover {
    background: var(--cg-green-700);
    color: #fff;
}

/* Removal Button */
.cg-recent-carts__btn--removal,
.cg-recent-emails__btn--removal,
.cg-recent-orders__btn--removal,
.cg-recent-analyses__btn--removal {
    background: var(--cg-blue-700);
    color: #fff;
}

.cg-recent-carts__btn--removal:hover,
.cg-recent-emails__btn--removal:hover,
.cg-recent-orders__btn--removal:hover,
.cg-recent-analyses__btn--removal:hover {
    background: var(--cg-blue-800);
    color: #fff;
}

/* Offset Status (shown for already-offset items) */
.cg-recent-carts__offset-status,
.cg-recent-emails__offset-status,
.cg-recent-orders__offset-status,
.cg-recent-analyses__offset-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* Offset Badge */
.cg-recent-carts__offset-badge,
.cg-recent-emails__offset-badge,
.cg-recent-orders__offset-badge,
.cg-recent-analyses__offset-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.375rem 0.75rem;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cg-green-600);
    background: var(--cg-green-100);
    border-radius: 0;
}

.cg-recent-carts__offset-badge svg,
.cg-recent-emails__offset-badge svg,
.cg-recent-orders__offset-badge svg,
.cg-recent-analyses__offset-badge svg {
    flex-shrink: 0;
}

/* Offset Date */
.cg-recent-carts__offset-date,
.cg-recent-emails__offset-date,
.cg-recent-orders__offset-date,
.cg-recent-analyses__offset-date {
    font-size: 11px;
    color: var(--cg-neutral-500);
}

/* Empty State */
.cg-recent-carts__empty,
.cg-recent-emails__empty,
.cg-recent-orders__empty,
.cg-recent-analyses__empty {
    text-align: center;
    color: var(--cg-neutral-500);
    padding: 2rem;
    font-size: 0.875rem;
}

/* Login Prompt */
.cg-recent-carts__login-prompt,
.cg-recent-emails__login-prompt,
.cg-recent-orders__login-prompt,
.cg-recent-analyses__login-prompt {
    text-align: center;
    color: var(--cg-neutral-500);
    padding: 1rem;
    font-size: 0.875rem;
}

.cg-recent-carts__login-prompt a,
.cg-recent-emails__login-prompt a,
.cg-recent-orders__login-prompt a,
.cg-recent-analyses__login-prompt a {
    color: var(--cg-blue-700);
    text-decoration: underline;
}

.cg-recent-carts__login-prompt a:hover,
.cg-recent-emails__login-prompt a:hover,
.cg-recent-orders__login-prompt a:hover,
.cg-recent-analyses__login-prompt a:hover {
    color: var(--cg-blue-500);
}

/* Responsive: Tablet */
@media (max-width: 1024px) {
    .cg-recent-carts__item,
    .cg-recent-emails__item,
    .cg-recent-orders__item,
    .cg-recent-analyses__item {
        flex: 1 1 calc(33.333% - 1.5rem);
        max-width: calc(33.333% - 1rem);
    }
}

/* Responsive: Mobile Landscape */
@media (max-width: 768px) {
    .cg-recent-carts__item,
    .cg-recent-emails__item,
    .cg-recent-orders__item,
    .cg-recent-analyses__item {
        flex: 1 1 calc(50% - 1rem);
        max-width: calc(50% - 0.75rem);
    }

    .cg-recent-carts__grid,
    .cg-recent-emails__grid,
    .cg-recent-orders__grid,
    .cg-recent-analyses__grid {
        gap: 1rem;
    }
}

/* Responsive: Mobile Portrait */
@media (max-width: 480px) {
    .cg-recent-carts__item,
    .cg-recent-emails__item,
    .cg-recent-orders__item,
    .cg-recent-analyses__item {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .cg-recent-carts__actions,
    .cg-recent-emails__actions,
    .cg-recent-orders__actions,
    .cg-recent-analyses__actions {
        flex-direction: row;
        justify-content: center;
    }
}
