/**
 * My Work Dashboard — backend welcome screen widget.
 *
 * Renders three side-by-side columns (Tasks | Requests | Bugs) beneath
 * the system messages area. Uses Contao's backend CSS vars so light and
 * dark themes are honored automatically.
 */

.stratum-mywork {
    margin: 1.5em 0 2em;
    margin-inline: 15px;
    padding: 0;
    background: var(--panel-bg, #fff);
    border: 1px solid var(--content-border, #e5e7eb);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stratum-mywork-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1em 1.25em;
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-wrap: wrap;
    gap: 1em;
}

.stratum-mywork-title {
    margin: 0;
    font-size: 1.15em;
    font-weight: 600;
    color: var(--text, #111827);
}

.stratum-mywork-filters {
    font-size: 0.9em;
}

.stratum-mywork-filters > summary {
    cursor: pointer;
    padding: 0.35em 0.75em;
    background: var(--button-bg, #f3f4f6);
    border: 1px solid var(--border, #d1d5db);
    border-radius: 4px;
    user-select: none;
    list-style: none;
}

.stratum-mywork-filters > summary::-webkit-details-marker {
    display: none;
}

.stratum-mywork-filters[open] > summary {
    background: var(--active-bg, #e0e7ff);
}

.stratum-mywork-filter-form {
    position: absolute;
    right: 1.25em;
    z-index: 50;
    margin-top: 0.5em;
    padding: 1em;
    background: var(--panel-bg, #fff);
    border: 1px solid var(--border, #d1d5db);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    min-width: 600px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1em;
}

.stratum-mywork-filter-form fieldset {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 4px;
    padding: 0.5em 0.75em;
    margin: 0;
}

.stratum-mywork-filter-form legend {
    font-weight: 600;
    padding: 0 0.25em;
    font-size: 0.85em;
    color: var(--text, #111827);
}

.stratum-mywork-filter-form label {
    display: block;
    padding: 0.15em 0;
    font-size: 0.85em;
    cursor: pointer;
}

.stratum-mywork-filter-form label input {
    margin-right: 0.4em;
}

.stratum-mywork-filter-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.5em;
    justify-content: flex-end;
    padding-top: 0.5em;
    border-top: 1px solid var(--border, #e5e7eb);
}

/* ── Columns ────────────────────────────────────────────────── */

.stratum-mywork-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border, #e5e7eb);
}

.stratum-mywork-col {
    background: var(--panel-bg, #fff);
    padding: 1em 1.25em;
    min-width: 0;
}

.stratum-mywork-col header {
    margin-bottom: 0.75em;
    border-bottom: 1px solid var(--border, #e5e7eb);
    padding-bottom: 0.5em;
}

.stratum-mywork-col h3 {
    margin: 0;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text, #111827);
    display: flex;
    align-items: center;
    gap: 0.4em;
}

.stratum-mywork-count {
    display: inline-block;
    background: var(--button-bg, #f3f4f6);
    color: var(--text, #374151);
    font-size: 0.75em;
    padding: 0.1em 0.5em;
    border-radius: 10px;
    font-weight: 500;
}

.stratum-mywork-empty {
    margin: 1em 0;
    padding: 1em;
    text-align: center;
    color: var(--gray, #6b7280);
    font-size: 0.9em;
    background: var(--button-bg, #f9fafb);
    border-radius: 4px;
}

/* ── Buckets ────────────────────────────────────────────────── */

.stratum-mywork-bucket {
    margin-bottom: 1em;
}

.stratum-mywork-bucket:last-child {
    margin-bottom: 0;
}

.stratum-mywork-bucket h4 {
    margin: 0 0 0.4em 0;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray, #6b7280);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4em;
}

.stratum-mywork-bucket-overdue h4 {
    color: #dc2626;
}

.stratum-mywork-bucket-week h4 {
    color: #d97706;
}

.stratum-mywork-bucket-count {
    font-size: 0.95em;
    color: inherit;
    opacity: 0.7;
}

/* ── Items ──────────────────────────────────────────────────── */

.stratum-mywork-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.stratum-mywork-item {
    /* Position the card so the title's ::before overlay can cover
       the whole item (card-link pattern). */
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5em;
    padding: 0.5em 0.6em;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 4px;
    margin-bottom: 0.35em;
    background: var(--panel-bg, #fff);
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
}

.stratum-mywork-item:hover {
    background: var(--hover-bg, #f9fafb);
    border-color: var(--blue, #2e6ebf);
}

.stratum-mywork-item-body {
    flex: 1;
    min-width: 0;
}

.stratum-mywork-item-title {
    display: block;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text, #111827);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stratum-mywork-item-title:hover {
    color: var(--link-hover, #2563eb);
}

/* The whole card navigates via a JS click delegate on the dashboard
   root (see my-work-dashboard.js) — clicks on the timer button (or
   any other <button>) opt out and run their own handler. We use JS
   rather than a CSS overlay because the CSS approach was unreliable
   when other backend stylesheets re-asserted z-index. */

.stratum-mywork-item-meta {
    font-size: 0.75em;
    color: var(--gray, #6b7280);
    margin-top: 0.2em;
    display: flex;
    gap: 0.4em;
    flex-wrap: wrap;
}

.stratum-mywork-item-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 12em;
}

.stratum-mywork-item-client {
    font-weight: 500;
    color: var(--text, #374151);
}

.stratum-mywork-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25em;
    flex-shrink: 0;
}

.stratum-mywork-status-pill {
    display: inline-block;
    padding: 0.1em 0.5em;
    font-size: 0.7em;
    font-weight: 600;
    color: #fff;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.stratum-mywork-item-date {
    font-size: 0.75em;
    color: var(--gray, #6b7280);
    font-weight: 500;
}

.stratum-mywork-item-substatus {
    font-size: 0.7em;
    color: var(--gray, #6b7280);
    font-style: italic;
}

/* ── Timer button ───────────────────────────────────────────── */

.stratum-mywork-timer-btn {
    /* Sits above the card-link overlay so it remains independently
       clickable without triggering the card's link. */
    position: relative;
    z-index: 2;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.stratum-mywork-timer-btn img {
    width: 14px;
    height: 14px;
    pointer-events: none; /* Click target is the button, not the image */
}

.stratum-mywork-timer-btn:hover {
    opacity: 1;
    transform: scale(1.08);
}

.stratum-mywork-timer-btn.is-running {
    opacity: 1;
}

/* Subtle pulse so a running timer is obvious at a glance. */
.stratum-mywork-timer-btn.is-running img {
    animation: stratumMyworkPulse 1.4s ease-in-out infinite;
}

@keyframes stratumMyworkPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.18); }
}

.stratum-mywork-timer-btn.is-loading {
    opacity: 0.45;
    cursor: wait;
}

.stratum-mywork-timer-btn[disabled] {
    cursor: wait;
}

/* ── "Show X more" accordion ───────────────────────────────── */

.stratum-mywork-more {
    margin-top: 0.25em;
}

.stratum-mywork-more > summary {
    cursor: pointer;
    font-size: 0.8em;
    color: var(--link, #2563eb);
    padding: 0.25em 0.5em;
    list-style: none;
    user-select: none;
}

.stratum-mywork-more > summary::-webkit-details-marker {
    display: none;
}

.stratum-mywork-more > summary::before {
    content: '▸ ';
    display: inline-block;
    transition: transform 0.15s;
}

.stratum-mywork-more[open] > summary::before {
    transform: rotate(90deg);
}

.stratum-mywork-more[open] .stratum-mywork-list {
    margin-top: 0.35em;
}

/* ── Responsive: collapse to single column on narrow screens ── */

@media (max-width: 1100px) {
    .stratum-mywork-columns {
        grid-template-columns: 1fr;
    }

    .stratum-mywork-filter-form {
        grid-template-columns: 1fr;
        min-width: auto;
        left: 1em;
        right: 1em;
    }
}
