/**
 * Admin management dashboard
 */

.maca-dashboard-wrap h1 {
    margin-bottom: 8px;
}

.maca-dashboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-bottom: 20px;
    color: #646970;
    font-size: 13px;
}

.maca-dashboard-updated-spacer {
    flex: 1 1 auto;
}

.maca-dashboard-header-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.maca-dashboard-header-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid #dcdcde;
    border-radius: 999px;
    background: #fff;
    color: #1d2327;
    text-decoration: none;
    line-height: 1.2;
}

.maca-dashboard-header-link:hover {
    border-color: #2271b1;
    color: #2271b1;
}

.maca-dashboard-header-link-label {
    font-weight: 600;
    color: inherit;
}

.maca-dashboard-header-link-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: #2271b1;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}

.maca-dashboard-header-link--occupancy {
    cursor: default;
}

.maca-dashboard-header-link--occupancy .maca-dashboard-header-link-count {
    min-width: auto;
    height: auto;
    min-height: 22px;
    padding: 2px 10px;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
}

.maca-dashboard-header-link--occupancy .maca-dashboard-header-link-count.maca-booking-occupancy-low {
    background: #edfaef;
    color: #1e4620;
}

.maca-dashboard-header-link--occupancy .maca-dashboard-header-link-count.maca-booking-occupancy-medium {
    background: #fcf9e8;
    color: #6d4c00;
}

.maca-dashboard-header-link--occupancy .maca-dashboard-header-link-count.maca-booking-occupancy-high {
    background: #fcf0f1;
    color: #8a2424;
}

.maca-dashboard-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #1d2327;
}

.maca-dashboard-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00a32a;
    animation: maca-dashboard-pulse 2s ease-in-out infinite;
}

.maca-dashboard-wrap.is-updating .maca-dashboard-live-dot {
    background: #dba617;
    animation: none;
}

.maca-dashboard-wrap.has-error .maca-dashboard-live-dot {
    background: #d63638;
    animation: none;
}

@keyframes maca-dashboard-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.45;
    }
}

