/**
 * ALMS Buy Block — Frontend Styles
 * Designed to work within CMG's existing editorial layouts.
 */

.alms-buy-block {
    margin: 1.5em 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Card Layout ─────────────────────────────────────── */

.alms-buy-card {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem;
    border: 3px solid #3b82f6;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* "Where to get it" flag */
.alms-buy-card::before {
    content: "Where to get it";
    position: absolute;
    top: -1px;
    left: -1px;
    background: #1e40af;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-radius: 6px 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 2;
    max-width: calc(100% - 2rem);
    white-space: nowrap;
    overflow: hidden;
}

.alms-product-image {
    flex: 0 0 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alms-product-image img {
    max-width: 140px;
    max-height: 140px;
    object-fit: contain;
    border-radius: 4px;
}

.alms-product-info {
    flex: 1;
    min-width: 0;
    padding-top: 0.75rem; /* Ensure content clears the "Where to get it" flag */
}

.alms-brand {
    display: block;
    font-size: 0.875rem; /* +2pt from 0.75rem */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.alms-product-name {
    font-size: 1.25rem; /* +2pt from 1.125rem */
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 0.5rem;
    color: #1e293b;
}

.alms-price {
    margin-bottom: 0.75rem;
}

.alms-price-original {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 0.875rem;
    margin-right: 0.5rem;
}

.alms-price-current {
    font-size: 1.375rem; /* +2pt from 1.25rem */
    font-weight: 700;
    color: #1e293b;
}

.alms-price-sale {
    color: #dc2626;
}

/* Merchant links */

.alms-merchants {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alms-merchant-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: #334155;
    font-size: 1rem; /* +2pt from 0.875rem */
    font-weight: 600; /* Increased weight for better readability */
    transition: all 0.15s ease;
}

.alms-merchant-link:hover {
    border-color: #3b82f6;
    background: #f8fafc;
    color: #1e40af;
}

.alms-merchant-primary {
    background: #1e40af;
    border-color: #1e40af;
    color: #fff;
    font-weight: 700; /* Extra weight for #1 position */
}

.alms-merchant-primary:hover {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: #fff;
}

.alms-merchant-name {
    flex: 1;
}

.alms-merchant-price {
    font-weight: 700; /* Increased weight for price readability */
    white-space: nowrap;
}

.alms-oos-badge {
    font-size: 0.7rem;
    background: #fef2f2;
    color: #dc2626;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
}

/* ── Compact Layout ──────────────────────────────────── */

.alms-buy-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    font-size: 0.875rem;
}

.alms-buy-compact .alms-product-name {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
    color: #334155;
}

.alms-buy-button {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: #1e40af;
    color: #fff;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.alms-buy-button:hover {
    background: #1e3a8a;
    color: #fff;
}

/* ── Table Layout ────────────────────────────────────── */

.alms-buy-table {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.alms-table-header {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1rem;
}

.alms-buy-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.alms-buy-table th {
    text-align: left;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.alms-buy-table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.alms-buy-table tr:last-child td {
    border-bottom: none;
}

.alms-buy-button-sm {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: #1e40af;
    color: #fff;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.alms-buy-button-sm:hover {
    background: #1e3a8a;
    color: #fff;
}

/* ── Disclosure ──────────────────────────────────────── */

.alms-disclosure {
    margin-top: 0.5rem;
    text-align: right;
}

.alms-disclosure small {
    font-size: 0.6875rem;
    color: #94a3b8;
}

.alms-disclosure a {
    color: #94a3b8;
    text-decoration: underline;
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 600px) {
    .alms-buy-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .alms-product-image {
        flex: none;
    }

    .alms-merchants {
        width: 100%;
    }

    .alms-buy-compact {
        flex-wrap: wrap;
        justify-content: center;
    }
}
