﻿/* ============================================================
   importfile-sidebar.css  v2
   Tabbed sidebar — higher contrast, larger calendar cells
   Append to importfile-invoice.css
   ============================================================ */

/* ── Upload layout — two column ─────────────────────────────── */
.imf-upload-layout {
    display: grid;
    grid-template-columns: 1fr 390px; /* slightly wider sidebar */
    gap: 1rem;
    align-items: start;
}

@media (max-width: 860px) {
    .imf-upload-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Sidebar shell ───────────────────────────────────────────── */
.imf-sidebar {
    background: var(--imf-surface);
    border: 1px solid var(--imf-border);
    border-radius: var(--imf-radius-lg);
    box-shadow: var(--imf-shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Tab bar ─────────────────────────────────────────────────── */
.imf-sidebar-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 2px solid var(--imf-border);
    background: var(--imf-surface-3);
    flex-shrink: 0;
}

.imf-sidebar-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.7rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--imf-text-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s, background .15s;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--imf-font);
    margin-bottom: -2px;
}

    .imf-sidebar-tab:hover {
        color: var(--imf-text-primary);
        background: var(--imf-surface-2);
    }

    .imf-sidebar-tab.is-active {
        color: var(--imf-blue);
        border-bottom-color: var(--imf-blue);
        background: var(--imf-surface);
        font-weight: 800;
    }

    .imf-sidebar-tab svg {
        opacity: .6;
    }

    .imf-sidebar-tab.is-active svg {
        opacity: 1;
    }

/* ── Tab panels ──────────────────────────────────────────────── */
.imf-sidebar-panel {
    display: none;
    flex-direction: column;
    flex: 1;
}

    .imf-sidebar-panel.is-active {
        display: flex;
    }

/* ── Vendors panel ───────────────────────────────────────────── */
.imf-vendor-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--imf-border-light);
    transition: background .1s;
}

    .imf-vendor-row:last-child {
        border-bottom: none;
    }

    .imf-vendor-row:hover {
        background: var(--imf-surface-2);
    }

.imf-vendor-row__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--imf-radius-sm);
    background: var(--imf-blue-light);
    border: 1.5px solid var(--imf-blue-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--imf-blue);
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0;
}

.imf-vendor-row__body {
    flex: 1;
    min-width: 0;
}

.imf-vendor-row__name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--imf-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.imf-vendor-row__meta {
    font-size: 0.67rem;
    color: var(--imf-text-muted);
    margin-top: 0.1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.imf-vendor-row__date {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--imf-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.imf-vendor-row__date--recent {
    color: var(--imf-green);
}

/* Format badges */
.imf-fmt {
    display: inline-flex;
    align-items: center;
    font-size: 0.58rem;
    font-weight: 800;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.imf-fmt--pdf {
    background: #fee2e2;
    color: #b91c1c;
}

.imf-fmt--csv {
    background: #d1fae5;
    color: #065f46;
}

.imf-fmt--xls {
    background: #dcfce7;
    color: #166534;
}

.imf-fmt--manual {
    background: var(--imf-surface-3);
    color: var(--imf-text-muted);
}

/* ── History (calendar) panel ────────────────────────────────── */
.imf-cal-vendor-bar {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--imf-border);
    background: var(--imf-surface-2);
    flex-shrink: 0;
}

.imf-cal-vendor-select {
    width: 100%;
    height: 34px;
    padding: 0 0.625rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--imf-text-primary);
    background: var(--imf-surface);
    border: 1.5px solid var(--imf-border);
    border-radius: var(--imf-radius-sm);
    font-family: var(--imf-font);
    cursor: pointer;
    transition: border-color .15s;
}

    .imf-cal-vendor-select:focus {
        outline: none;
        border-color: var(--imf-blue);
        box-shadow: 0 0 0 3px rgba(29,78,216,.08);
    }

/* Calendar empty / loading */
.imf-cal-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: var(--imf-text-muted);
    font-size: 0.78rem;
    text-align: center;
    gap: 0.625rem;
    font-weight: 500;
}

.imf-cal-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.imf-cal-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--imf-border-light);
    border-top-color: var(--imf-blue);
    border-radius: 50%;
    animation: imf-spin .7s linear infinite;
}

