﻿/* ==========================================================
   LABOR DETAILS PAGE - UNIQUE STYLES ONLY
   Core panel styles moved to panel-system.css
   This file contains only labor-specific components
   ========================================================== */

/* ===================== LABOR-SPECIFIC WRAPPER ===================== */

.lm-wrapper {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-subtle: #f9fafb;
    --border-subtle: #e5e7eb;
    --border-strong: #d1d5db;
    --text-main: #0f172a;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --accent-strong: #1d4ed8;
    --positive: #16a34a;
    --negative: #dc2626;
    --shadow-soft: 0 14px 40px rgba(15, 23, 42, 0.08);
    --radius-card: 14px;
    --radius-pill: 999px;
    --transition-fast: 0.18s ease-out;
    min-height: 100vh;
    padding: 1.5rem 0.5rem 2rem;
    background-color: transparent;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
    box-sizing: border-box;
    max-width: 2560px;
    margin-inline: auto;
}

/* ===================== LABOR-SPECIFIC ANIMATIONS ===================== */

@keyframes pulse-high {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    }

    50% {
        box-shadow: 0 4px 16px rgba(255, 107, 107, 0.5);
    }
}

@keyframes pulse-low {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(78, 205, 196, 0.3);
    }

    50% {
        box-shadow: 0 4px 16px rgba(78, 205, 196, 0.5);
    }
}

/* ===================== ALERTS (LABOR-SPECIFIC) ===================== */

.lm-alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.lm-alert-success {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

.lm-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* ===================== LABOR HEADER (extends panel-header) ===================== */

.lm-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 1rem;
}

.lm-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lm-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.lm-title {
    margin: 0;
    font-weight: 600;
    font-size: 1.45rem;
    color: var(--text-main);
}

.lm-subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lm-subtitle-icon {
    font-size: 1rem;
}

.lm-subtitle-primary {
    font-weight: 500;
    color: #475569;
}

.lm-subtitle-sep {
    color: #cbd5e1;
}

.lm-subtitle-secondary {
    color: var(--text-muted);
}

.lm-header-actions {
    display: flex;
    gap: 0.75rem;
}

/* ===================== LABOR-SPECIFIC BUTTONS ===================== */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border: none;
    color: #fff;
    padding: 0.5rem 1.2rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.35);
}

    .btn-primary:hover {
        box-shadow: 0 16px 30px rgba(37, 99, 235, 0.4);
        transform: translateY(-1px);
    }

.btn-icon {
    font-size: 0.9rem;
}

.dashboard-btn {
    padding: 0.5rem 1.2rem;
    border-radius: 10px;
    font-weight: 500;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

    .dashboard-btn.primary {
        background: linear-gradient(135deg, var(--accent), var(--accent-strong));
        color: #f9fafb;
        box-shadow: 0 12px 25px rgba(37, 99, 235, 0.35);
    }

        .dashboard-btn.primary:hover {
            box-shadow: 0 16px 30px rgba(37, 99, 235, 0.4);
            transform: translateY(-1px);
        }

    .dashboard-btn.secondary {
        background: transparent;
        color: var(--text-muted);
        border: 1px solid var(--border-strong);
    }

        .dashboard-btn.secondary:hover {
            background: var(--surface-subtle);
            color: var(--text-main);
        }

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: underline;
    transition: color var(--transition-fast);
}

    .btn-link:hover {
        color: var(--accent-strong);
    }

/* ===================== KPI CARDS (LABOR-SPECIFIC) ===================== */

.kpi-strip {
    margin-bottom: 1.5rem;
    margin-top: 1.25rem;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.9rem;
}

.kpi-card {
    position: relative;
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-card);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

    .kpi-card::before {
        content: "";
        position: absolute;
        inset: 0;
        opacity: 0;
        background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 60%);
        transition: opacity var(--transition-fast);
        pointer-events: none;
    }

    .kpi-card:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 32px rgba(15, 23, 42, 0.1);
        border-color: rgba(37, 99, 235, 0.5);
    }

        .kpi-card:hover::before {
            opacity: 1;
        }

    .kpi-card.highlight {
        background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
        border-color: #0ea5e9;
    }

.kpi-icon {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
}

    .kpi-icon svg {
        width: 20px;
        height: 20px;
        color: #64748b;
    }

.kpi-card.highlight .kpi-icon {
    background: #bfdbfe;
}

    .kpi-card.highlight .kpi-icon svg {
        color: #0369a1;
    }

.kpi-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    flex: 1;
}

