@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");

:root {
    --color-primary: #64748b; /* Slate-500: muted blue-gray */
    --color-primary-light: #94a3b8;
    --color-primary-dark: #475569;

    --color-secondary: #a3a3c2; /* Muted purple */
    --color-secondary-light: #c7c7db;
    --color-secondary-dark: #7878a0;

    /* Neutrals */
    --color-background: #f3f4f6; /* Gray-100: soft */
    --color-surface: #e5e7eb; /* Gray-200 */
    --color-border: #d1d5db;
    --color-text: #374151; /* Gray-700 */
    --color-text-light: #6b7280; /* Gray-500 */

    /* Muted Status */
    --color-success: #6fbf73; /* Muted green */
    --color-warning: #eab308; /* Muted gold */
    --color-error: #f87171; /* Muted soft red */

    /* Dark Mode (muted) */
    --color-background-dark: #23272f;
    --color-surface-dark: #2d333b;
    --color-text-dark: #d1d5db;
    --color-border-dark: #374151;
    --active: #fff;
    --inactive: #fff;
    --button: #fefae0;
    --text: var(--color-text);
    --text2: var(--color-text-light);
    --border-radius: 20px;
    --font-family: "Montserrat", sans-serif;
}

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

input,
border,
textarea {
    font: inherit;
}

body {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    background-color: var(--color-background);
    color: var(--text2);
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.6;
}

a {
    color: var(--text);
    text-decoration: none;
    &:visited {
        text-decoration: none;
    }
}

a[role="button"],
button {
    border-radius: 6px;
    color: var(--text);
    height: 2rem;
    border: 1px solid var(--color-border);
    padding: 0 0.75rem;
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    gap: 8px;
}

a[role="button"]:hover,
button:hover {
    cursor: pointer;
}

nav {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    margin: 1rem 0;

    span {
        display: block;
        white-space: nowrap;
    }

    @media (max-width: 600px) {
        span {
            display: none;
        }
    }
}

.nav-actions {
    display: inline-flex;

    align-items: center;
    gap: 8px;
}

/* .shadow { */
/*     box-shadow: 0.1rem 0.1rem 0.3rem var(--text); */
/* } */

h1 {
    margin: 0;
    display: inline;
    color: var(--text);
    font-size: 1.4rem;
    font-weight: 500;

    &:hover {
        font-weight: 700;
    }
}

h3 {
    color: var(--text2);
    font-weight: 500;
}

p {
    color: var(--text);
    word-break: break-all;
}

.additional-options-open-button {
    width: 2rem;
    padding: 0 0.2rem;
    font-size: 0.5rem;

    &:hover {
        font-weight: 700;
    }
}

#wishlist-items {
    display: flex;
    flex-flow: column;
    gap: 1rem;
    margin-top: 1rem;
}

.wishlist-add-button {
    width: 100%;
    color: var(--text);
    border: none;
}

@media (min-width: 600px) {
    body {
        font-size: 100%;
    }
    h1 {
        font-size: 2rem;
    }
    .wishlist-items {
        flex-flow: row;
        flex-wrap: wrap;
    }

    .wishlist-item {
        width: 45%;
        flex-grow: 1;
    }
}

.wishlist-item {
    border-radius: var(--border-radius);
    width: 100%;
    display: grid;
    background-color: var(--active);
    border: none;

    &.inactive {
        background-color: var(--inactive);
    }

    &.reserved {
        background-color: var(--inactive);
    }
    &.htmx-swapping {
        opacity: 0;
        transition: opacity 1s ease-out;
    }
}

.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.recipient {
    text-align: left;
    font-style: italic;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-body {
    margin-top: 0.5rem;
    padding: 0 0.5rem;
    background-color: var(--color2);
    h2 {
        margin: 0;
        color: var(--text2);
        flex-grow: 1;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.card-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;

    & > * {
        text-align: center;
        width: 100%;
    }

    .price {
        text-align: right;
    }
}

.price {
    font-size: 1.2rem;
}

.recipient {
    text-align: center;
    display: inline-block;
}

#delete-dialog {
    border-radius: var(--border-radius);
    margin: 1rem auto;
    background-color: var(--active);
    color: var(--text2);
    border: 1px solid var(--color-border);

    & .dialog-buttons {
        display: flex;
        gap: 8px;
        justify-content: space-evenly;
    }
}

.wishlist-form {
    border-radius: var(--border-radius);
    max-width: 100%;
    min-width: 300px;
    display: grid;
    padding: 0 3rem 2rem 3rem;
    background-color: var(--active);

    h2 {
        display: inline-flex;
        color: var(--text2);
    }

    .close-button {
        float: right;
    }

    label {
        align-items: center;
        color: var(--text2);
        width: 8rem;
        margin-bottom: 0.5rem;
    }

    input {
        border: 1px solid var(--color-border);
        border-radius: 6px;
        flex-grow: 1;
        min-width: 0;
    }

    .dropdown-section {
        display: flex;
        justify-content: space-between;
    }
}
.auth-button {
    margin-left: 1rem;
    width: 6rem;
    height: 2rem;

    border: none;
    color: var(--text);
    text-decoration: none;
    background-color: var(--button);
    text-align: center;

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

.editor-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.form-row {
    display: grid;
    margin-bottom: 0.5rem;

    .labeled-input {
        grid-column: 1 / 3;
    }

    em {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }
}

.labeled-input {
    display: flex;
    align-items: baseline;
    width: 100%;
    margin-top: 1rem;

    input {
        float: right;
        min-width: 0;
    }

    @media (max-width: 500px) {
        flex-direction: column;
        align-items: stretch;
    }
}

.reserved-checkbox {
    display: flex;
    align-items: center;
}

.links {
    padding-left: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;

    a {
        color: var(--text);
    }

    a:visited {
        color: var(--text);
    }

    a:hover {
        font-weight: 700;
    }
}

.links-form {
    width: 100%;
    padding-left: 2rem;

    input {
        margin: 0.25rem;
    }
}

li {
    list-style-type: none;
    display: flex;
    margin-bottom: 0.5rem;
}

.error-message {
    flex: 1;
    color: var(--red);
}

.dropdown-menu {
    background: var(--active);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);

    /* Reset default popover style*/
    position: absolute;
    margin: 0;
    inset: unset;

    &:popover-open {
        /* Not working in firefox */
        top: anchor(bottom);
        right: anchor(right);

        display: flex;
        flex-direction: column;
        width: 100px;
    }
}

.dropdown-item > button,
.dropdown-item {
    background: none;
    border: none;
    /* width: 100%; */
    text-align: center;
    cursor: pointer;
    font: inherit;
    margin: auto;

    &:hover {
        background: var(--button);
    }
}

.delete-item {
    color: var(--red);
}

.reserved-label {
    color: var(--red);
}

.wishlist-price {
    display: flex;
    flex-flow: row wrap;

    em {
        order: 3;
        flex-basis: 100%;
    }

    input {
        border-radius: 6px 0 0 6px;
    }
}

select {
    border: 1px solid var(--color-border);
    border-radius: 0 10px 10px 0;
    background: var(--active);
    width: 50px;
    align-self: stretch;
}

.disclaimer {
    color: var(--text);
    text-wrap: pretty;
    word-break: keep-all;
}

.loader {
    display: none;
}

.error-container {
    text-align: center;
    padding: 3rem 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.error-icon {
    font-size: 4rem;
    color: var(--red);
    margin-bottom: 1.5rem;
}

.error-title {
    color: #333;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.error-actions {
    margin-bottom: 2rem;
}

.error-details {
    font-size: 0.875rem;
    color: #999;
    margin-top: 2rem;
}