/* ── Calendar nav ────────────────────────────────────────────── */
.imf-cal-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--imf-border-light);
    background: var(--imf-surface-2);
    flex-shrink: 0;
}

.imf-cal-nav-btn {
    width: 26px;
    height: 26px;
    border: 1.5px solid var(--imf-border);
    border-radius: var(--imf-radius-sm);
    background: var(--imf-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--imf-text-secondary);
    transition: all .1s;
    line-height: 1;
}

    .imf-cal-nav-btn:hover:not(:disabled) {
        background: var(--imf-blue);
        border-color: var(--imf-blue);
        color: #fff;
    }

    .imf-cal-nav-btn:disabled {
        opacity: .25;
        cursor: not-allowed;
    }

.imf-cal-month-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--imf-text-primary);
    letter-spacing: -0.01em;
}

/* ── Calendar grid ───────────────────────────────────────────── */
.imf-cal-body {
    padding: 0.625rem 0.75rem 0.5rem;
    flex-shrink: 0;
}

.imf-cal-dow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 0.3rem;
}

    .imf-cal-dow span {
        text-align: center;
        font-size: 0.62rem;
        font-weight: 800;
        color: var(--imf-text-secondary); /* stronger than before */
        text-transform: uppercase;
        padding: 0.2rem 0;
        letter-spacing: 0.03em;
    }

.imf-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

/* Base day cell — larger, higher contrast */
.imf-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem; /* was 0.70rem */
    font-weight: 600; /* was 500 */
    border-radius: 5px;
    cursor: default;
    transition: background .1s;
    color: var(--imf-text-primary); /* was text-secondary — darker */
}

.imf-cal-day--other-month {
    color: transparent;
    pointer-events: none;
}

.imf-cal-day--future {
    color: var(--imf-border);
    font-weight: 400;
}

.imf-cal-day--today {
    font-weight: 900;
    color: var(--imf-blue);
    background: var(--imf-blue-light);
    border: 1.5px solid var(--imf-blue-border);
}

/* Delivery day — strong green, clearly clickable */
.imf-cal-day--has-import {
    background: #16a34a; /* solid green — was light green */
    color: #ffffff; /* white text for max contrast */
    font-weight: 800;
    cursor: pointer;
    border-radius: 5px;
}

    .imf-cal-day--has-import:hover {
        background: #15803d; /* darker green on hover */
        transform: scale(1.1);
        transition: background .1s, transform .1s;
    }

.imf-cal-day--selected-has-import {
    background: #0f6930; /* even darker selected */
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    transform: scale(1.1);
}

/* ── Legend ──────────────────────────────────────────────────── */
.imf-cal-legend {
    display: flex;
    gap: 0.875rem;
    padding: 0.4rem 0.75rem 0.5rem;
    border-top: 1px solid var(--imf-border-light);
    flex-shrink: 0;
}

.imf-cal-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.65rem;
    color: var(--imf-text-secondary); /* was xmuted — more visible */
    font-weight: 600;
}

.imf-cal-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.imf-cal-dot--imported {
    background: #16a34a;
}
/* solid green */
.imf-cal-dot--today {
    background: var(--imf-blue);
    border: none;
}

/* ── Day detail ──────────────────────────────────────────────── */
.imf-cal-detail {
    border-top: 2px solid var(--imf-border);
    flex: 1;
    overflow-y: auto;
    max-height: 180px;
}

.imf-cal-detail__header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    background: var(--imf-surface-3);
    border-bottom: 1px solid var(--imf-border);
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--imf-text-primary); /* was text-secondary */
    position: sticky;
    top: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.imf-cal-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.875rem;
    text-decoration: none;
    border-bottom: 1px solid var(--imf-border-light);
    transition: background .1s;
    gap: 0.5rem;
}

    .imf-cal-detail-item:last-child {
        border-bottom: none;
    }

    .imf-cal-detail-item:hover {
        background: var(--imf-blue-light);
    }

.imf-cal-detail-item__num {
    font-size: 0.775rem;
    font-weight: 700; /* was 600 */
    color: var(--imf-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.imf-cal-detail-item__sub {
    font-size: 0.67rem;
    color: var(--imf-text-muted);
    font-weight: 500;
    margin-top: 0.1rem;
}

.imf-cal-detail-item__amount {
    font-size: 0.8rem;
    font-weight: 800; /* was 700 */
    color: var(--imf-text-primary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
