
/*
 * /reactions/saveRecipeModal.css
 * Version: 2.0.0002
 *
 * My Recipes Without Ads
 * Save Recipe Modal
 */

/* ==========================================================
   OVERLAY
   ========================================================== */

body.bw-save-open {
    overflow: hidden;
}

.bw-save-modal,
.bw-save-modal * {
    box-sizing: border-box;
}

.bw-save-modal {
    --save-cream: #fffaf2;
    --save-paper: #fffdf9;
    --save-warm: #f7efe3;
    --save-border: #e8dccc;
    --save-ink: #342820;
    --save-muted: #807165;
    --save-red: #a9342d;
    --save-red-dark: #872720;
    --save-green: #426a47;

    position: fixed;
    inset: 0;
    z-index: 99999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(24, 17, 12, 0.68);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);

    animation: bwSaveOverlayIn 180ms ease-out;
}

/* ==========================================================
   DIALOG
   ========================================================== */

.bw-save-dialog {
    width: 100%;
    max-width: 510px;
    max-height: min(760px, calc(100dvh - 40px));

    display: flex;
    flex-direction: column;

    overflow: hidden;

    padding: 0;

    background: var(--save-cream);
    color: var(--save-ink);

    border: 1px solid #f1e4d3;
    border-radius: 19px;

    box-shadow:
        0 28px 85px rgba(0, 0, 0, 0.32),
        0 4px 14px rgba(0, 0, 0, 0.1);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    font-size: 14px;
    line-height: 1.45;

    animation: bwSaveDialogIn 220ms ease-out;
}

.bw-save-dialog button,
.bw-save-dialog input {
    font: inherit;
}

.bw-save-dialog button {
    cursor: pointer;
}

.bw-save-dialog button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* ==========================================================
   HEADER
   ========================================================== */

.bw-save-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 23px 25px 7px;
}

.bw-save-title {
    margin: 0;
    padding: 0;

    color: var(--save-ink);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    font-size: 21px;
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: -0.6px;
}

.bw-save-close {
    flex: 0 0 31px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 31px;
    height: 31px;

    padding: 0;

    border: 1px solid var(--save-border);
    border-radius: 9px;

    background: var(--save-warm);
    color: var(--save-muted);

    font-size: 21px;
    line-height: 1;

    transition:
        background 150ms ease,
        color 150ms ease,
        transform 150ms ease;
}

.bw-save-close:hover {
    background: #eee0ce;
    color: var(--save-ink);
    transform: rotate(90deg);
}

/* ==========================================================
   RECIPE INFORMATION
   ========================================================== */

.bw-save-description {
    margin: 0;
    padding: 0 25px;

    color: var(--save-red);

    font-size: 14px;
    font-weight: 650;
    line-height: 1.45;
}

.bw-save-help {
    margin: 0;
    padding: 8px 25px 17px;

    color: var(--save-muted);

    font-size: 12.5px;
    line-height: 1.5;
}

/* ==========================================================
   STATUS
   ========================================================== */

.bw-save-status {
    margin: 0 25px;
    padding: 0;

    color: var(--save-muted);

    font-size: 12px;
    line-height: 1.5;
}

.bw-save-status:empty {
    display: none;
}

.bw-save-status.is-error {
    margin-bottom: 12px;
    padding: 10px 12px;

    background: #fff0ed;
    color: #a52e26;

    border: 1px solid #efc6c0;
    border-radius: 9px;
}

.bw-save-status.is-success {
    margin-bottom: 12px;
    padding: 10px 12px;

    background: #edf5ec;
    color: #35623b;

    border: 1px solid #c8dfc7;
    border-radius: 9px;
}

/* ==========================================================
   FAVORITES CARD
   ========================================================== */

.bw-save-favorites {
    margin: 0 25px 21px;
    padding: 15px;

    background:
        linear-gradient(
            135deg,
            #fff3e9 0%,
            #f9e9db 100%
        );

    border: 1px solid #ead1bd;
    border-radius: 13px;
}

.bw-save-favorites-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    margin-bottom: 4px;
}

.bw-save-favorites-title {
    display: flex;
    align-items: center;
    gap: 8px;

    color: #60362b;

    font-size: 15px;
    font-weight: 750;
    letter-spacing: -0.2px;
}

