/**
 * Amelia Timetable Styles
 */

/* Container */
.amelia-tt {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #33404C;
    width: 100%;
    padding: 0 16px;
    box-sizing: border-box;
    overflow-x: auto;
}

/* Header */
.amelia-tt__header {
    display: grid;
    grid-template-columns: 60px repeat(var(--tt-cols, 6), 1fr);
    position: sticky;
    top: 0;
    z-index: 10;
    background: #ffffff;
    border-bottom: 2px solid #B0B8C0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.amelia-tt__time-label {
    padding: 12px 8px;
    text-align: right;
}

.amelia-tt__day-header {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #33404C;
    border-left: 1px solid #D5D8DC;
}

/* Subtle per-day header colors */
.amelia-tt__day-header:nth-child(2) {
    background: #FFF0F0;
}

/* Mon - soft rose */
.amelia-tt__day-header:nth-child(3) {
    background: #FFF5E6;
}

/* Tue - soft peach */
.amelia-tt__day-header:nth-child(4) {
    background: #F0FFF0;
}

/* Wed - soft mint */
.amelia-tt__day-header:nth-child(5) {
    background: #F0F4FF;
}

/* Thu - soft blue */
.amelia-tt__day-header:nth-child(6) {
    background: #FFF0FF;
}

/* Fri - soft lavender */
.amelia-tt__day-header:nth-child(7) {
    background: #FFFFF0;
}

/* Sat - soft yellow */
.amelia-tt__day-header:nth-child(8) {
    background: #F0FFFF;
}

/* Sun - soft cyan */

.amelia-tt__day-short {
    display: none;
}

/* Body grid */
.amelia-tt__body {
    display: grid;
    grid-template-columns: 60px repeat(var(--tt-cols, 6), 1fr);
    min-height: 400px;
}

/* Time column */
.amelia-tt__time-col {
    position: relative;
    border-right: 2px solid #D5D8DC;
}

.amelia-tt__time-slot {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 12px;
    color: #8C99A6;
    font-weight: 500;
    box-sizing: border-box;
}

.amelia-tt__time-slot span {
    transform: translateY(-8px);
    display: inline-block;
}

.amelia-tt__time-slot:first-child span {
    transform: none;
}

/* Day columns */
.amelia-tt__day-col {
    position: relative;
    border-left: 2px solid #D5D8DC;
    min-width: 180px;
}

.amelia-tt__day-col:last-child {
    border-right: 2px solid #D5D8DC;
}

/* Faint per-day background tints to match headers */
.amelia-tt__day-col:nth-child(2) {
    background: #FFFAFA;
}

/* Mon */
.amelia-tt__day-col:nth-child(3) {
    background: #FFFCF5;
}

/* Tue */
.amelia-tt__day-col:nth-child(4) {
    background: #FAFFFA;
}

/* Wed */
.amelia-tt__day-col:nth-child(5) {
    background: #F5F8FF;
}

/* Thu */
.amelia-tt__day-col:nth-child(6) {
    background: #FFFAFF;
}

/* Fri */
.amelia-tt__day-col:nth-child(7) {
    background: #FFFFF8;
}

/* Sat */
.amelia-tt__day-col:nth-child(8) {
    background: #F8FFFF;
}

.amelia-tt__grid-line {
    box-sizing: border-box;
    border-bottom: 1px solid #ECECEC;
}

.amelia-tt__grid-line--hour {
    border-bottom: 1px solid #D0D0D0;
}

/* Service blocks */
.amelia-tt__block {
    position: absolute;
    left: 0;
    right: 0;
    margin: 1px 4px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    z-index: 5;
    box-sizing: border-box;
}

.amelia-tt__block:hover {
    transform: scale(1.03);
    background-color: #ffffff !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    z-index: 6;
}

.amelia-tt__block-time {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.85;
    margin-bottom: 2px;
}

.amelia-tt__block-name {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.amelia-tt__block-desc {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 2px;
    font-style: italic;
}

/* Legend */
.amelia-tt__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 0 8px;
    border-top: 1px solid #E8E8E8;
    margin-top: 8px;
}

.amelia-tt__legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #5A6672;
}

.amelia-tt__legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Dynamic column count via CSS custom property */
.amelia-timetable-container {
    --tt-cols: 6;
}

/* Mobile responsive */
@media (max-width: 768px) {

    .amelia-tt__header,
    .amelia-tt__body {
        grid-template-columns: 50px repeat(var(--tt-cols, 6), minmax(100px, 1fr));
    }

    .amelia-tt__day-full {
        display: none;
    }

    .amelia-tt__day-short {
        display: inline;
    }

    .amelia-tt__block-name {
        font-size: 11px;
    }

    .amelia-tt__block-time {
        font-size: 10px;
    }

    .amelia-tt__time-slot {
        font-size: 10px;
        padding-right: 4px;
    }
}

@media (max-width: 480px) {

    .amelia-tt__header,
    .amelia-tt__body {
        grid-template-columns: 40px repeat(var(--tt-cols, 6), minmax(80px, 1fr));
    }

    .amelia-tt__day-header {
        font-size: 12px;
        padding: 8px 4px;
    }

    .amelia-tt__block {
        padding: 2px 4px;
        margin: 1px 2px;
    }

    .amelia-tt__block-desc {
        display: none;
    }
}