/**
 * TrueBooker Staff Schedule Addon - Styles
 */

/* ── Wrapper ─────────────────────────────────────────────── */
.tb-staff-schedule-wrapper {
    background-color: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tb-staff-schedule-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px 0;
}

/* ── Category Filters ────────────────────────────────────── */
.tb-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background-color: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.tb-filter-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid #ddd;
    background-color: #fff;
    color: #666;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.tb-filter-btn:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.tb-filter-btn.active {
    border-color: #0073aa;
    background-color: #0073aa;
    color: #fff;
}

.tb-filter-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ── Service Select ──────────────────────────────────────── */
.tb-staff-schedule-controls {
    margin-bottom: 18px;
}

.tb-service-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tb-service-select:hover { border-color: #0073aa; }
.tb-service-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0,115,170,0.12);
}

/* ── Week Navigation ─────────────────────────────────────── */
.tb-staff-schedule-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tb-nav-btn {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #0073aa;
    background-color: #0073aa;
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tb-nav-btn:hover { background-color: #005a87; border-color: #005a87; }
.tb-nav-btn:focus { outline: 2px solid #0073aa; outline-offset: 2px; }

.tb-week-info {
    font-size: 15px;
    font-weight: 600;
    color: #0073aa;
    min-width: 200px;
    text-align: center;
}

/* ── Table Wrapper ───────────────────────────────────────── */
.tb-staff-schedule-container {
    overflow-x: auto;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.tb-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
}

/* ── Schedule Table ──────────────────────────────────────── */
.tb-schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

/* ── Header ──────────────────────────────────────────────── */
.tb-schedule-table thead {
    background: #0073aa;
    color: #fff;
}

.tb-schedule-table th {
    padding: 12px 10px;
    font-weight: 600;
    text-align: center;
    border-right: 1px solid rgba(255,255,255,0.15);
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.tb-schedule-table th:last-child { border-right: none; }

.tb-staff-col {
    text-align: left !important;
    padding: 12px 14px !important;
    width: 160px;
    min-width: 140px;
}

.tb-day-col {
    min-width: 110px;
}

.tb-day-short {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

.tb-day-date {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-top: 2px;
}

/* ── Body Rows ───────────────────────────────────────────── */
.tb-schedule-table tbody tr {
    border-bottom: 1px solid #e8e8e8;
}

.tb-schedule-table tbody tr:last-child {
    border-bottom: none;
}

/* Prevent hover on expand rows */
.tb-staff-row:hover {
    background-color: #f7f9fc;
}

.tb-schedule-table td {
    padding: 10px 10px;
    border-right: 1px solid #e8e8e8;
    vertical-align: middle;
}

.tb-schedule-table td:last-child { border-right: none; }

/* ── Staff Name Cell ─────────────────────────────────────── */
.tb-staff-name-cell {
    background-color: #f9f9f9;
    position: sticky;
    left: 0;
    z-index: 2;
    border-right: 2px solid #e0e0e0 !important;
    padding: 10px 14px !important;
}

.tb-staff-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Avatar image */
.tb-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #0073aa;
    flex-shrink: 0;
}

/* Avatar initials fallback */
.tb-avatar-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #0073aa;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.tb-staff-name {
    font-weight: 600;
    color: #222;
    font-size: 13px;
    line-height: 1.3;
}

/* ── Day Cells ───────────────────────────────────────────── */
.tb-day-cell {
    text-align: center;
    vertical-align: middle !important;
    padding: 8px 6px !important;
}

/* ── Range Badge (clickable working time) ────────────────── */
/* .tb-range-badge { */
    /* display: inline-flex; */
    /* align-items: center; */
    /* gap: 5px; */
    /* background-color: #e8f4fb; */
    /* color: #005a87; */
    /* border: 1px solid #b3d9f0; */
    /* border-radius: 5px; */
    /* padding: 5px 10px; */
    /* font-size: 12px; */
    /* font-weight: 600; */
    /* cursor: pointer; */
    /* transition: background-color 0.2s ease, border-color 0.2s ease; */
    /* white-space: nowrap; */
    /* width: 100%; */
    /* justify-content: center; */
/* } */

/* .tb-range-badge:hover { */
    /* background-color: #d0eaf7; */
    /* border-color: #0073aa; */
/* } */

/* .tb-range-badge.tb-active { */
    /* background-color: #0073aa; */
    /* color: #fff; */
    /* border-color: #005a87; */
/* } */

/* .tb-range-badge:focus { */
    /* outline: 2px solid #0073aa; */
    /* outline-offset: 2px; */
/* } */

.tb-chevron {
    font-size: 14px;
    line-height: 1;
    transition: transform 0.2s ease;
    display: inline-block;
}

/* .tb-range-badge.tb-active .tb-chevron { */
    /* transform: rotate(180deg); */
/* } */

/* ── Off Day Cell ────────────────────────────────────────── */
.tb-day-off {
    background-color: #fafafa;
}

.tb-off-label {
    display: inline-block;
    color: #bbb;
    font-size: 12px;
    font-style: italic;
}

/* ── Expand Row ──────────────────────────────────────────── */
.tb-expand-row td {
    padding: 0 !important;
    border-right: none !important;
    border-bottom: 1px solid #e0e0e0;
}

.tb-hidden {
    display: none;
}

.tb-expand-inner {
    padding: 12px 16px 16px 16px;
    background-color: #f0f7fc;
    border-top: 2px solid #0073aa;
}

.tb-expand-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #0073aa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* ── Service Chips ───────────────────────────────────────── */
.tb-svc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tb-svc-chip {
    display: inline-flex;
    flex-direction: column;
    background-color: #fff;
    border: 1px solid #c8e0f0;
    border-radius: 6px;
    padding: 7px 12px;
    min-width: 120px;
    transition: border-color 0.2s ease;
}

.tb-svc-chip:hover {
    border-color: #0073aa;
}

.tb-svc-name {
    font-size: 12px;
    font-weight: 600;
    color: #222;
    line-height: 1.3;
}

.tb-svc-dur {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.tb-icon-clock::before {
    content: "⏱";
    font-size: 11px;
}

.tb-no-svc {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* ── States ──────────────────────────────────────────────── */
.tb-loading {
    padding: 40px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.tb-loading::after {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    border: 3px solid #e0e0e0;
    border-top-color: #0073aa;
    border-radius: 50%;
    margin: 12px auto 0;
    animation: tb-spin 0.7s linear infinite;
}

@keyframes tb-spin {
    to { transform: rotate(360deg); }
}

.tb-no-data {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
    font-style: italic;
}

.tb-staff-schedule-error,
.tb-error {
    padding: 14px 16px;
    background-color: #fdf1f1;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    color: #721c24;
    margin: 15px 0;
    font-size: 13px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .tb-staff-col { width: 130px; min-width: 120px; }
    .tb-day-col   { min-width: 90px; }
    .tb-range-badge { font-size: 11px; padding: 4px 7px; }
}

@media (max-width: 768px) {
    .tb-staff-schedule-wrapper { padding: 15px; }
    .tb-staff-schedule-title   { font-size: 20px; }
    .tb-staff-col              { width: 110px; min-width: 100px; }
    .tb-day-col                { min-width: 80px; }
    .tb-range-badge            { font-size: 11px; padding: 4px 6px; gap: 3px; }
    .tb-svc-chip               { min-width: 100px; }
    .tb-week-info              { font-size: 13px; min-width: auto; }
    .tb-nav-btn                { padding: 6px 12px; font-size: 12px; }
    .tb-avatar-img,
    .tb-avatar-initials        { width: 30px; height: 30px; font-size: 11px; }
    .tb-staff-name             { font-size: 12px; }
}

@media (max-width: 540px) {
    .tb-staff-schedule-wrapper { padding: 10px; }
    .tb-staff-schedule-navigation { flex-direction: column; gap: 8px; }
    .tb-nav-btn                { width: 100%; }
    .tb-week-info              { width: 100%; }
    .tb-staff-col              { width: 90px; min-width: 80px; }
    .tb-day-col                { min-width: 68px; }
    .tb-day-short              { font-size: 10px; }
    .tb-day-date               { font-size: 11px; }
    .tb-range-badge            { font-size: 10px; padding: 3px 5px; }
    .tb-chevron                { display: none; }
    .tb-svc-list               { flex-direction: column; }
    .tb-svc-chip               { min-width: unset; width: 100%; }
    .tb-staff-meta             { gap: 7px; }
    .tb-avatar-img,
    .tb-avatar-initials        { width: 26px; height: 26px; font-size: 10px; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
    .tb-staff-schedule-wrapper       { box-shadow: none; border: 1px solid #ddd; }
    .tb-staff-schedule-navigation,
    .tb-staff-schedule-controls,
    .tb-category-filters             { display: none; }
    .tb-expand-row                   { display: table-row !important; }
    .tb-range-badge                  { border: 1px solid #999; background: none; color: #000; }
    .tb-schedule-table               { page-break-inside: avoid; }
}

/* ── Service Filter Buttons ──────────────────────────────── */
.tb-service-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 14px;
    background-color: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.tb-service-btn {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1.5px solid #ddd;
    background-color: #fff;
    color: #555;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.3;
}

.tb-service-btn:hover {
    border-color: #0073aa;
    color: #0073aa;
    background-color: #f0f7fb;
}

.tb-service-btn.active {
    border-color: #0073aa;
    background-color: #0073aa;
    color: #fff;
}

.tb-service-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Hidden service buttons (filtered by category) */
.tb-service-btn[style*="display: none"],
.tb-service-btn[style*="display:none"] {
    display: none !important;
}

@media (max-width: 540px) {
    .tb-service-filters {
        gap: 6px;
        padding: 10px;
    }
    .tb-service-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}


/* Staff name cell — clickable */
.tb-staff-clickable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.tb-staff-clickable:hover {
    background-color: #eef5fb;
}

.tb-staff-clickable.tb-active {
    background-color: #ddeef8;
}

.tb-staff-clickable .tb-chevron {
    font-size: 14px;
    margin-left: auto;
    transition: transform 0.2s ease;
    color: #0073aa;
}

.tb-staff-clickable.tb-active .tb-chevron {
    transform: rotate(180deg);
}

/* tb-staff-meta needs space-between for chevron to push right */
.tb-staff-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: space-between; /* ADD THIS */
}

/* Range text — plain, no button styling */
.tb-range-text {
    display: inline-block;
    color: #005a87;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.tb-day-not-set {
    background-color: #fafafa;
}

.tb-not-set-label {
    display: inline-block;
    color: #ccc;
    font-size: 11px;
    font-style: italic;
}

.tb-day-off {
    background-color: #fafafa;
}

.tb-off-label {
    display: inline-block;
    color: #bbb;
    font-size: 12px;
    font-style: italic;
}