﻿/* ===== LAYOUT ===== */
.welcome-dashboard {
    /*max-width: 1200px;*/
    margin: 0 auto;
    padding: 1.5rem 1rem 2.5rem;
    font-family: "Segoe UI", system-ui, -apple-system;
}

/* ===== HERO ===== */
.welcome-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    border-radius: 1.25rem;
    background: linear-gradient(135deg, #ffffff, #f7faf9);
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 12px 30px rgba(0,0,0,0.06);
}

.welcome-hero-text h1 {
    margin: 0 0 .4rem;
    font-size: 1.3rem;
    font-weight: 600;
    color: rgb(44 185 117);
}


.welcome-hero-text p {
    margin: 0;
    color: #4b5a56;
}

.welcome-hero-badge {
    display: inline-flex;
    align-items: center; /* vertical alignment */
    gap: .5rem; /* spacing between number + text */
    padding: .55rem .9rem;
    border-radius: 999px;
    background: #2cb97510;
    border: 1px solid #2cb97533;
    white-space: nowrap;
}

.welcome-hero-badge-number {
    font-size: 0.8rem; /* make consistent with label */
    font-weight: 700;
    line-height: 1; /* prevents “sinking” */
    color: #2cb975;
}

.welcome-hero-badge-label {
    font-size: 0.8rem; /* same as number */
    font-weight: 600;
    line-height: 1; /* aligns baseline */
    color: #1b3b34;
}

    .welcome-hero-badge span {
        font-size: 1.0rem;
        font-weight: 600;
        color: #2cb975;
    }

/* ===== PRODUCTS ===== */
.section-title {
    margin: 1.75rem 0 .75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px,1fr));
    gap: 1.25rem;
}

.product-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.1rem;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 10px 24px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: .6rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    animation: cardIn .45s ease-out forwards;
}

    .product-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 16px 36px rgba(0,0,0,0.12);
    }

.product-header {
    display: flex;
    gap: .75rem;
    align-items: center;
}

.product-icon {
    width: 44px;
    height: 44px;
    border-radius: .7rem;
    background: #f2f5f4;
    padding: .25rem;
}

.product-description {
    font-size: .9rem;
    color: #4f5f5a;
}

.product-header-text h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #2cb975;
}

/* ===== BUTTONS ===== */
.product-actions {
    margin-top: auto;
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}

.xaf-primary-button {
    background: linear-gradient(180deg,#2cb975,#24a066);
    color: #fff;
    border: 1px solid #1f8e5c;
    border-radius: 999px;
    padding: .45rem 1.2rem;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}

.xaf-secondary-button {
    background: #fff;
    color: #2cb975;
    border: 1px solid #2cb975;
    border-radius: 999px;
    padding: .4rem 1rem;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
}

/* ===== MODAL (FORCED OVERLAY) ===== */
body .welcome-modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(2px);
    z-index: 99999 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

body .welcome-modal {
    background: #fff;
    width: min(1100px,92vw);
    height: min(720px,90vh);
    border-radius: 12px;
    box-shadow: 0 25px 70px rgba(0,0,0,.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn .25s ease-out;
}

body .welcome-modal-header {
    padding: .85rem 1.2rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #e1e6e4;
    background: #f5f7f6;
}

body .welcome-modal-frame {
    flex: 1;
    width: 100%;
    border: none;
}

@keyframes cardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Button row – BIStore-style spacing */
.product-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* 👈 clean horizontal spacing */
    margin-top: 0.75rem;
    flex-wrap: wrap; /* 👈 handles smaller screens */
}

    /* Optional: ensure consistent button height */
    .product-actions .bistore-button {
        min-height: 36px;
        padding: 0.4rem 1.1rem;
    }

.cm-progress-wrap {
    margin-top: 8px;
}

.cm-progress-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    overflow: hidden;
}

.cm-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: rgba(44,185,117,1);
    transition: width 180ms ease;
}

.cm-progress-fill-over {
    background: rgba(255, 120, 120, 0.75);
}

.cm-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    opacity: 0.85;
    margin-top: 6px;
}

.cm-inline-warning {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.2;
    color: #dc3545;
}

.cm-trial-countdown {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.95;
}


/* ================================
   Contract Management Subscription Panel
   ================================ */

.cm-subscription-panel {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8f9fb;
    border: 1px solid #e3e6ec;
    font-size: 0.85rem;
}

/* Top row: plan + status */
.cm-subscription-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

/* Generic pill */
.cm-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

/* Plan name pill */
.cm-plan {
    background: #eef1f7;
    color: #2c3e50;
    border: 1px solid #d7dcea;
}

/* Status pills */
.cm-active {
    background: #e6f4ea;
    color: #1e7e34;
    border: 1px solid #b7e0c2;
}

.cm-trial {
    background: #fff7e6;
    color: #b7791f;
    border: 1px solid #ffe0a3;
}

.cm-inactive {
    background: #f1f3f5;
    color: #6c757d;
    border: 1px solid #dfe3e8;
}

.cm-expired {
    background: #fdecea;
    color: #c53030;
    border: 1px solid #f5b5b5;
}

/* Usage / limits area */
.cm-usage {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Main usage badge */
.cm-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e0e4eb;
    font-weight: 600;
    font-size: 0.8rem;
    color: #2d3748;
}

/* Secondary usage text */
.cm-small {
    font-size: 0.7rem;
    color: #6b7280;
    margin-left: 2px;
}

