/* ══════════════════════════════════════════════════════════════════════
   DBS TimeManager — Stylesheet
   ══════════════════════════════════════════════════════════════════════ */

/* ── Cards ─────────────────────────────────────────────────────────── */
.tm-card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

.tm-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.tm-card-hours .card-body { border-left: 4px solid #0d6efd; border-radius: 0.5rem; }
.tm-card-week .card-body  { border-left: 4px solid #198754; border-radius: 0.5rem; }
.tm-card-status .card-body { border-left: 4px solid #6c757d; border-radius: 0.5rem; }

.tm-hours-big {
    font-size: 2.5rem;
    font-weight: 700;
    color: #212529;
    margin: 0.25rem 0;
}

/* ── Timer Widget ──────────────────────────────────────────────────── */
.tm-timer-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    min-width: 160px;
    text-align: center;
}

.tm-timer-widget {
    gap: 1rem;
}

.tm-timer-controls .btn {
    min-width: 130px;
    min-height: 44px;
}

.tm-timer-display.tm-timer-running {
    color: #198754;
    animation: tm-pulse 2s ease-in-out infinite;
}

@keyframes tm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Timesheet Table ───────────────────────────────────────────────── */
.tm-entry-table {
    margin-bottom: 0;
}

.tm-entry-table thead th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.tm-entry-table input.form-control,
.tm-entry-table select.form-select {
    font-size: 0.875rem;
}

.tm-entry-table input:disabled,
.tm-entry-table select:disabled {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    cursor: default;
}

.tm-entry-row.tm-editing input:disabled,
.tm-entry-row.tm-editing select:disabled {
    background: #fff;
    border-color: #ced4da;
}

.tm-entry-row.tm-new-row input,
.tm-entry-row.tm-new-row select {
    background: #fff;
    border-color: #ced4da;
}

.tm-calc-hours {
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* ── Weekly Summary ────────────────────────────────────────────────── */
.tm-weekly-table {
    text-align: center;
    font-size: 0.9rem;
}

.tm-weekly-table td {
    padding: 0.5rem;
    vertical-align: middle;
}

.tm-weekly-table td small {
    display: block;
    font-size: 0.75rem;
}

/* ── Dashboard Entry Rows ──────────────────────────────────────────── */
.tm-entry-row .tm-entry-hours {
    font-weight: 600;
    font-size: 1rem;
}

/* ── Date Navigation ───────────────────────────────────────────────── */
.tm-date-nav {
    flex-wrap: wrap;
}

.tm-date-nav .btn {
    min-width: 44px;
    min-height: 44px;
}

/* ── Admin Tables ──────────────────────────────────────────────────── */
.adminlist thead th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}

/* ── Menu Timer Widget ─────────────────────────────────────────────── */
.tm-menu-timer {
    padding: 0.5rem;
    text-align: center;
}

.tm-menu-timer .tm-timer-display {
    font-size: 1.5rem;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .tm-hours-big {
        font-size: 2rem;
    }

    .tm-timer-display {
        font-size: 1.5rem;
    }

    .tm-timer-widget {
        flex-direction: column;
        text-align: center;
    }

    .tm-timer-controls .btn {
        min-width: 100px;
    }

    .tm-date-nav {
        margin-top: 0.5rem;
    }

    .tm-entry-table input.form-control,
    .tm-entry-table select.form-select {
        font-size: 0.8rem;
        padding: 0.2rem 0.35rem;
    }
}

@media (max-width: 575px) {
    .tm-date-nav {
        width: 100%;
        justify-content: center;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   PHASE 2 — Customers, Projects & Project Time
   ══════════════════════════════════════════════════════════════════════ */

/* ── Priority Badges ──────────────────────────────────────────────── */
.tm-priority-low       { background-color: #6c757d; color: #fff; }
.tm-priority-normal    { background-color: #0d6efd; color: #fff; }
.tm-priority-high      { background-color: #fd7e14; color: #fff; }
.tm-priority-urgent    { background-color: #dc3545; color: #fff; }

/* ── Status Badges ────────────────────────────────────────────────── */
.tm-status-active      { background-color: #198754; color: #fff; }
.tm-status-completed   { background-color: #6c757d; color: #fff; }
.tm-status-onhold      { background-color: #ffc107; color: #212529; }
.tm-status-cancelled   { background-color: #dc3545; color: #fff; }
.tm-status-inactive    { background-color: #adb5bd; color: #fff; }

/* ── Project List ─────────────────────────────────────────────────── */
.tm-project-list .card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tm-project-list .card:hover {
    transform: translateY(-1px);
}

.tm-project-filters .form-select,
.tm-project-filters .form-control {
    font-size: 0.875rem;
}

/* ── Project Detail ───────────────────────────────────────────────── */
.tm-project-view .card-title {
    font-size: 1.1rem;
}

.tm-project-header {
    border-left: 4px solid #0d6efd;
    border-radius: 0.5rem;
}

/* Budget progress bar */
.tm-budget-bar .progress {
    height: 1.25rem;
    border-radius: 0.375rem;
}

.tm-budget-bar .progress-bar {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
}

/* ── Sublevel Tree ────────────────────────────────────────────────── */
.tm-level-tree {
    list-style: none;
    padding-left: 0;
}

.tm-level-tree .tm-level-tree {
    padding-left: 1.5rem;
    border-left: 2px solid #dee2e6;
    margin-left: 0.5rem;
    margin-top: 0.25rem;
}

.tm-level-item {
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.15s ease;
}

.tm-level-item:hover {
    background-color: #f8f9fa;
}

.tm-level-item .badge {
    font-size: 0.7rem;
}

/* ── Comments ─────────────────────────────────────────────────────── */
.tm-comment {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    background-color: #fdfdfe;
}

.tm-comment:hover {
    background-color: #f8f9fa;
}

.tm-comment-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

.tm-comment-body {
    margin-top: 0.35rem;
    font-size: 0.925rem;
    line-height: 1.5;
}

.tm-comment-actions {
    margin-top: 0.35rem;
}

/* ── Project Time Entry ───────────────────────────────────────────── */
.tm-project-time .tm-cascading-dropdowns .form-select {
    font-size: 0.875rem;
}

.tm-project-time .tm-cascading-dropdowns .form-select:disabled {
    background-color: #e9ecef;
    opacity: 0.65;
}

.tm-pt-entry-list .table {
    font-size: 0.875rem;
}

.tm-pt-entry-list .table td {
    vertical-align: middle;
}

/* ── Customer List ────────────────────────────────────────────────── */
.tm-customer-list .table td {
    vertical-align: middle;
}

.tm-customer-list .badge {
    font-size: 0.75rem;
}

/* ── My Work (Dashboard) ──────────────────────────────────────────── */
.tm-dashboard .tm-status-active,
.tm-dashboard .tm-status-completed,
.tm-dashboard .tm-status-onhold {
    font-size: 0.7rem;
    padding: 0.2em 0.5em;
}

/* ── Phase 2 Responsive ──────────────────────────────────────────── */
@media (max-width: 767px) {
    .tm-level-tree .tm-level-tree {
        padding-left: 1rem;
    }

    .tm-project-filters .row > div {
        margin-bottom: 0.5rem;
    }

    .tm-comment {
        padding: 0.5rem;
    }

    .tm-budget-bar .progress {
        height: 1rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   PHASE 3 — Holidays & PTO
   ══════════════════════════════════════════════════════════════════════ */

/* ── Holiday Row Styling ─────────────────────────────────────────────── */
.tm-row-holiday {
    background-color: rgba(25, 135, 84, 0.06);
    border-left: 3px solid #198754;
}

.tm-row-pto {
    background-color: rgba(13, 110, 253, 0.06);
    border-left: 3px solid #0d6efd;
}

/* ── PTO Type Badges ─────────────────────────────────────────────────── */
.tm-pto-badge-holiday     { background-color: #198754; color: #fff; }
.tm-pto-badge-sick        { background-color: #dc3545; color: #fff; }
.tm-pto-badge-vacation    { background-color: #0d6efd; color: #fff; }
.tm-pto-badge-bereavement { background-color: #6c757d; color: #fff; }

/* ── PTO Balance Cards ───────────────────────────────────────────────── */
.tm-pto-card {
    border-radius: 0.5rem;
    transition: box-shadow 0.2s ease;
}

.tm-pto-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.tm-pto-card .progress {
    height: 0.5rem;
    border-radius: 0.25rem;
}

.tm-pto-balance-big {
    font-size: 1.75rem;
    font-weight: 700;
}

/* ── PTO Approval ────────────────────────────────────────────────────── */
.tm-pending-row {
    background-color: rgba(255, 193, 7, 0.08);
    border-left: 3px solid #ffc107;
}

.tm-approval-actions .btn {
    min-width: 80px;
    min-height: 44px;
}

/* ── Holiday Admin Table ─────────────────────────────────────────────── */
.tm-holiday-table .tm-holiday-date {
    font-weight: 600;
    white-space: nowrap;
}

.tm-holiday-table .tm-holiday-hours {
    font-weight: 600;
    text-align: center;
    min-width: 60px;
}

.tm-holiday-total {
    font-size: 1.1rem;
    font-weight: 700;
}

/* ── Phase 3 Responsive ─────────────────────────────────────────────── */
@media (max-width: 767px) {
    .tm-pto-balance-big {
        font-size: 1.25rem;
    }

    .tm-approval-actions .btn {
        min-width: 60px;
        font-size: 0.8rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   PHASE 4 — Reporting & Payroll
   ══════════════════════════════════════════════════════════════════════ */

/* ── Report Tabs ─────────────────────────────────────────────────────── */
.tm-report-tabs {
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 1.5rem;
}

.tm-report-tab {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.tm-report-tab:hover,
.tm-report-tab:focus-visible {
    color: #0d6efd;
    text-decoration: none;
}

.tm-report-tab:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
}

.tm-report-tab.active {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
}

.tm-report-pane {
    display: none;
}

.tm-report-pane:first-of-type {
    display: block;
}

/* ── Report Tables ───────────────────────────────────────────────────── */
.tm-report-table {
    font-size: 0.875rem;
}

.tm-report-table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
}

.tm-report-table tbody td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

.tm-report-table .tm-subtotal-row {
    background-color: #f8f9fa;
    font-weight: 600;
}

.tm-report-table .tm-grandtotal-row {
    background-color: #e9ecef;
    font-weight: 700;
    border-top: 2px solid #6c757d;
}

/* ── Payroll Drill-down ──────────────────────────────────────────────── */
.tm-payroll-drill {
    cursor: pointer;
    color: #0d6efd;
    text-decoration: none;
}

.tm-payroll-drill:hover,
.tm-payroll-drill:focus-visible {
    text-decoration: underline;
}

.tm-payroll-drill:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.tm-emp-detail-row {
    background-color: #f8f9fa;
}

.tm-emp-detail-row td {
    padding: 0 !important;
}

.tm-emp-detail-table {
    font-size: 0.8rem;
    margin: 0;
}

.tm-emp-detail-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6c757d;
}

/* ── Approval Section ────────────────────────────────────────────────── */
.tm-approval-section {
    background-color: #fffbea;
    border-color: #ffc107 !important;
}

.tm-approval-card {
    border-left: 3px solid #ffc107;
    transition: box-shadow 0.2s ease;
}

.tm-approval-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tm-approval-card .card-header {
    background-color: #fffbea;
}

/* ── Status Badges (entry rows) ──────────────────────────────────────── */
.tm-status-badge-draft {
    background-color: #adb5bd;
    color: #fff;
}

.tm-status-badge-submitted {
    background-color: #ffc107;
    color: #212529;
}

.tm-status-badge-approved {
    background-color: #198754;
    color: #fff;
}

.tm-status-badge-rejected {
    background-color: #dc3545;
    color: #fff;
}

/* ── Budget Progress Bars (Project Report) ───────────────────────────── */
.tm-budget-progress .progress {
    height: 1rem;
    border-radius: 0.25rem;
}

.tm-budget-progress .progress-bar {
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1rem;
}

.tm-budget-green  .progress-bar { background-color: #198754; }
.tm-budget-yellow .progress-bar { background-color: #ffc107; color: #212529; }
.tm-budget-red    .progress-bar { background-color: #dc3545; }

/* ── Export Buttons ──────────────────────────────────────────────────── */
.tm-export-btns {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tm-export-btns .btn {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
}

/* ── Pay Period Nav ──────────────────────────────────────────────────── */
.tm-pp-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tm-pp-label {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}

.tm-pp-nav .btn {
    min-width: 44px;
    min-height: 44px;
}

/* ── Custom Range Picker ─────────────────────────────────────────────── */
.tm-custom-range {
    display: none;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Unapproved Warning ─────────────────────────────────────────────── */
.tm-unapproved-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #856404;
}

/* ── Print Styles ────────────────────────────────────────────────────── */
@media print {
    .tm-report-tabs,
    .tm-export-btns,
    .tm-pp-nav .btn,
    .tm-custom-range,
    .tm-approval-section button,
    .btn {
        display: none !important;
    }

    .tm-report-pane {
        display: block !important;
    }

    .tm-report-table {
        font-size: 0.75rem;
    }

    .tm-report-table th,
    .tm-report-table td {
        padding: 0.25rem 0.5rem;
    }
}

/* ── Phase 4 Responsive ──────────────────────────────────────────────── */
@media (max-width: 767px) {
    .tm-report-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .tm-pp-nav {
        flex-wrap: wrap;
    }

    .tm-pp-label {
        font-size: 0.875rem;
    }

    .tm-report-table {
        font-size: 0.8rem;
    }

    .tm-export-btns {
        justify-content: center;
    }

    .tm-approval-card .card-header {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 575px) {
    .tm-report-tabs {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tm-custom-range {
        flex-direction: column;
        align-items: stretch;
    }
}
