/* Barestho admin page. Light only, like the rest of wp-admin. */
.barestho-admin {
    --b-ink: #252332;
    --b-ink-soft: #5b5a66;
    --b-accent: #dc0044;
        --b-accent-tint: #fdeef3;
    --b-focus: var(--b-ink);
    --b-success: #1e8f4e;
    --b-surface: #ffffff;
    --b-surface-soft: #f6f6f8;
    --b-line: #e6e5ea;
    --b-radius: 14px;
    --b-radius-sm: 8px;
    --b-shadow: 0 1px 2px rgba(37, 35, 50, .06), 0 8px 24px rgba(37, 35, 50, .06);
    --b-ease: cubic-bezier(.16, 1, .3, 1);

    max-width: 1180px;
    color: var(--b-ink);
}

/* Header */
.barestho-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 8px 0 24px;
}

.barestho-logo-img {
    width: 150px;
    height: auto;
    display: block;
}

.barestho-help-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--b-radius-sm);
    background: var(--b-surface);
    border: 1px solid var(--b-line);
    color: var(--b-ink);
    font-weight: 500;
    text-decoration: none;
    transition: border-color .2s var(--b-ease), color .2s var(--b-ease);
}

.barestho-help-link:hover,
.barestho-help-link:focus {
    border-color: var(--b-accent);
    color: var(--b-accent);
}

.barestho-help-link .dashicons {
    color: var(--b-accent);
}

/* Cards */
.barestho-card {
    background: var(--b-surface);
    border: 1px solid var(--b-line);
    border-radius: var(--b-radius);
    box-shadow: var(--b-shadow);
    padding: 24px;
}

.barestho-section-title {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--b-ink);
}

.barestho-section {
    margin-top: 40px;
}

.barestho-section-title {
    font-size: 20px;
    margin-bottom: 16px;
}

/* "?" help bubble, opens on hover, click or keyboard focus. */
.barestho-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.barestho-label-row .barestho-label {
    margin: 0;
}

.barestho-help {
    position: relative;
    display: inline-flex;
}

.barestho-help-button {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--b-ink);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
}

.barestho-help-button:focus-visible {
    outline: 2px solid var(--b-focus);
    outline-offset: 2px;
}

.barestho-help-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: -20px;
    z-index: 20;
    width: 340px;
    max-width: calc(100vw - 80px);
    padding: 20px 24px;
    background: var(--b-surface);
    border: 1px solid var(--b-line);
    border-radius: var(--b-radius);
    box-shadow: var(--b-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .2s var(--b-ease), transform .2s var(--b-ease), visibility .2s;
}

.barestho-help-panel::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 26px;
    width: 12px;
    height: 12px;
    background: var(--b-surface);
    border-left: 1px solid var(--b-line);
    border-top: 1px solid var(--b-line);
    transform: rotate(45deg);
}

.barestho-help:hover .barestho-help-panel,
.barestho-help:focus-within .barestho-help-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.barestho-help-panel p {
    margin: 0 0 12px;
    color: var(--b-ink-soft);
    line-height: 1.5;
}

.barestho-help-panel p:last-child {
    margin-bottom: 0;
}

.barestho-help-panel .barestho-help-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--b-ink);
}

.barestho-help-panel .barestho-help-url {
    padding: 12px;
    background: var(--b-surface-soft);
    border: 1px solid var(--b-line);
    border-radius: var(--b-radius-sm);
    color: var(--b-ink);
    font-weight: 600;
    word-break: break-all;
}

.barestho-help-url mark {
    padding: 2px 6px;
    border-radius: 4px;
    background: #fdf0c4;
    color: #7a5a00;
}

/* Restaurant settings + preview */
.barestho-setup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 24px;
}

.barestho-setup > .barestho-card:first-child {
    display: flex;
    flex-direction: column;
}


.barestho-field {
    margin: 0;
    padding: 24px 0;
    border: 0;
    min-width: 0;
}

.barestho-field:first-child {
    padding-top: 0;
}

.barestho-field:last-child {
    padding-bottom: 0;
}

/* A legend sits on the fieldset border by default: float it back inside. */
legend.barestho-label {
    float: left;
    width: 100%;
}

.barestho-field-help {
    clear: left;
    margin: -4px 0 12px;
    color: var(--b-ink-soft);
}

.barestho-input-row .regular-text {
    flex: 1;
    width: auto;
}

.barestho-label {
    display: block;
    margin: 0 0 8px;
    padding: 0;
    font-weight: 600;
    color: var(--b-ink);
}

.barestho-admin input[type="text"],
.barestho-admin textarea {
    border: 1px solid var(--b-line);
    border-radius: var(--b-radius-sm);
    padding: 8px 12px;
    box-shadow: none;
}