/* Warning messages (over limit / inactive) */
.cm-warning {
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #fff5f5;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Optional hover polish */
.cm-pill:hover,
.cm-badge:hover {
    filter: brightness(0.97);
    cursor: default;
}

/* ================================
   CM usage progress bar (used / max)
   Usage: <div class="cm-progress"><div class="cm-progress-bar" style="--cm-progress: 42%;"></div></div>
   ================================ */

.cm-progress {
    margin-top: 6px;
    height: 8px;
    border-radius: 999px;
    background: #e9edf3;
    border: 1px solid #dbe1ea;
    overflow: hidden;
}

.cm-progress-bar {
    height: 100%;
    width: var(--cm-progress, 0%);
    border-radius: 999px;
    background: #3b82f6; /* default */
    transition: width 220ms ease-in-out;
}

/* Optional: auto “states” you can apply on the container */
.cm-progress.is-warning .cm-progress-bar {
    background: #f59e0b;
}

.cm-progress.is-danger .cm-progress-bar {
    background: #ef4444;
}

/* Optional: if you want a subtle stripe for over-limit/blocked */
.cm-progress.is-danger .cm-progress-bar {
    background-image: linear-gradient( 45deg, rgba(255,255,255,0.35) 25%, rgba(255,255,255,0.0) 25%, rgba(255,255,255,0.0) 50%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0.35) 75%, rgba(255,255,255,0.0) 75%, rgba(255,255,255,0.0) );
    background-size: 18px 18px;
}

.cm-subscription-panel {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
}

.cm-subscription-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.cm-pill {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    background: #ffffff;
}

.cm-plan {
    font-weight: 600;
}

.cm-active {
    border-color: #86efac;
    background: #dcfce7;
}

.cm-trial {
    border-color: #93c5fd;
    background: #dbeafe;
}

.cm-inactive {
    border-color: #d1d5db;
    background: #f3f4f6;
}

.cm-expired {
    border-color: #fecaca;
    background: #fee2e2;
}

.cm-usage {
    display: grid;
    gap: 6px;
}

.cm-badge {
    display: inline-flex;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    font-weight: 600;
}

.cm-small {
    font-size: 12px;
    color: #6b7280;
}

.cm-progress-wrap { margin-top: 10px; }

.cm-progress-track{
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
}


.cm-progress-meta{
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    opacity: 0.85;
    margin-top: 6px;
}

.cm-inline-warning{
    margin-top: 8px;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.25);
}

.cm-trial-countdown{
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.9;
}


.welcome-empty {
    margin-top: 1rem;
}

.welcome-empty-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem 1.25rem;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 10px 24px rgba(0,0,0,0.06);
}

    .welcome-empty-card h3 {
        margin: 0 0 .35rem;
        font-size: 1.05rem;
        font-weight: 700;
        color: #1b3b34;
    }

    .welcome-empty-card p {
        margin: 0 0 1rem;
        color: #4b5a56;
        font-size: .95rem;
        line-height: 1.45;
    }

.welcome-empty-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
}

.subsync-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.subsync-card {
    width: min(480px, 92vw);
    background: #fff;
    border-radius: 12px;
    padding: 22px 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    text-align: center;
}

.subsync-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid rgba(0,0,0,.15);
    border-top-color: rgba(0,0,0,.65);
    margin: 0 auto 14px auto;
    animation: subsync-spin 0.9s linear infinite;
}

.subsync-detail {
    margin-top: 10px;
    font-size: 0.9rem;
    opacity: 0.75;
}

@keyframes subsync-spin {
    to {
        transform: rotate(360deg);
    }
}

.cm-loading {
    padding: 12px;
}

.cm-skeleton-line {
    height: 14px;
    background: linear-gradient( 90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63% );
    background-size: 400% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: 6px;
    margin-bottom: 8px;
}

    .cm-skeleton-line.short {
        width: 60%;
    }

.cm-skeleton-progress {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient( 90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63% );
    background-size: 400% 100%;
    animation: shimmer 1.2s infinite;
    margin-top: 8px;
}

.cm-loading-text {
    font-size: 0.85rem;
    color: #888;
    margin-top: 6px;
}

@keyframes shimmer {
    0% {
        background-position: -400% 0;
    }

    100% {
        background-position: 400% 0;
    }
}

.cm-wrapper {
    transition: opacity 0.35s ease, transform 0.35s ease;
}

    .cm-wrapper.loading {
        opacity: 0.6;
        transform: translateY(4px);
    }

    .cm-wrapper.loaded {
        opacity: 1;
        transform: translateY(0);
    }

/* Skeleton shimmer */
.cm-skeleton-line,
.cm-skeleton-progress {
    background: linear-gradient( 90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63% );
    background-size: 400% 100%;
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -400% 0;
    }

    100% {
        background-position: 400% 0;
    }
}

/* CM loading area should never block user interaction elsewhere */
.cm-wrapper.loading {
    pointer-events: none; /* clicks pass through this area */
}

/* Make sure actions always remain clickable */
.product-actions,
.product-actions * {
    pointer-events: auto;
}

.cm-wrapper {
    min-height: 120px; /* tweak to match your CM panel height */
}

.cm-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}

/* dropdown */
.cm-qty-select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #d7d7d7;
    background: white;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    height: 32px;
}

    .cm-qty-select:hover {
        border-color: #9aa5b1;
    }

/* button */
.cm-btn {
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all .15s ease;
}

.cm-btn-primary {
    background: #2f6fed;
    color: white;
}

    .cm-btn-primary:hover {
        background: #2458c9;
    }

.cm-qty-input {
    width: 110px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #d7d7d7;
    font-size: 13px;
    height: 32px;
}