/* ============================================================
   3D Casas Admin — Timeline Scheduler Styles
   ============================================================ */

/* --- Timeline Container --- */
.timeline-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* --- Timeline Header (hour columns) --- */
.timeline-header {
    display: flex;
    border-bottom: 2px solid var(--med-gray);
    background: var(--light-gray);
    position: sticky;
    top: 0;
    z-index: 10;
}

.timeline-label-col {
    width: 160px;
    min-width: 160px;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--navy);
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.timeline-hours {
    display: flex;
    flex: 1;
    position: relative;
}

.timeline-hour {
    flex: 1;
    text-align: center;
    padding: 0.4rem 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-right: 1px solid var(--med-gray);
    min-width: 60px;
}

.timeline-hour:last-child { border-right: none; }

/* --- Timeline Body --- */
.timeline-body {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overflow-x: auto;
}

/* --- Timeline Row (one per team member) --- */
.timeline-row {
    display: flex;
    min-height: 52px;
    border-bottom: 1px solid var(--med-gray);
    position: relative;
}

.timeline-row:last-child { border-bottom: none; }

.timeline-row:hover { background: rgba(0,0,0,0.01); }

/* --- Area Group Header --- */
.timeline-area-header {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: var(--light-gray);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--navy);
    gap: 0.5rem;
}

.timeline-area-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* --- Member Label --- */
.timeline-member {
    width: 160px;
    min-width: 160px;
    padding: 0.5rem 0.75rem;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.member-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-status {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.member-status.clocked-in { color: var(--success); font-weight: 600; }

/* --- Timeline Track (hour grid) --- */
.timeline-track {
    flex: 1;
    position: relative;
    display: flex;
    min-width: 0;
}

.timeline-cell {
    flex: 1;
    border-right: 1px solid #f0f0f0;
    min-width: 60px;
    position: relative;
}

.timeline-cell:last-child { border-right: none; }

/* Half-hour line */
.timeline-cell::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #f5f5f5;
}

/* --- Current Time Indicator --- */
.timeline-now {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--error);
    z-index: 5;
    pointer-events: none;
}

.timeline-now::before {
    content: "";
    position: absolute;
    top: -4px;
    left: -4px;
    width: 10px;
    height: 10px;
    background: var(--error);
    border-radius: 50%;
}

/* --- Job Block --- */
.timeline-block {
    position: absolute;
    top: 4px;
    bottom: 4px;
    border-radius: 5px;
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
    color: var(--white);
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    z-index: 2;
    transition: box-shadow 0.15s, transform 0.1s;
    min-width: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.timeline-block:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transform: translateY(-1px);
    z-index: 3;
}

.timeline-block .block-address {
    font-weight: 600;
    font-size: 0.72rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-block .block-time {
    font-size: 0.65rem;
    opacity: 0.85;
}

.timeline-block .block-services {
    font-size: 0.62rem;
    opacity: 0.7;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Visual Alert Borders --- */
.timeline-block.alert-unverified {
    border: 2px solid var(--red-border);
    box-shadow: 0 0 0 1px var(--red-border);
}

.timeline-block.alert-skill-gap {
    border: 2px solid var(--orange-border);
    box-shadow: 0 0 0 1px var(--orange-border);
}

/* Lock icon for missing access instructions */
.timeline-block .lock-icon {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.7rem;
    opacity: 0.9;
}

/* --- Dragging States --- */
.timeline-block.dragging {
    opacity: 0.7;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 10;
}

.timeline-track.drag-over {
    background: rgba(11,47,91,0.05);
}

.timeline-drop-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--navy);
    z-index: 8;
    pointer-events: none;
}

/* --- Time-Off / Lunch Blocks --- */
.timeline-block.block-timeoff {
    background: repeating-linear-gradient(
        45deg,
        #e0e0e0,
        #e0e0e0 4px,
        #d0d0d0 4px,
        #d0d0d0 8px
    );
    color: var(--text-muted);
    cursor: default;
    border: 1px solid #ccc;
}

.timeline-block.block-lunch {
    background: repeating-linear-gradient(
        45deg,
        #fff3e0,
        #fff3e0 4px,
        #ffe0b2 4px,
        #ffe0b2 8px
    );
    color: var(--warning);
    cursor: grab;
    border: 1px solid #ffcc80;
    position: absolute;
}

.timeline-block.block-lunch:active {
    cursor: grabbing;
}

.timeline-block.block-lunch .lunch-delete {
    position: absolute;
    top: -2px;
    right: 1px;
    background: none;
    border: none;
    color: #e65100;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
}

.timeline-block.block-lunch:hover .lunch-delete {
    opacity: 1;
}

/* --- Tooltip on Hover --- */
.timeline-tooltip {
    position: fixed;
    background: var(--dark-gray);
    color: var(--white);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.78rem;
    max-width: 280px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    line-height: 1.4;
}

.timeline-tooltip .tip-address { font-weight: 600; margin-bottom: 0.25rem; }
.timeline-tooltip .tip-time { color: #ccc; font-size: 0.72rem; }
.timeline-tooltip .tip-services { margin-top: 0.25rem; font-size: 0.72rem; }
.timeline-tooltip .tip-client { color: #aaa; font-size: 0.7rem; margin-top: 0.2rem; }

/* --- Empty State --- */
.timeline-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- Unscheduled Jobs Sidebar --- */
.unscheduled-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 0.75rem;
    padding: 0.75rem;
}

.unscheduled-panel h3 {
    font-size: 0.85rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.unscheduled-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    cursor: grab;
    background: var(--white);
    transition: background 0.15s;
}

.unscheduled-item:hover { background: var(--light-gray); }
.unscheduled-item:active { cursor: grabbing; }

.unscheduled-item .item-address { font-weight: 600; color: var(--text); }
.unscheduled-item .item-client { color: var(--text-muted); font-size: 0.72rem; }
.unscheduled-item .item-duration {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .timeline-label-col,
    .timeline-member {
        width: 110px;
        min-width: 110px;
    }
    .timeline-hour { min-width: 45px; }
    .timeline-cell { min-width: 45px; }
}