.kpi-label {
    margin: 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.kpi-value {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.kpi-date {
    font-size: 1.25rem;
}

.kpi-meta {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Insight Values (for High/Low/Variance) */
.insight-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.insight-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

    .insight-value.high {
        color: var(--negative);
    }

    .insight-value.low {
        color: var(--positive);
    }

    .insight-value.warning {
        color: #ea580c;
    }

/* ===================== LABOR TABLE ===================== */

.lm-table-wrapper {
    margin-top: 1.25rem;
    background: var(--surface);
    border-radius: var(--radius-card);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.lm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

    .lm-table thead {
        background: linear-gradient(to bottom, rgba(15, 23, 42, 0.06), rgba(15, 23, 42, 0.02));
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .lm-table th {
        padding: 8px 10px;
        font-weight: 600;
        text-align: left;
        font-size: 0.8rem;
        color: #4b5563;
        border-bottom: 1px solid rgba(148, 163, 184, 0.6);
        white-space: nowrap;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        position: relative;
        user-select: none;
    }

    .lm-table tbody tr {
        border-bottom: 1px solid rgba(209, 213, 219, 0.7);
        transition: background-color var(--transition-fast);
    }

        .lm-table tbody tr:nth-child(odd) {
            background: #ffffff;
        }

        .lm-table tbody tr:nth-child(even) {
            background: #f3f4f6;
        }

        .lm-table tbody tr:hover {
            background: #e0ecff !important;
        }

    .lm-table td {
        padding: 8px 10px;
        color: #111827;
        font-size: 0.9rem;
        border-bottom: 1px solid rgba(209, 213, 219, 0.7);
    }

/* Table Row States */
.lm-row-locked {
    background: #f8f9fa !important;
    opacity: 0.7;
}

.lm-row-current {
    background: #ecfdf3 !important;
    border-left: 3px solid var(--positive);
}

/* Sorting Controls */
.sort-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    color: #24292e;
    transition: color var(--transition-fast);
    width: 100%;
    text-align: left;
}

    .sort-btn:hover {
        color: var(--accent);
    }

    .sort-btn.active {
        color: var(--accent);
    }

.sort-icon {
    font-size: 0.875rem;
    opacity: 0.5;
}

.sort-btn.active .sort-icon {
    opacity: 1;
}

/* Labor Amount Highlighting */
.labor-amount {
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    display: inline-block;
    transition: all 0.3s ease;
    font-variant-numeric: tabular-nums;
}

    .labor-amount.labor-high {
        background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
        color: #ffffff;
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
        animation: pulse-high 2s ease-in-out infinite;
    }

    .labor-amount.labor-low {
        background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
        color: #ffffff;
        box-shadow: 0 2px 8px rgba(78, 205, 196, 0.3);
        animation: pulse-low 2s ease-in-out infinite;
    }

/* Status Badges */
.lm-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid;
    white-space: nowrap;
}

    .lm-badge.status-current {
        background: #ecfdf3;
        color: #166534;
        border-color: #bbf7d0;
    }

/* Icon Buttons */
.lm-btn-icon {
    background: none;
    border: none;
    padding: 0.375rem;
    cursor: pointer;
    font-size: 1.125rem;
    transition: transform var(--transition-fast);
}

    .lm-btn-icon:hover {
        transform: scale(1.2);
    }

    .lm-btn-icon.danger:hover {
        filter: brightness(1.2);
    }

/* ===================== EMPTY STATE ===================== */

.lm-empty {
    margin-top: 3rem;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius-card);
    border: 2px dashed var(--border-subtle);
}

.lm-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.lm-empty h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    color: var(--text-main);
}

.lm-empty p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===================== MODALS ===================== */

.lm-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

    .lm-modal.show {
        display: flex;
        align-items: center;
        justify-content: center;
    }

.lm-modal-dialog {
    background: var(--surface);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.lm-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.lm-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

    .lm-modal-close:hover {
        background: var(--surface-subtle);
        color: var(--text-main);
    }

.lm-modal-body {
    padding: 1.5rem;
}

.lm-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

/* Missing Weeks Modal Content */
.missing-weeks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.missing-week-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
}

.missing-week-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.missing-week-details {
    flex: 1;
}

    .missing-week-details strong {
        display: block;
        color: #856404;
        margin-bottom: 0.25rem;
    }

    .missing-week-details p {
        color: #856404;
        margin: 0;
        font-size: 0.9375rem;
    }

/* ===================== FORM ELEMENTS ===================== */

.lm-field {
    margin-bottom: 1.25rem;
}

.lm-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #24292e;
    margin-bottom: 0.5rem;
}

.lm-input,
.lm-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    font-family: inherit;
}

    .lm-input:focus,
    .lm-textarea:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

.lm-textarea {
    resize: vertical;
    min-height: 80px;
}

.lm-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.lm-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.lm-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.lm-btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #ffffff;
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.35);
}

    .lm-btn-primary:hover {
        box-shadow: 0 16px 30px rgba(37, 99, 235, 0.4);
        transform: translateY(-1px);
    }

.lm-btn-secondary {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
}

    .lm-btn-secondary:hover {
        background: var(--surface-subtle);
        color: var(--text-main);
    }

/* ===================== UTILITY CLASSES ===================== */

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

/* ===================== RESPONSIVE DESIGN ===================== */

@media (max-width: 1200px) {
    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .lm-wrapper {
        padding: 1rem;
    }

    .lm-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .kpi-row {
        grid-template-columns: 1fr;
    }

    .lm-table-wrapper {
        overflow-x: auto;
    }

    .lm-table {
        min-width: 800px;
    }

    .lm-grid-2 {
        grid-template-columns: 1fr;
    }

    .lm-modal-body,
    .lm-modal-header,
    .lm-modal-footer {
        padding: 1rem;
    }
}

@media (max-width: 640px) {
    .lm-table th,
    .lm-table td {
        padding: 0.5rem 0.75rem;
    }

    .kpi-card {
        padding: 1rem;
    }

    .kpi-value {
        font-size: 1.25rem;
    }
}

/* ===================== ACCESSIBILITY ===================== */

@media (prefers-reduced-motion: reduce) {
    .labor-amount.labor-high,
    .labor-amount.labor-low {
        animation: none;
    }

    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Focus visible for keyboard navigation */
.sort-btn:focus-visible,
.btn-link:focus-visible,
.lm-btn-icon:focus-visible,
.lm-input:focus-visible,
.lm-textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