.maca-dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.maca-dashboard-metric {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.maca-dashboard-metric-value {
    display: block;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
    color: #1d2327;
    margin-bottom: 4px;
}

.maca-dashboard-metric-label {
    display: block;
    font-size: 12px;
    color: #646970;
    line-height: 1.35;
}

.maca-dashboard-metric--occupancy .maca-dashboard-metric-value.maca-booking-occupancy {
    display: inline-block;
    font-size: 22px;
    padding: 4px 10px;
    border-radius: 4px;
    min-width: 5em;
    text-align: center;
}

.maca-booking-occupancy-low {
    background: #edfaef;
    color: #1e4620;
}

.maca-booking-occupancy-medium {
    background: #fcf9e8;
    color: #6d4c00;
}

.maca-booking-occupancy-high {
    background: #fcf0f1;
    color: #8a2424;
}

.maca-dashboard-empty-metrics {
    grid-column: 1 / -1;
    margin: 0;
    padding: 16px;
    background: #f6f7f7;
    border-radius: 4px;
}

.maca-dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.maca-dashboard-columns--unlicensed {
    grid-template-columns: 1fr;
}

.maca-dashboard-subheading--quick {
    margin-top: 20px;
    margin-bottom: 10px;
    padding-top: 16px;
    border-top: 1px solid #dcdcde;
}

@media (max-width: 960px) {
    .maca-dashboard-columns {
        grid-template-columns: 1fr;
    }
}

.maca-dashboard-panel {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    padding: 16px 20px 20px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.maca-dashboard-panel h2 {
    margin: 0 0 12px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
}

.maca-dashboard-actions {
    margin: 0;
    padding: 0;
    list-style: none;
}

.maca-dashboard-action {
    margin: 0 0 8px;
}

.maca-dashboard-action:last-child {
    margin-bottom: 0;
}

.maca-dashboard-action a {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #dcdcde;
    background: #f6f7f7;
    color: #1d2327;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.maca-dashboard-action a:hover {
    background: #fff;
    border-color: #2271b1;
}

.maca-dashboard-action-count {
    flex-shrink: 0;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    background: #2271b1;
    color: #fff;
}

.maca-dashboard-action--warning .maca-dashboard-action-count {
    background: #dba617;
    color: #1d2327;
}

.maca-dashboard-action--error .maca-dashboard-action-count {
    background: #d63638;
}

.maca-dashboard-action--info .maca-dashboard-action-count {
    background: #646970;
}

.maca-dashboard-action--empty {
    padding: 12px;
    color: #646970;
    font-style: italic;
}

.maca-dashboard-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.maca-dashboard-quick-actions .button {
    margin: 0;
}

.maca-dashboard-panel--history {
    margin-bottom: 24px;
}

.maca-dashboard-history-form {
    margin-bottom: 12px;
}

.maca-dashboard-history-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.maca-dashboard-history-presets .button {
    margin: 0;
}

.maca-dashboard-history-dates {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}

.maca-dashboard-history-dates label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #1d2327;
}

.maca-dashboard-history-period {
    margin: 0 0 12px;
    font-size: 14px;
    color: #646970;
}

.maca-dashboard-history-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.maca-dashboard-history-chip {
    display: inline-block;
    padding: 6px 10px;
    background: #f0f6fc;
    border: 1px solid #c5d9ed;
    border-radius: 4px;
    font-size: 12px;
    color: #1d2327;
}

.maca-dashboard-subheading {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
}

.maca-dashboard-top-dishes {
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.maca-dashboard-top-dish {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
}

.maca-dashboard-top-dish:last-child {
    border-bottom: none;
}

.maca-dashboard-top-dish-rank {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    background: #2271b1;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.maca-dashboard-top-dish-title {
    flex: 1 1 auto;
    font-weight: 600;
    text-decoration: none;
}

.maca-dashboard-top-dish-count {
    flex-shrink: 0;
    font-size: 12px;
    color: #646970;
}

.maca-dashboard-top-dish--empty {
    color: #646970;
    font-style: italic;
    display: block;
}

.maca-dashboard-history-link-wrap {
    margin: 0;
}

.maca-dish-stats-filters {
    margin-bottom: 16px;
}

.maca-dish-stats-table {
    margin-top: 16px;
}

.maca-dish-stats-summary {
    margin-bottom: 0;
}

.maca-dashboard-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (min-width: 900px) {
    .maca-dashboard-charts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .maca-dashboard-chart-card[data-chart-id='orders-revenue'] {
        grid-column: 1 / -1;
    }
}

.maca-dashboard-chart-card {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 12px 14px 14px;
}

.maca-dashboard-chart-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
}

.maca-dashboard-chart-canvas-wrap {
    position: relative;
    height: 220px;
}

.maca-dashboard-chart-card[data-chart-id='top-dishes'] .maca-dashboard-chart-canvas-wrap {
    height: 200px;
}

.maca-dashboard-chart-card[data-chart-id='payment-status'] .maca-dashboard-chart-canvas-wrap {
    height: 200px;
    max-width: 280px;
    margin: 0 auto;
}

.maca-dashboard-charts-empty {
    margin: 0 0 16px;
    padding: 16px;
    color: #646970;
    font-style: italic;
    background: #f6f7f7;
    border-radius: 4px;
}

/* Compact layout for landscape tablets (e.g. iPad). */
@media (min-width: 1024px) and (max-width: 1366px) {
    .maca-dashboard-wrap h1 {
        margin: 0 0 6px;
        font-size: 24px;
        line-height: 1.25;
    }

    .maca-dashboard-header {
        gap: 8px 12px;
        margin-bottom: 12px;
    }

    .maca-dashboard-header-link {
        padding: 5px 8px;
        gap: 6px;
    }

    .maca-dashboard-header-link-label {
        font-size: 12px;
    }

    .maca-dashboard-metrics {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 14px;
    }

    .maca-dashboard-metric {
        padding: 10px 12px;
    }

    .maca-dashboard-metric-value {
        font-size: 22px;
        margin-bottom: 2px;
        line-height: 1.1;
    }

    .maca-dashboard-metric-label {
        font-size: 11px;
        line-height: 1.25;
    }

    .maca-dashboard-panel--history {
        margin-bottom: 14px;
    }

    .maca-dashboard-panel {
        padding: 10px 12px 12px;
    }

    .maca-dashboard-panel h2 {
        margin-bottom: 8px;
        font-size: 13px;
    }

    .maca-dashboard-history-form {
        margin-bottom: 8px;
    }

    .maca-dashboard-history-presets {
        gap: 6px;
        margin-bottom: 8px;
    }

    .maca-dashboard-history-presets .button,
    .maca-dashboard-history-dates .button {
        min-height: 30px;
        line-height: 28px;
        padding: 0 10px;
        font-size: 12px;
    }

    .maca-dashboard-history-dates {
        gap: 8px 10px;
    }

    .maca-dashboard-history-dates input[type='date'] {
        min-height: 30px;
        line-height: 28px;
        font-size: 12px;
        padding: 0 6px;
    }

    .maca-dashboard-history-period {
        margin-bottom: 8px;
        font-size: 12px;
    }

    .maca-dashboard-history-summary {
        gap: 6px;
        margin-bottom: 10px;
    }

    .maca-dashboard-history-chip {
        padding: 4px 8px;
        font-size: 11px;
    }

    .maca-dashboard-subheading {
        margin-bottom: 6px;
        font-size: 12px;
    }

    .maca-dashboard-charts {
        gap: 10px;
        margin-bottom: 12px;
    }

    .maca-dashboard-chart-card {
        padding: 8px 10px 10px;
    }

    .maca-dashboard-chart-title {
        margin-bottom: 6px;
        font-size: 12px;
    }

    .maca-dashboard-chart-canvas-wrap {
        height: 180px;
    }

    .maca-dashboard-chart-card[data-chart-id='top-dishes'] .maca-dashboard-chart-canvas-wrap {
        height: 165px;
    }

    .maca-dashboard-chart-card[data-chart-id='payment-status'] .maca-dashboard-chart-canvas-wrap {
        height: 165px;
        max-width: 220px;
    }

    .maca-dashboard-top-dishes {
        margin-bottom: 8px;
    }

    .maca-dashboard-top-dish {
        gap: 8px;
        padding: 5px 0;
    }

    .maca-dashboard-top-dish-rank {
        width: 20px;
        height: 20px;
        line-height: 20px;
        font-size: 11px;
    }

    .maca-dashboard-top-dish-title,
    .maca-dashboard-top-dish-count {
        font-size: 12px;
    }

    .maca-dashboard-columns {
        gap: 12px;
    }

    .maca-dashboard-action {
        margin-bottom: 6px;
    }

    .maca-dashboard-action a {
        gap: 8px;
        padding: 7px 8px;
    }

    .maca-dashboard-action-count {
        min-width: 22px;
        padding: 1px 6px;
        font-size: 11px;
    }

    .maca-dashboard-action-label {
        font-size: 12px;
        line-height: 1.25;
    }

    .maca-dashboard-quick-actions {
        gap: 6px;
    }

    .maca-dashboard-quick-actions .button,
    .maca-dashboard-history-link-wrap .button {
        min-height: 30px;
        line-height: 28px;
        padding: 0 10px;
        font-size: 12px;
    }
}