.barestho-admin input[type="text"]:focus,
.barestho-admin textarea:focus {
    border-color: var(--b-focus);
    box-shadow: 0 0 0 1px var(--b-focus);
    outline: none;
}

/* The color palette floats over the page instead of pushing the content down. */
.barestho-admin .wp-picker-container {
    position: relative;
}

.barestho-admin .wp-picker-holder {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
}

.barestho-admin .wp-picker-holder .iris-picker {
    border-color: var(--b-line);
    border-radius: var(--b-radius-sm);
    box-shadow: var(--b-shadow);
}

.barestho-admin .wp-picker-container input[type="text"].wp-color-picker {
    width: 90px;
}

.barestho-input-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.barestho-reset-id {
    display: grid;
    place-items: center;
    width: 40px;
    flex: none;
    padding: 0;
    border: 1px solid var(--b-line);
    border-radius: var(--b-radius-sm);
    background: var(--b-surface);
    color: var(--b-ink-soft);
    cursor: pointer;
    transition: color .2s var(--b-ease), border-color .2s var(--b-ease);
}

.barestho-reset-id:hover,
.barestho-reset-id:focus-visible {
    color: var(--b-accent);
    border-color: var(--b-accent);
    outline: none;
}

.barestho-missing-id .barestho-reset-id {
    display: none;
}

.barestho-logo-choices {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-width: 300px;
    height: 68px;
}

.barestho-logo-choice {
    position: relative;
    cursor: pointer;
}

.barestho-logo-choice input {
    position: absolute;
    opacity: 0;
}

.barestho-logo-choice {
    display: flex;
}

.barestho-logo-choice .barestho-color-span {
    position: relative;
    flex: 1;
    display: grid;
    place-items: center;
    border-radius: var(--b-radius);
    outline: 2px solid transparent;
    outline-offset: 3px;
    transition: outline-color .2s var(--b-ease), transform .2s var(--b-ease);
}

.barestho-logo-choice img {
    width: 30px;
    height: auto;
}

/* Check badge on the selected logo. */
.barestho-logo-choice .barestho-color-span::after {
    content: "\f147";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    color: var(--b-ink);
    font: 14px/16px dashicons;
    text-align: center;
    opacity: 0;
    transform: scale(.6);
    transition: opacity .2s var(--b-ease), transform .2s var(--b-ease);
}

.barestho-logo-choice input:checked + .barestho-color-span::after {
    opacity: 1;
    transform: none;
}

.barestho-logo-choice:hover .barestho-color-span {
    transform: translateY(-1px);
}

.barestho-logo-choice input:checked + .barestho-color-span {
    outline-color: var(--b-ink);
}

.barestho-logo-choice input:focus-visible + .barestho-color-span {
    outline-color: var(--b-focus);
}

/* Live preview: data-state on the card picks what is shown (preview or empty). */
.barestho-preview-card {
    display: flex;
    flex-direction: column;
    min-height: 550px;
}

.barestho-preview-frame {
    flex: 1;
    display: flex;
    border-radius: 20px;
    overflow: hidden;
    background: var(--b-surface);
    box-shadow: var(--b-shadow);
}

.barestho-preview-frame iframe {
    flex: 1;
    width: 100%;
    min-height: 550px;
    border: 0;
    pointer-events: none;
}

.barestho-preview-card:not([data-state="preview"]) .barestho-preview-frame,
.barestho-preview-card:not([data-state="empty"]) .barestho-preview-state-empty {
    display: none;
}

/* Empty state fills the whole column, same height as the settings card. */
.barestho-preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 64px 24px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--b-line);
    box-shadow: var(--b-shadow);
    border-radius: var(--b-radius);
    background: var(--b-surface);
    text-align: center;
    color: var(--b-ink-soft);
}

.barestho-preview-empty .dashicons {
    width: 40px;
    height: 40px;
    font-size: 40px;
    color: var(--b-accent);
}

/* Display modes */
.barestho-mode {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) auto;
    gap: 24px;
    align-items: start;
    margin-bottom: 16px;
}

.barestho-mode-media {
    display: grid;
    gap: 8px;
}

.barestho-mode-media img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--b-radius-sm);
    border: 1px solid var(--b-line);
}

/* Conversion tracking: the visit -> reservation -> analytics path, as a small flow. */
.barestho-flow {
    align-self: stretch;
    align-content: center;
    justify-items: center;
    gap: 6px;
    padding: 24px 16px;
    border-radius: var(--b-radius-sm);
    background: var(--b-accent-tint);
}

