/* FILE: assets/css/components/timeline.css (new) */

.timeline-section { padding: 20px; }
.timeline-day { margin-bottom: 30px; padding-bottom: 25px; }
.day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.day-date { font-weight: 700; color: var(--text-dark); font-size: 16px; }
.day-stats { font-size: 12px; color: var(--text-light); background: var(--bg-light); padding: 5px 10px; border-radius: 20px; }
.timeline-bar { position: relative; height: 40px; background: #e9ecef; border-radius: var(--border-radius-sm); overflow: visible; margin-top: 25px;}
.time-labels { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 10px; color: var(--text-light); }

/* Sleep Blocks */
.sleep-block-wrapper { position: absolute; top: 0; height: 100%; z-index: 10; cursor: pointer; }
.sleep-block { position: relative; width: 100%; height: 100%; transition: all 0.3s ease; border-radius: 4px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.sleep-block-wrapper:hover .sleep-block { filter: brightness(1.2); }
@keyframes animate-gradient-wave { 0% { background-position: 0% 50% } 50% { background-position: 100% 50% } 100% { background-position: 0% 50% } }
.sleep-block--in-progress { background: linear-gradient(-45deg, #a8e6cf, #457b9d, #1d3557, #457b9d, #a8e6cf); background-size: 400% 400%; animation: animate-gradient-wave 8s ease infinite; }
.sleep-block.sleep-block--nap { background: var(--nap-gradient); }
.sleep-block.sleep-block--night-long { background: var(--night-long-gradient); }
.sleep-block.sleep-block--night-short { background: var(--night-short-gradient); }

/* Duration Text */
.sleep-block-duration { pointer-events: none; padding-bottom: 2px; font-size: 12px; font-weight: 600; }
.sleep-block .sleep-block-duration { color: var(--text-white); text-shadow: 1px 1px 3px rgba(0,0,0,0.9); }
/* --- MODIFICATION: New class for externally positioned duration text with highest z-index --- */
.sleep-duration-text {
    position: absolute;
    bottom: 2px;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2px;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    color: var(--text-dark);
    text-shadow: 0 0 4px white, 0 0 4px white;
    z-index: 25;
}


/* Notes and Decorations */
.sleep-block-forced-wakeup::after { content: ''; position: absolute; right: 0; top: 0; width: 5px; height: 100%; background-color: var(--color-red); border-radius: 0 4px 4px 0; }
.sleep-block-notes-wrapper { position: absolute; bottom: -22px; left: 0; width: 100%; text-align: center; }
.sleep-block-notes-underline { height: 3px; background-color: #ffdd59; border-radius: 2px; width: 100%; margin: 0 auto; }
.sleep-block-notes-text { font-size: 11px; color: var(--text-light); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }

/* --- MODIFICATION: Flattened z-index hierarchy --- */
/* Events & Icons Layer */
.diaper-event-marker, .medic-event-marker, .dairy-event-marker { pointer-events: auto; }
.interruption-mark { position: absolute; top: 2px; transform: translateX(-50%); color: #ffdd59; font-weight: bold; font-size: 20px; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); line-height: 1; z-index: 12; }
.medic-block { position: absolute; background: repeating-linear-gradient(45deg, rgba(231, 76, 60, 0.7), rgba(231, 76, 60, 0.7) 10px, rgba(192, 57, 43, 0.7) 10px, rgba(192, 57, 43, 0.7) 20px); border-radius: 4px; z-index: 15; pointer-events: none; }
.guest_medic .medic-block, .premium_medic .medic-block { height: 100%; top: 0; }
.premium_all .medic-block { height: 50%; top: 0; }
.medic-event-marker { position: absolute; top: -2px; transform: translateX(-50%); font-size: 18px; z-index: 20; cursor: pointer; text-shadow: 0 0 3px white; }
.diaper-event-marker { position: absolute; top: -24px; transform: translateX(-50%); font-size: 18px; cursor: pointer; z-index: 20; }
.diaper-event-marker.poo-size-2 { font-size: 22px; }
.diaper-event-marker.poo-size-3 { font-size: 26px; }
.dairy-event-marker { position: absolute; top: 20px; transform: translateX(-50%); font-size: 18px; z-index: 20; cursor: pointer; }


/* Details Panel */
.sleep-details { background: var(--text-white); margin-top: 15px; padding: 20px; border-radius: 15px; box-shadow: var(--shadow-md); border-left: 4px solid var(--primary-gradient); display: none; animation: slideDown 0.3s ease-out; }
.sleep-details.show { display: block; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.details-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid #f0f0f0; }
.details-header h3 { color: var(--text-dark); margin: 0; font-size: 18px; }
.close-details { color: #999; font-size: 24px; font-weight: bold; cursor: pointer; line-height: 1; padding: 5px; border-radius: 50%; transition: all 0.3s ease; }
.detail-item { margin-bottom: 15px; padding: 12px; background: var(--bg-light); border-radius: 10px; }
.detail-item .label { font-weight: 600; color: var(--text-light); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.detail-item .value { font-size: 16px; color: var(--text-dark); }
.action-buttons { display: flex; gap: 10px; margin-top: 15px; justify-content: flex-end; }

/* Averages and Gauges */
.average-section { padding: 15px; background: var(--bg-light); border-radius: var(--border-radius-md); margin-bottom: 20px; }
.average-section div { font-size: 14px; color: var(--text-dark); line-height: 1.5; text-align: center;}
#daily-gauges { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; padding: 15px; border: 1px solid #e0d9d0; border-radius: var(--border-radius-md); }
.daily-gauge { flex: 1; }
.gauge-label { font-size: 14px; font-weight: 600; margin-bottom: 5px; text-align: center; }
.gauge-bar { position: relative; height: 12px; background: #e9ecef; border-radius: 6px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; }
.gauge-fill--red { background-color: var(--color-red); }
.gauge-fill--green { background-color: var(--color-green); }
.gauge-fill--orange { background-color: var(--color-orange); }
.gauge-bar .gauge-marker { position: absolute; top: 0; height: 100%; width: 2px; background: rgba(0,0,0,0.3); }
.day-stats .dairy-total { font-weight: bold; margin-left: 5px; }
.dairy-total--red { color: var(--color-red); }
.dairy-total--green { color: var(--color-green); }
.dairy-total--orange { color: var(--color-orange); }
.gauge-separator { font-size: 24px; align-self: center; }

/* Medication Banners */
#medication-banners { position: sticky; top: 0; z-index: 100; }
.medication-banner { padding: 8px; text-align: center; color: var(--text-white); font-weight: bold; font-size: 14px; }
.banner--red { background-color: var(--color-red); }
.banner--orange { background-color: var(--color-orange); }
.banner--green { background-color: var(--color-green); }