.bw-save-favorites-title::before {
    content: "♥";

    display: flex;
    align-items: center;
    justify-content: center;

    width: 27px;
    height: 27px;

    background: #f3d8d2;
    color: var(--save-red);

    border-radius: 8px;

    font-size: 16px;
}

.bw-save-favorites-badge {
    padding: 4px 8px;

    background: #f2e0cb;
    color: #8b5d35;

    border: 1px solid #e5c9aa;
    border-radius: 20px;

    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.bw-save-favorites-description {
    margin: 0 0 12px;
    padding: 0;

    color: #927464;

    font-size: 12px;
    line-height: 1.45;
}

/* Favorites selection looks like a button */

.bw-save-favorites-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    min-height: 41px;
    width: 100%;

    padding: 10px 14px;

    background: #fffaf5;
    color: var(--save-red);

    border: 1px solid #d9b8a5;
    border-radius: 9px;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background 150ms ease,
        border-color 150ms ease,
        box-shadow 150ms ease;
}

.bw-save-favorites-row:hover {
    background: #fff0e7;
    border-color: var(--save-red);
}

.bw-save-favorites-row.is-selected {
    background: var(--save-red);
    color: #fff;

    border-color: var(--save-red);

    box-shadow:
        0 3px 8px rgba(169, 52, 45, 0.16);
}

.bw-save-favorites-row input[type="checkbox"] {
    width: 15px;
    height: 15px;

    margin: 0;

    accent-color: var(--save-red);
    cursor: pointer;
}

.bw-save-favorites-row.is-selected input[type="checkbox"] {
    accent-color: #fff;
}

.bw-save-favorites-row .bw-save-cookbook-name {
    color: inherit;
    font-weight: 700;
}

/* ==========================================================
   COOKBOOK SECTION
   ========================================================== */

.bw-save-list-heading {
    margin: 0;
    padding: 0 25px 10px;

    color: var(--save-ink);

    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.1px;
}

.bw-save-list {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;

    min-height: 0;
    max-height: 235px;

    margin: 0 25px;

    overflow-x: hidden;
    overflow-y: auto;

    background: var(--save-paper);

    border: 1px solid var(--save-border);
    border-radius: 11px;

    scrollbar-width: thin;
    scrollbar-color: #d8c6b2 transparent;
}

/* Every cookbook gets its own full-width row */

.bw-save-list > .bw-save-cookbook {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    flex: 0 0 auto;

    width: 100%;
    min-height: 43px;

    margin: 0;
    padding: 10px 14px;

    background: transparent;

    border: 0;
    border-radius: 0;

    cursor: pointer;

    transition: background 140ms ease;
}

/* Subtle separators */

.bw-save-list > .bw-save-cookbook
+ .bw-save-cookbook {
    border-top: 1px solid #f0e8dd;
}

.bw-save-list > .bw-save-cookbook:hover {
    background: #faf1e7;
}

.bw-save-list > .bw-save-cookbook.is-selected {
    background: #fff4eb;
}

/* Cookbook name stays on the left */

.bw-save-list .bw-save-cookbook-name {
    order: 1;
    flex: 1;
    min-width: 0;

    color: #514036;

    font-size: 13px;
    font-weight: 550;
    line-height: 1.4;

    overflow-wrap: anywhere;
}

.bw-save-list .bw-save-cookbook.is-selected
.bw-save-cookbook-name {
    color: #803a2d;
    font-weight: 700;
}

/* Checkbox stays on the right */

.bw-save-list input[type="checkbox"] {
    order: 2;
    flex: 0 0 17px;

    width: 17px;
    height: 17px;

    margin: 0;

    accent-color: var(--save-red);

    cursor: pointer;
}

.bw-save-empty {
    margin: 0;
    padding: 17px 14px;

    color: var(--save-muted);

    font-size: 12px;
    text-align: center;
}

/* ==========================================================
   CREATE COOKBOOK
   ========================================================== */

.bw-save-create {
    margin: 13px 25px 0;
}

.bw-save-create-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    width: 100%;
    min-height: 39px;

    padding: 9px 12px;

    background: transparent;
    color: var(--save-red);

    border: 1px dashed #d9b7a5;
    border-radius: 9px;

    font-size: 12px;
    font-weight: 700;

    transition:
        background 150ms ease,
        border-color 150ms ease;
}

.bw-save-create-toggle:hover {
    background: #fff1e7;
    border-color: var(--save-red);
}

.bw-save-create-toggle[aria-expanded="true"] {
    background: #fff1e7;
    border-style: solid;
}