.barestho-flow-step {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: var(--b-radius-sm);
    background: var(--b-surface);
    box-shadow: var(--b-shadow);
    font-weight: 600;
    color: var(--b-ink);
}

.barestho-flow-step .dashicons {
    flex: none;
    color: var(--b-accent);
}

.barestho-flow-step code {
    padding: 0;
    background: none;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.barestho-flow-step-end {
    background: var(--b-ink);
    color: #fff;
}

.barestho-flow-step-end .dashicons {
    color: #fff;
}

.barestho-flow-arrow {
    color: var(--b-accent);
}

.barestho-mode-body h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: var(--b-ink);
}

.barestho-mode-body ol {
    margin: 0 0 12px 18px;
}

.barestho-mode-body li,
.barestho-mode-body p {
    max-width: 65ch;
    color: var(--b-ink-soft);
    line-height: 1.6;
}

.barestho-mode-body .barestho-label {
    margin-top: 4px;
}

.barestho-code {
    display: inline-block;
    padding: 8px 12px;
    border-radius: var(--b-radius-sm);
    background: var(--b-surface-soft);
    border: 1px solid var(--b-line);
    word-break: break-all;
}

/* Switch: the checkbox stays in the form, the label draws the switch. */
.toggle-button {
    position: relative;
}

.toggle-button input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.toggle-button label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--b-ink-soft);
    white-space: nowrap;
}

.toggle-button label::before {
    content: "";
    flex: none;
    width: 40px;
    height: 24px;
    border-radius: 999px;
    background: #d4d3da;
    transition: background-color .25s var(--b-ease);
}

.toggle-button label::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(37, 35, 50, .25);
    transition: transform .25s var(--b-ease);
}

.toggle-button input:checked + label {
    color: var(--b-success);
}

.toggle-button input:checked + label::before {
    background: var(--b-success);
}

.toggle-button input:checked + label::after {
    transform: translateX(16px);
}

.toggle-button input:focus-visible + label::before {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--b-focus);
}

/* Buttons */
.barestho-admin .button-primary {
    background: var(--b-ink);
    border-color: var(--b-ink);
    border-radius: var(--b-radius-sm);
    padding: 4px 24px;
    font-weight: 600;
    animation: barestho-halo 2.4s ease-out infinite;
}

.barestho-admin .button-primary:hover,
.barestho-admin .button-primary:focus {
    background: #3a3848;
    border-color: #3a3848;
}

.wp-core-ui .barestho-admin .button-primary:disabled,
.wp-core-ui .barestho-admin .button-secondary:disabled {
    background: var(--b-surface-soft) !important;
    border-color: var(--b-line) !important;
    color: #9a99a3 !important;
    animation: none;
    cursor: not-allowed;
}

.barestho-savebar-hint {
    display: none;
    margin: 0;
    color: var(--b-accent);
    font-weight: 500;
}

.barestho-missing-id .barestho-savebar-hint {
    display: block;
}

/* Soft pulsing halo inviting to save. */
@keyframes barestho-halo {
    0% { box-shadow: 0 0 0 0 rgba(37, 35, 50, .45); }
    70%, 100% { box-shadow: 0 0 0 12px rgba(37, 35, 50, 0); }
}

.barestho-admin .button-secondary {
    color: var(--b-ink);
    border-color: var(--b-ink);
    border-radius: var(--b-radius-sm);
    background: var(--b-surface);
}

.barestho-admin .button-secondary:hover,
.barestho-admin .button-secondary:focus {
    color: var(--b-accent);
    border-color: var(--b-accent);
    background: var(--b-surface);
}

.barestho-admin .button:active {
    transform: translateY(1px);
}

.barestho-savebar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px 0;
    background: rgba(240, 240, 241, .85);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--b-line);
}

@media (prefers-reduced-motion: reduce) {
    .barestho-admin *,
    .barestho-admin *::before,
    .barestho-admin *::after {
        transition: none !important;
        animation: none !important;
    }
}

@media (max-width: 1100px) {
    .barestho-setup {
        grid-template-columns: 1fr;
    }

    .barestho-mode {
        grid-template-columns: 180px minmax(0, 1fr);
        grid-template-areas: "media switch" "media body";
        row-gap: 12px;
    }

    .barestho-mode-media { grid-area: media; }
    .barestho-mode-body { grid-area: body; }
    .barestho-mode-switch { grid-area: switch; }
}

@media (max-width: 700px) {
    .barestho-card {
        padding: 16px;
    }

    .barestho-mode {
        grid-template-columns: 1fr;
        grid-template-areas: "media" "switch" "body";
    }

    .barestho-mode-media {
        max-width: 320px;
    }
}
