/**
 * MSM Frontend — Selection Page Styles
 */

.msm-selection-page {
    max-width: 900px;
}

.msm-selection-page h2 {
    margin-bottom: 24px;
}

.msm-no-subs {
    color: #646970;
    font-style: italic;
}

/* Subscription Block (detail view) */
.msm-subscription-block {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

/* =========================================================================
   Back Link
   ========================================================================= */

.msm-back-link {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    color: #2271b1;
    text-decoration: none;
}

.msm-back-link:hover {
    text-decoration: underline;
}

/* =========================================================================
   Subscription List (overview)
   ========================================================================= */

.msm-subscription-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.msm-subscription-row:hover {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    color: inherit;
    text-decoration: none;
}

.msm-row-id {
    font-weight: 700;
    font-size: 14px;
    color: #2271b1;
    white-space: nowrap;
}

.msm-row-product {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msm-row-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #e6f4ea;
    color: #1e7e34;
    white-space: nowrap;
}

.msm-row-date {
    color: #646970;
    font-size: 13px;
    white-space: nowrap;
}

.msm-row-action {
    font-size: 13px;
    font-weight: 600;
    color: #2271b1;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .msm-subscription-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 14px;
    }

    .msm-row-product {
        flex-basis: 100%;
        order: -1;
        white-space: normal;
    }

    .msm-row-action {
        margin-inline-start: auto;
    }
}

/* Info Bar */
.msm-sub-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 16px;
    background: #f6f7f7;
    border-radius: 6px;
    margin-bottom: 16px;
}

.msm-sub-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.msm-info-label {
    font-size: 11px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.msm-info-value {
    font-weight: 600;
    font-size: 14px;
}

.msm-info-value a {
    color: #2271b1;
    text-decoration: none;
}

.msm-info-value a:hover {
    text-decoration: underline;
}

/* Deadline Warning */
.msm-deadline-warn {
    background: #fcf0c3;
    color: #8a6d00;
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
}

/* Variation Grid */
.msm-var-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
    padding-top: 10px; /* space for badges that extend above cards */
}

@media (max-width: 768px) {
    .msm-var-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .msm-var-grid {
        grid-template-columns: 1fr;
    }
}

/* Variation Card */
.msm-var-card {
    position: relative;
    border: 2px solid #e2e4e7;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-align: center;
    min-width: 0;        /* prevent content from expanding beyond grid cell */
    overflow: hidden;    /* clip overflowing content */
    box-sizing: border-box;
}

.msm-var-card:hover:not(.locked) {
    border-color: #2271b1;
}

.msm-var-card.current {
    border-color: #2271b1;
    background: #f0f6fc;
}

.msm-var-card.selected {
    border-color: #00a32a;
    box-shadow: 0 0 0 1px #00a32a;
    background: #f0faf0;
}

.msm-var-card.locked {
    opacity: 0.6;
    cursor: default;
}

/* Badge */
.msm-badge {
    position: absolute;
    top: -8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

[dir="rtl"] .msm-badge {
    right: auto;
    left: 8px;
}

.msm-badge-current {
    background: #2271b1;
    color: #fff;
}

.msm-badge-selected {
    background: #00a32a;
    color: #fff;
}

/* Variation Image */
.msm-var-image {
    margin-bottom: 8px;
    overflow: hidden;
}

.msm-var-image img {
    width: 100%;
    max-width: 120px;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

/* Variation Info */
.msm-var-name {
    font-size: 14px;
    font-weight: 600;
    margin: 4px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.msm-var-attrs {
    font-size: 12px;
    color: #646970;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Actions */
.msm-actions {
    text-align: center;
    padding-top: 8px;
}

.msm-save-btn {
    background: #2271b1 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 30px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 5px !important;
    cursor: pointer;
}

.msm-save-btn:hover {
    background: #135e96 !important;
}

.msm-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Success Toast */
.msm-success-toast {
    background: #00a32a;
    color: #fff;
    padding: 10px 16px;
    border-radius: 4px;
    margin-top: 12px;
    text-align: center;
    font-weight: 500;
}

/* =========================================================================
   Fragrance / Bundled Product Selection
   ========================================================================= */

.msm-fragrance-section {
    margin: 20px 0 16px;
    padding: 16px 20px;
    background: #f6f7f7;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
}

.msm-fragrance-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 14px;
}

.msm-fragrance-field {
    margin-bottom: 12px;
}

.msm-fragrance-field:last-child {
    margin-bottom: 0;
}

.msm-fragrance-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 4px;
}

.msm-fragrance-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 2px solid #e2e4e7;
    border-radius: 6px;
    background: #fff;
    color: #1d2327;
    transition: border-color 0.2s;
    box-sizing: border-box;
    appearance: auto;
}

.msm-fragrance-select:focus {
    border-color: #2271b1;
    outline: none;
}

.msm-fragrance-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f0f0f0;
}

/* RTL overrides */
[dir="rtl"] .msm-fragrance-section {
    text-align: right;
}

[dir="rtl"] .msm-fragrance-select {
    direction: rtl;
}

/* RTL overrides */
[dir="rtl"] .msm-selection-page {
    text-align: right;
}

[dir="rtl"] .msm-sub-info-bar {
    direction: rtl;
}

[dir="rtl"] .msm-var-card {
    text-align: center;
}

/* =========================================================================
   Frequency Pills (product page variation selector)
   ========================================================================= */

.msm-freq-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.msm-freq-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 22px;
    border: 2px solid #dcdfe4;
    border-radius: 50px;
    background: #fff;
    color: #1d2327;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    line-height: 1.4;
    white-space: nowrap;
    font-family: inherit;
}

.msm-freq-pill:hover {
    border-color: #2271b1;
    color: #2271b1;
}

.msm-freq-pill.active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

/* =========================================================================
   Subscription Banner (product page cross-link)
   ========================================================================= */

.msm-subscription-banner {
    margin-top: 5px;
    border: 2px solid #2271b1;
    border-radius: 8px;
    background: #f0f6fc;
    overflow: hidden;
    margin-bottom: 8px;
}

.msm-subscription-banner__content {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 12px;
}

.msm-subscription-banner__icon {
    font-size: 24px;
    flex-shrink: 0;
}

.msm-subscription-banner__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.msm-subscription-banner__text strong {
    font-size: 15px;
    color: #1d2327;
}

.msm-subscription-banner__text span {
    font-size: 13px;
    color: #50575e;
}

.msm-subscription-banner__link {
    flex-shrink: 0;
    background: #2271b1;
    color: #fff !important;
    padding: 6px 35px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background 0.2s;
    text-align: center;
}

.msm-subscription-banner__link:hover {
    background: #135e96;
}

/* RTL support */
[dir="rtl"] .msm-subscription-banner__content {
    direction: rtl;
}

/* Mobile: stack vertically */
@media (max-width: 480px) {
    .msm-subscription-banner__content {
        flex-direction: column;
        text-align: center;
    }

    .msm-subscription-banner__link {
        align-self: stretch;
        text-align: center;
    }
}