.bw-save-create-fields {
    margin-top: 11px;
    padding: 12px;

    background: #fffdf9;

    border: 1px solid var(--save-border);
    border-radius: 9px;
}

.bw-save-create-fields[hidden] {
    display: none !important;
}

.bw-save-field-label {
    display: flex;
    flex-direction: column;
    gap: 6px;

    color: var(--save-ink);

    font-size: 12px;
    font-weight: 700;
}

.bw-save-name {
    width: 100%;
    min-height: 39px;

    padding: 9px 11px;

    background: #fff;
    color: var(--save-ink);

    border: 1px solid #dacbbb;
    border-radius: 8px;

    outline: none;

    font-size: 13px;
    font-weight: 400;

    transition:
        border-color 150ms ease,
        box-shadow 150ms ease;
}

.bw-save-name:focus {
    border-color: var(--save-red);

    box-shadow:
        0 0 0 3px rgba(169, 52, 45, 0.1);
}

.bw-save-name::placeholder {
    color: #aa9b8e;
}

.bw-save-hint {
    margin: 7px 0 0;

    color: var(--save-muted);

    font-size: 11px;
    line-height: 1.4;
}

/* ==========================================================
   FOOTER
   ========================================================== */

.bw-save-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;

    flex: 0 0 auto;

    margin-top: 20px;
    padding: 15px 25px 19px;

    background: var(--save-cream);

    border-top: 1px solid #eee2d3;
}

.bw-save-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 40px;

    padding: 10px 17px;

    border-radius: 9px;

    font-size: 12px;
    font-weight: 750;
    line-height: 1.2;

    transition:
        background 150ms ease,
        transform 150ms ease,
        box-shadow 150ms ease;
}

.bw-save-action.secondary {
    background: #fffaf3;
    color: #67564a;

    border: 1px solid #ded0bf;
}

.bw-save-action.secondary:hover {
    background: #f1e7d9;
}

.bw-save-action.primary {
    background: var(--save-red);
    color: #fff;

    border: 1px solid var(--save-red);

    box-shadow:
        0 3px 8px rgba(169, 52, 45, 0.12);
}

.bw-save-action.primary:hover:not(:disabled) {
    background: var(--save-red-dark);
    border-color: var(--save-red-dark);

    transform: translateY(-1px);

    box-shadow:
        0 5px 12px rgba(169, 52, 45, 0.18);
}

/* ==========================================================
   FOCUS
   ========================================================== */

.bw-save-dialog button:focus-visible,
.bw-save-dialog input:focus-visible {
    outline: 2px solid var(--save-red);
    outline-offset: 3px;
}

/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 600px) {

    .bw-save-modal {
        align-items: center;
        padding: 12px;
    }

    .bw-save-dialog {
        max-width: 100%;
        max-height: calc(100dvh - 24px);

        border-radius: 15px;
    }

    .bw-save-header {
        padding: 19px 18px 7px;
    }

    .bw-save-title {
        font-size: 19px;
    }

    .bw-save-description {
        padding: 0 18px;
    }

    .bw-save-help {
        padding: 8px 18px 15px;
    }

    .bw-save-status {
        margin-left: 18px;
        margin-right: 18px;
    }

    .bw-save-favorites {
        margin: 0 18px 18px;
        padding: 13px;
    }

    .bw-save-list-heading {
        padding: 0 18px 9px;
    }

    .bw-save-list {
        margin: 0 18px;
        max-height: min(225px, 27dvh);
    }

    .bw-save-create {
        margin: 12px 18px 0;
    }

    .bw-save-actions {
        margin-top: 16px;
        padding: 13px 18px 16px;
    }

    .bw-save-action {
        flex: 1;
    }
}

/* ==========================================================
   SMALL SCREENS
   ========================================================== */

@media (max-height: 680px) {

    .bw-save-dialog {
        overflow-y: auto;
    }

    .bw-save-list {
        max-height: 160px;
    }

    .bw-save-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
    }
}

/* ==========================================================
   ANIMATIONS
   ========================================================== */

@keyframes bwSaveOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes bwSaveDialogIn {
    from {
        opacity: 0;
        transform: translateY(9px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {

    .bw-save-modal,
    .bw-save-dialog {
        animation: none;
    }

    .bw-save-dialog *,
    .bw-save-dialog *::before,
    .bw-save-dialog *::after {
        transition: none !important;
    }
}
