/**
 * Joomill Opening Hours Free
 *
 * @copyright   Copyright (c) 2026 Jeroen Moolenschot | Joomill
 * @license     GNU General Public License version 3 or later
 * @link        https://www.joomill-extensions.com
 */

.openinghours-notes, .openinghours-open, .openinghours-closed {
    margin-top: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.openinghours {
    margin: auto;
}

.openinghours-eachday {
    display: inline-block;
    width: 100%;
}

.openinghours-day {
    float: left;
    overflow: hidden;
}

.openinghours-date {
    float: left;
    overflow: hidden;
}

.openinghours-time {
    float: right;
    overflow: hidden;
}

/* Note with a day or an exceptional date */
.openinghours-note {
    clear: both;
    font-size: 0.9em;
    opacity: 0.85;
}

.openinghours-microdata {
    display: none;
}

/* Text for screen readers only, such as "(today)" next to the highlighted day */
.openinghours-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Live status line */
.openinghours-live {
    display: block;
    margin-top: 0.35em;
    font-size: 0.9em;
    opacity: 0.85;
}

.openinghours-live-soon {
    font-weight: 700;
    opacity: 1;
}

/* Week navigation above the weekly table (setting "Week navigation") */
.openinghours-weeknav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 0.5em;
}

.openinghours-weeknav-bar[hidden],
.openinghours-weeknav-message[hidden] {
    display: none;
}

.openinghours-weeknav-bar .btn {
    flex: 0 0 auto;
    min-width: 2.5em;
}

.openinghours-weeknav-title {
    flex: 1 1 auto;
    font-weight: 600;
    text-align: center;
}

.openinghours-weeknav-message {
    margin-bottom: 0.5em;
    padding: 0.5em;
    border: 1px solid #f1aeb5;
    border-radius: 4px;
    background: #f8d7da;
    color: #58151c;
}

.openinghours-weeknav.loading .openinghours-weeknav-content {
    opacity: 0.5;
    transition: opacity 0.1s;
}

/* Layout "Calendar" with "On narrow screens: weekly table": the calendar when
   the module is wide enough, the weekly table when it is not. */
.openinghours-calendar-layout {
    container-type: inline-size;
    container-name: ohlayout;
}

.openinghours-calendar-layout-week {
    display: none;
}

@container ohlayout (max-width: 560px) {
    .openinghours-calendar-layout[data-mobile-view="week"] .openinghours-calendar-layout-month {
        display: none;
    }

    .openinghours-calendar-layout[data-mobile-view="week"] .openinghours-calendar-layout-week {
        display: block;
    }
}

/* Month calendar (layout "Calendar" and {openinghourscalendar}).
   Same look as the Joomill Content Calendar Frontend module, under this
   module's own class names so both can sit on one page. */
.openinghours-calendar {
    --oh-cal-border: var(--border-width, 1px) solid var(--border-color, #dadce0);
    --oh-cal-open-bg: #e3f4e6;
    --oh-cal-open-color: #14532d;
    --oh-cal-closed-bg: #fbe4e4;
    --oh-cal-closed-color: #7f1d1d;
    border: var(--oh-cal-border);

    /* The layout follows the width of the calendar itself, so it also
       adapts in a sidebar or a narrow column on a wide screen */
    container-type: inline-size;
    container-name: ohcal;
}

.openinghours-calendar,
.openinghours-calendar *,
.openinghours-calendar *::before,
.openinghours-calendar *::after {
    box-sizing: border-box;
}

.openinghours-calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    padding: 16px 24px;
}

.openinghours-calendar-title {
    margin: 0;
    font-size: 22px;
    font-weight: 400;
    color: #3c4043;
}

.openinghours-calendar-nav[hidden],
.openinghours-calendar-message[hidden],
.openinghours-calendar-month-title[hidden] {
    display: none;
}

.openinghours-calendar-month-title {
    padding: 16px 24px;
    font-size: 22px;
    font-weight: 400;
    color: #3c4043;
    text-align: center;
}

.openinghours-calendar-message {
    margin: 0 24px 12px;
    padding: 8px 12px;
    border: 1px solid #f1aeb5;
    border-radius: 4px;
    background: #f8d7da;
    color: #58151c;
}

.openinghours-calendar.loading .openinghours-calendar-grid {
    opacity: 0.5;
    transition: opacity 0.1s;
}

