/* Worklog Slide-over Panel */
.worklog-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 300ms ease-out;
    pointer-events: none;
}

.worklog-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

.worklog-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    width: 100%;
    max-width: 500px;
    background-color: white;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 300ms ease-out;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}

.worklog-panel.is-open {
    transform: translateX(0);
}

/* Prevent body scroll when panel is open */
body.worklog-open {
    overflow: hidden;
}

/* Panel Content */
.worklog-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.worklog-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.worklog-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.worklog-subtitle {
    font-size: 1rem;
    color: #6b7280;
}

.worklog-keyboard-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

.worklog-kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: #4b5563;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

/* Close Button */
.worklog-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    background: none;
    cursor: pointer;
    color: #6b7280;
    transition: color 200ms;
    z-index: 10000;
    -webkit-tap-highlight-color: transparent;
}

.worklog-close:focus {
    outline: none;
    border: none;
}

.worklog-close:focus-visible {
    outline: none;
}

.worklog-close:hover {
    color: #111827;
}

.worklog-close svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Worklog trigger buttons - improve mobile touch handling */
[data-worklog-trigger] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Timeline */
.worklog-timeline {
    position: relative;
    padding-left: 1.5rem;
}

.worklog-timeline::before {
    content: '';
    position: absolute;
    left: 0.375rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #e5e7eb;
}

.worklog-entry {
    position: relative;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
}

.worklog-entry:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Status Dot */
.worklog-status-dot {
    position: absolute;
    left: calc(-1.5rem + 1px);
    top: 2rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #e5e7eb;
}

.worklog-status-dot.shipped {
    background-color: #10b981;
}

.worklog-status-dot.in-progress {
    background-color: #eab308;
    animation: pulse-dot 2s ease-in-out infinite;
}

.worklog-status-dot.on-hold {
    background-color: #6b7280;
}


/* Pulse animation for in-progress dot */
@keyframes pulse-dot {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

/* Status Label */
.worklog-status-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

.worklog-status-label.shipped {
    background-color: #d1fae5;
    color: #065f46;
}

.worklog-status-label.in-progress {
    background-color: #fef9c3;
    color: #713f12;
}

.worklog-status-label.on-hold {
    background-color: #f3f4f6;
    color: #374151;
}

/* Entry Card */
.worklog-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.worklog-date {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.worklog-entry-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.worklog-entry-description {
    font-size: 0.9375rem;
    color: #4b5563;
    line-height: 1.6;
}

.worklog-entry-description a {
    color: #4b5563;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 200ms;
}

.worklog-entry-description a:hover {
    color: #111827;
}

/* Image Thumbnail */
.worklog-image {
    margin-top: 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 200ms, transform 200ms;
}

.worklog-image:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.worklog-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Image Modal */
.worklog-image-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease-out;
}

.worklog-image-modal.is-open {
    opacity: 1;
    pointer-events: all;
}

.worklog-image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 0.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.worklog-image-modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    color: white;
    transition: background-color 200ms;
}

.worklog-image-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.worklog-image-modal-close svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Footer */
.worklog-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.worklog-footer-text {
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .worklog-panel {
        max-width: 100%;
    }

    .worklog-content {
        padding: 1.5rem;
    }

    .worklog-header {
        padding-right: 3rem;
    }

    .worklog-keyboard-hint {
        display: none;
    }

    /* Keep status dots on timeline (left side) on mobile, same as desktop */
    .worklog-timeline {
        padding-left: 1.5rem;
    }

    .worklog-status-dot {
        position: absolute;
        left: calc(-1.5rem + 1px);
        top: 2rem;
    }

    /* Ensure pulse animation works on mobile */
    .worklog-status-dot.in-progress {
        animation: pulse-dot 2s ease-in-out infinite;
    }

    /* Ensure same link formatting on mobile as desktop */
    .worklog-entry-description a {
        text-decoration: underline;
        text-underline-offset: 2px;
        color: #4b5563;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .worklog-overlay,
    .worklog-panel,
    .worklog-image-modal {
        transition: none;
    }

    .worklog-image {
        transition: none;
    }

    .worklog-status-dot.in-progress {
        animation: none;
    }
}
