/* ==========================================================================
   Stock Inventory Matrix Widget — styles
   Design: Reference "Lager" design system
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. CSS Variables
   -------------------------------------------------------------------------- */
.cot-stock-matrix {
    --bg: #f4f4f7;
    --surface: #ffffff;
    --surface2: #f0f0f5;
    --border: rgba(0, 0, 0, 0.07);
    --accent: #c8e000;
    --accent2: #ff4fba;
    --text: #12121a;
    --muted: #8888a0;
    --green: #00b96b;
    --dev-border: #e8e8f0;

    font-family: 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --------------------------------------------------------------------------
   1. Card
   -------------------------------------------------------------------------- */
.cot-stock-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 20px;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    animation: cot-fadeUp 0.4s ease both;
}

.cot-stock-item:nth-child(1) {
    animation-delay: 0.05s;
}

.cot-stock-item:nth-child(2) {
    animation-delay: 0.10s;
}

.cot-stock-item:nth-child(3) {
    animation-delay: 0.15s;
}

.cot-stock-item:nth-child(4) {
    animation-delay: 0.20s;
}

.cot-stock-item:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes cot-fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Left accent bar — revealed on hover */
.cot-stock-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 3px 0 0 3px;
    opacity: 0;
    transition: opacity 0.2s;
}

.cot-stock-item:hover {
    border-color: rgba(0, 0, 0, 0.12);
    transform: translateX(2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.cot-stock-item:hover::before {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   2. Image Column
   -------------------------------------------------------------------------- */
.cot-img-wrap {
    width: 64px;
    height: 64px;
    background: var(--surface2);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cot-stock-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --------------------------------------------------------------------------
   3. Info Column
   -------------------------------------------------------------------------- */
.cot-info {
    min-width: 0;
}

.cot-product-name {
    font-family: 'Anek Bangla', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   4. Tags (color-dot style)
   -------------------------------------------------------------------------- */
.cot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cot-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--surface2);
    border: 1px solid var(--dev-border);
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.02em;
    font-family: 'Roboto', sans-serif;
}

.cot-tag-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Cycling palette for attribute groups */
.dot-c1 {
    background: #8e8e9a;
}

/* Grey  */
.dot-c2 {
    background: #4d7cfe;
}

/* Blue  */
.dot-c3 {
    background: #f0a500;
}

/* Amber */
.dot-c4 {
    background: #9c27b0;
}

/* Purple */
.dot-c5 {
    background: #00acc1;
}

/* Teal  */
.dot-c6 {
    background: #12121a;
}

/* Dark  */

/* Status-override dot colors */
.dot-oos {
    background: #ef4444;
}

/* Out of stock — red  */
.dot-low {
    background: #f59e0b;
}

/* Low stock — amber   */
.dot-ok {
    background: #00b96b;
}

/* In stock — green    */

/* --------------------------------------------------------------------------
   5. Right Column
   -------------------------------------------------------------------------- */
.cot-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.cot-stock-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --------------------------------------------------------------------------
   6. Badge
   -------------------------------------------------------------------------- */
.cot-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: 'Roboto', sans-serif;
    white-space: nowrap;
}

/* Badge dot via ::before */
.cot-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Available */
.cot-badge-green {
    background: rgba(0, 185, 107, 0.10);
    color: var(--green);
    border: 1px solid rgba(0, 185, 107, 0.20);
}

.cot-badge-green::before {
    background: var(--green);
    animation: cot-pulse 2s infinite;
}

/* Low stock */
.cot-badge-orange {
    background: rgba(245, 158, 11, 0.10);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.20);
}

.cot-badge-orange::before {
    background: #f59e0b;
}

/* Out of stock */
.cot-badge-red {
    background: rgba(239, 68, 68, 0.10);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.20);
}

.cot-badge-red::before {
    background: #ef4444;
}

@keyframes cot-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* --------------------------------------------------------------------------
   7. Vertical Divider
   -------------------------------------------------------------------------- */
.cot-divider {
    width: 1px;
    height: 36px;
    background: var(--dev-border);
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   8. Stock Count
   -------------------------------------------------------------------------- */
.cot-stock-count {
    font-family: 'Anek Bangla', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--text);
    white-space: nowrap;
}

.cot-stock-count span {
    font-size: 0.75rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    color: var(--muted);
    margin-left: 2px;
}

/* --------------------------------------------------------------------------
   9. Refill Button
   -------------------------------------------------------------------------- */
.cot-btn-refill {
    display: inline-block;
    background: var(--accent2);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-family: 'Anek Bangla', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(255, 79, 186, 0.22);
}

.cot-btn-refill:hover {
    background: #ff35b0;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 79, 186, 0.38);
    color: #fff;
    text-decoration: none;
}

.cot-btn-refill:active {
    transform: translateY(0);
}

.cot-btn-refill.disabled,
.cot-btn-refill[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    background: #e5e7eb;
    color: #9ca3af;
    box-shadow: none;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   10. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 700px) {
    .cot-stock-item {
        grid-template-columns: 48px 1fr;
        gap: 14px;
        padding: 16px 18px;
    }

    .cot-img-wrap {
        width: 48px;
        height: 48px;
    }

    .cot-right {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        border-top: 1px solid var(--dev-border);
        padding-top: 12px;
        margin-top: 4px;
    }

    .cot-btn-refill {
        font-size: 0.75rem;
        padding: 7px 14px;
    }

    .cot-product-name {
        font-size: 0.95rem;
    }
}