.openinghours-calendar-table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.openinghours-calendar-table th {
    padding: 12px 8px;
    border-right: var(--oh-cal-border);
    border-bottom: var(--oh-cal-border);
    color: #70757a;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.8px;
    text-align: center;
}

.openinghours-calendar-table td {
    position: relative;
    width: 14.28%;
    height: 60px;
    padding: 0;
    border-right: var(--oh-cal-border);
    border-bottom: var(--oh-cal-border);
    vertical-align: top;
    transition: background-color 0.1s;
}

.openinghours-calendar-table th:last-child,
.openinghours-calendar-table td:last-child {
    border-right: none;
}

.openinghours-calendar-table tbody tr:last-child td {
    border-bottom: none;
}

/* The whole day is coloured: green when open, red when closed */
.openinghours-calendar-day.openinghours-calendar-open {
    background-color: var(--oh-cal-open-bg);
    color: var(--oh-cal-open-color);
}

.openinghours-calendar-day.openinghours-calendar-closed {
    background-color: var(--oh-cal-closed-bg);
    color: var(--oh-cal-closed-color);
}

.openinghours-calendar-day.openinghours-calendar-none:hover {
    background-color: #f8f9fa;
}

.openinghours-calendar-day.openinghours-calendar-empty {
    background-color: var(--atum-calendar-week-bg, #f8f9fa);
}

.openinghours-calendar-number {
    margin-bottom: 8px;
    color: inherit;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
}

.openinghours-calendar-today .openinghours-calendar-number {
    width: 32px;
    height: 24px;
    margin: 0 auto 8px;
    border-radius: var(--border-radius-sm, 4px);
    background: var(--btn-secondary-bg, #6c757d);
    color: var(--btn-secondary-color, #ffffff);
    font-weight: 500;
    line-height: 24px;
}

.openinghours-calendar-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    margin-top: 4px;
    padding: 0 4px 4px;
}

.openinghours-calendar-hours {
    display: block;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.openinghours-calendar-weekday {
    display: none;
}

.openinghours-calendar-note {
    display: block;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* Medium width: the grid stays, with smaller text */
@container ohcal (max-width: 760px) {
    .openinghours-calendar-nav {
        padding: 12px 16px;
    }

    .openinghours-calendar-title,
    .openinghours-calendar-month-title {
        font-size: 18px;
    }

    .openinghours-calendar-table th {
        padding: 8px 2px;
        letter-spacing: 0;
    }

    .openinghours-calendar-hours {
        font-size: 11px;
    }

    .openinghours-calendar-note {
        font-size: 10px;
    }
}

/* Narrow: a list with one line per day. Days without hours and the empty
   cells around the month are left out; open and closed days keep their colour. */
@container ohcal (max-width: 560px) {
    .openinghours-calendar-nav {
        gap: 8px;
        padding: 10px 12px;
    }

    .openinghours-calendar-nav .btn {
        flex: 0 0 auto;
        min-width: 44px;
        min-height: 44px;
    }

    .openinghours-calendar-nav-label {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }

    .openinghours-calendar-title,
    .openinghours-calendar-month-title {
        font-size: 18px;
        text-align: center;
    }

    .openinghours-calendar-table,
    .openinghours-calendar-table tbody,
    .openinghours-calendar-table tr {
        display: block;
        width: 100%;
    }

    .openinghours-calendar-table thead {
        display: none;
    }

    .openinghours-calendar-table td.openinghours-calendar-empty,
    .openinghours-calendar-table td.openinghours-calendar-none {
        display: none;
    }

    .openinghours-calendar-table td {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        height: auto;
        padding: 10px 12px;
        border-right: none;
        border-bottom: var(--oh-cal-border);
    }

    .openinghours-calendar-table tbody tr:last-child td {
        border-bottom: var(--oh-cal-border);
    }

    .openinghours-calendar-number {
        flex: 0 0 4.5em;
        margin: 0;
        font-size: 14px;
        line-height: 1.4;
        text-align: left;
    }

    .openinghours-calendar-weekday {
        display: inline;
    }

    .openinghours-calendar-today .openinghours-calendar-number {
        width: auto;
        height: auto;
        margin: 0;
        padding: 0 6px;
        line-height: 1.4;
    }

    .openinghours-calendar-items {
        flex: 1 1 auto;
        margin: 0;
        padding: 0;
    }

    .openinghours-calendar-hours,
    .openinghours-calendar-note {
        font-size: 14px;
        text-align: right;
    }

    .openinghours-calendar-note {
        font-size: 12px;
        white-space: normal;
    }
}
