/* stocking.css - Stuff-A-Stocking styling, layered on site.css */

/*** Theme ***
 *
 * These were edits to stuffastocking's copy of toto.css. They now
 * override the shared site.css instead.
 */

:root {
    --main-page-color: white;
    --accent-color: #c04040;
    --shadow-color: #d0d0d0;
    --deleted-color: #e0e0e0;
    --text-color: black;
    --link-color: blue;
    --font-family: Roboto,Helvetica,sans-serif;
    --main-page-text-color: black;

    --second-highlight-color: green;

    --default-shadow: 3px 1px 1px rgba(0,0,0,0.2);
}

body {
    font-family: var(--font-family);

    background-color: var(--main-page-color);
    color: var(--text-color);
}

.dialog-background {
    z-index: 9;
}

dialog h4 {
    margin: 0px 0px 4px 0px;
}

dialog h4:not(:first-child) {
    margin-top: 8px;
}

.header {
    color: var(--main-page-text-color);

    background-color: var(--main-page-color);
    border-bottom: 1px solid var(--accent-color);
}

A {
    color: var(--link-color);
}

A:visited {
    color: var(--link-color);
}

/*** Global font selection and page layout ***/

.stocking-background {
    background-image: url(/resource/christmas-stocking.svg);
    background-size: 64px;
    background-position-x: -20px;
    background-position-y: -20px;
    background-blend-mode: darken;
}

@media only screen and (min-width : 640px) {
    dialog {
        width: auto;
        max-width: 60%;
    }
}

dialog form {
    padding: 0px;
}


dialog .modal-controls .length-indicator {
    flex: 1;
}

dialog .modal-controls .length-indicator .over-limit {
    color: #c00000;
    font-weight: bold;
}

dialog p {
    padding-bottom: 12px;
}

dialog .list-owner {
    display: flex;
    padding: 0px 0px 8px 0px;
}

dialog .list-owner input {
    margin: 0px;
}

dialog .list-owner input[type=text] {
    flex: 1;
}

/* The current user has no checkbox, so a .self-owner spacer takes its
   place. Both are the same fixed width so the names line up. */
dialog .list-owner input[type=checkbox],
dialog .list-owner .self-owner {
    display: inline-block;
    flex: none;
    width: 32px;
}

/* Send Stocking's "Text This Stocking" button. Sized like the
   modal's other buttons, but lighter, since it isn't the form's
   submit. */
dialog .text-stocking {
    padding: 4px 0px;
}

dialog .text-stocking input[type=button] {
    padding: 0.5em 1em;
    background: #f0f0f0;
    border: 1px solid #c0c0c0;
    border-radius: 0px;
    cursor: pointer;
}

dialog .text-stocking input[type=button]:hover {
    background: #e0e0e0;
}

/* The recipient link with its Copy Link button (ectcommon's
   copyable-text): the field takes the room, the button stays on one
   line, and both line up with the button above. */
dialog .copyable-text input {
    flex: 1;
    min-width: 0;
    margin: 4px 6px 4px 0px;
}

dialog .copyable-text .clickable {
    white-space: nowrap;
    cursor: pointer;
}

dialog .stocking-select-list {
    max-height: 40vh;
    overflow-y: auto;
}

dialog .stocking-select {
    display: flex;
    align-items: baseline;
    padding: 0px 0px 8px 0px;
}

dialog .stocking-select input[type=checkbox] {
    flex: none;
    width: 32px;
    margin: 0px;
}

dialog .stocking-select .stocking-select-name {
    font-weight: bold;
}

/* Plain (non-submit) buttons in a modal, e.g. Cancel. Sized like the
   site's submit buttons, but lighter, since they're the secondary
   action. */
dialog .modal-controls input[type=button] {
    padding: 0.5em 1em;
    background: #f0f0f0;
    border: 1px solid #c0c0c0;
    border-radius: 0px;
    cursor: pointer;
}

dialog .modal-controls input[type=button]:hover {
    background: #e0e0e0;
}

.contents {
    flex: 1;

    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0px 8px 0px 8px;

    display: flex;
    flex-direction: column;
}

@media only screen and (max-width : 640px) {
    .contents {
        margin-bottom: 30px;
    }
}

.contents::-webkit-scrollbar {
    display: none;
}


.toolbar {
    margin: 6px 0px 6px 0px;
    padding: 6px;

    right: 0px;

    text-align: center;

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

.toolbar A {
    display: inline-flex;
    padding-right: 10px;
    min-height: 40px;
    align-items: center;
    border: 1px solid var(--accent-color);
    color: var(--text-color);
    background-color: var(--main-page-color);
    padding: 6px;
    margin: 4px;
}


/*** Toplevel list styling ***/

.toplevel-list {
    width: 100%;
    box-sizing: border-box;

    flex-wrap: wrap;
    display: flex;
}

.toplevel-list .list-view-section:not(:first-child) {
    border-top: 1px solid #f0f0f0;
    padding-top: 16px;
}

.toplevel-list h2 {
    margin: 0px;
    padding: 0px;
    padding-left: 12px;

    font-size: 14px;
}

.toplevel-list .list-view-section h2 .other-item-count {
    font-weight: normal;
    font-style: italic;
}

.toplevel-list h2:not(:first-child) {
    padding-top: 18px;
}

.toplevel-list h2 A {
    color: black;
}

@media only screen and (min-width : 640px) {
    .toplevel-list {
        padding-left: 0px;
        padding-right: 0px;
    }
}

.order-drop-target.drop-hover {
    background: #d0d0d0;
}

/* Pill common component */


.stocking-editor-header {
    display: flex;
    flex-direction: column;
}

.stocking-editor-header h2 {
    margin: 0px;
}

.stocking-editor-header{
    flex: 1;
    margin-top: 16px;
    margin-bottom: 16px;
}

/* Editor header (render-stocking-editor-header in stocking.clj): a
   row with the back link and the page's actions, then a row with
   From on the left, the stocking's name centered, and To on the
   right. */

.stocking-editor-header .back-link {
    color: var(--text-color);
    white-space: nowrap;
}

.stocking-editor-header .back-link .fa {
    margin-right: 4px;
}

.stocking-title-row A {
    display: block;
    color: var(--text-color);
}

/* Equal outer columns keep the name centered whatever the lengths of
   From and To. */
.stocking-title-fields {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "from title to";
    align-items: baseline;
    column-gap: 12px;
    padding: 6px;
}

.stocking-title-row A .stocking-title-fields:hover {
    background-color: #f0f0f0;
}

.stocking-title-fields .from {
    grid-area: from;
    justify-self: start;
}

.stocking-title-fields .stocking-title {
    grid-area: title;
    justify-self: center;
    text-align: center;
    font-weight: bold;
}

.stocking-title-fields .to {
    grid-area: to;
    justify-self: end;
    text-align: right;
}

.stocking-title-fields > div {
    min-width: 0;
    overflow-wrap: anywhere;
}

.stocking-title-fields .name-info label {
    font-weight: bold;
    margin-right: 4px;
}

/* No room for three across: the name above, From and To below it. */
@media only screen and (max-width : 640px) {
    .stocking-title-fields {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "title title"
            "from to";
        row-gap: 4px;
    }
}

.stocking-list-header {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.header-row {
    display: flex;
    flex: 1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.header-row h2 a {
    color: var(--text-color);
}

.header-row h2 a .fa {
    margin-right: 4px;
}

.editing .right {
    display: none;
}

/*** Page toolbar and menu (render-page-toolbar and render-page-menu
     in common.clj) ***/

.page-toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    align-self: flex-start;
    margin: 6px 0px 6px 6px;
}

.page-toolbar > A {
    padding: 8px 10px;
    white-space: nowrap;
    color: var(--text-color);
}

.page-toolbar > A:hover {
    background-color: #e0e0e0;
}

.page-toolbar .page-menu {
    margin: 0px;
}

.page-menu {
    position: relative;
    align-self: flex-start;
    margin: 6px 0px 6px 6px;
}

.page-menu > summary {
    list-style: none;
    cursor: pointer;
    padding: 8px 10px;
    color: var(--text-color);
}

.page-menu > summary::-webkit-details-marker {
    display: none;
}

.page-menu-items {
    position: absolute;
    right: 0px;
    top: 100%;
    z-index: 5;

    display: flex;
    flex-direction: column;
    min-width: 200px;
    margin-top: 2px;

    border: 1px solid var(--accent-color);
    background-color: var(--main-page-color);
    box-shadow: var(--default-shadow);
}

.page-menu-items A {
    padding: 10px 14px;
    white-space: nowrap;
    color: var(--text-color);
}

.page-menu-items A:hover {
    background-color: #e0e0e0;
}

.page-banner {
    flex: 1;
    text-align: center;

    margin: 4px;
    padding: 8px;

    background-color: var(--deleted-color);
}

.page-banner.preview {
    background-color: #fff3c4;
}

.page-banner.opened {
    background-color: #e3f2e3;
}

/* render-opened-check (common.clj): on stocking tiles and in the
   Print Gift Cards list. */
.opened-check {
    margin-left: 6px;
    color: green;
}

.list-tile {
    display: flex;
    flex-direction: row;
    align-items: center;

    border: 1px solid var(--accent-color);
    width: 160px;
    height: 120px;

    white-space: nowrap;

    padding: 0px;

    margin: 0px 15px 15px 0px;
    box-shadow: var(--default-shadow);

    display: inline-flex;
    flex-direction: column;
    white-space: pre-wrap;

    background-color: var(--main-page-color);
}

.list-tile.deleted {
    background-color: #e0e0e0;
    border-color: var(--shadow-color);
}

.list-tile.control-tile {
    border: 1px dashed var(--accent-color);
    box-shadow: none;
    background-color: white;
}

.list-tile.control-tile A {
    background-color: transparent;
    color: var(--accent-color);
    font-size: 20px;
    font-weight: bold;
    text-align: center;
}

@media only screen and (min-width : 640px) {
    .item-row {
        padding-bottom: 4px;
    }
}

.list-tile A {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-around;

    color: var(--main-page-text-color);
    margin: 1px;
    padding: 6px;

    box-sizing: border-box;
    width: 100%;
}

.list-tile .tile-contents label {
    font-weight: bold;
}

.list-tile .tile-contents h3 {
    text-align: center;
    margin: 2px;
}

.list-tile .tile-contents A {
    color: var(--main-page-color);
}

.list-tile .tile-contents:hover {
    background: #e0e0e0;
}

.list-tile .tile-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;

    padding: 6px 2px 2px 2px;

    box-sizing: border-box;
    width: 100%;
}

.list-tile .drag-handle,
.list-tile .drag-handle-placeholder {
    width: 25px;
    min-width: 25px;
}

@media only screen and (min-width : 640px) {
    .list-tile .drag-handle,
    .list-tile .drag-handle-placeholder {
        padding: 3px 6px 3px 3px;
        font-size: inherit;
    }
}


.item-description-editor {
    display: flex;
    flex-direction: row;
}

.item-description-editor textarea {
    flex: 1;
}

.item-description-editor .item-preview {
    width: 50%;
    flex: 1;
    margin: 2px;
    padding: 2px;

    overflow-x: hidden;
}

.item-description-editor .item-preview img {
    max-width: 80%;
    display: block;
    margin: auto;
}

@media only screen and (max-device-width : 640px) {
    .item-description-editor .item-preview {
        display: none;
    }
}

.item-description-editor .item-preview p:first-child {
    margin-top: 0px;
}

/*** List Configuration Controls ***/

.stocking-item .description {
    padding: 20px;
    border: 1px solid gren
}

.stocking-item .controls .nav-link {
    width: 200px;
    display: inline-block;
    padding: 20px;
}

.stocking-item .gift-block {
    display: flex;
    flex-direction: column;

    margin: 20px 60px 20px 60px;
    background-color: white;
    height: 70vh;
    color: var(--main-page-text-color);

    border: 8px solid var(--second-highlight-color);

    box-shadow: 3px 2px 2px var(--shadow-color);
}

.stocking-item .gift-block img {
    max-width: 80%;
    display: block;
    margin: auto;
}

.config-panel .scroll-column {
    max-height: 40vh;
}

.stocking-item .stocking-names {
    display: flex;
    flex-direction: row;
}

.stocking-item .stocking-names label {
    font-weight: bold;
    margin-right: 4px;
}

.stocking-item .stocking-names {
    justify-content: center;
    font-size: 16px;
}

.stocking-item .stocking-names .name-info:not(:first-child) {
    margin-left: 20px;
}

.gift-block A {
    color: var(--main-page-text-color);
}

/* "Open This Gift!" is a form (it can record an opening), styled to
   match the plain navigation links beside it. */
.gift-block form.open-gift {
    display: inline;
    margin: 0;
}

/* Undo the browser's native button look entirely, so this renders
   like the links next to it (site.css: no underline; .gift-block A:
   the page text color). */
.gift-block .nav-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
    font: inherit;
    line-height: inherit;
    text-align: inherit;
    color: var(--main-page-text-color);
    text-decoration: none;
    cursor: pointer;
}

@media only screen and (max-device-width : 640px) {
    .stocking-item .gift-block {
        margin: 20px 20px 20px 20px;
    }
}

.stocking-item .gift-block .details {
    display: flex;
    flex-direction: column;
    flex: 1;

    height: 60vh;
    max-height: 60vh;

    border: 1px solid purple;
    overflow: auto;
    word-break: break-word;
}

.stocking-item .gift-block .details A {
    color: blue;
}

.stocking-item .gift-block .details A:visited {
    color: purple;
}

.stocking-item .gift-block .details.hidden {
    font-size: 120px;

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

/* A few generated packages under the landing page's text
   (resources/pages/landing-page.md), largest in the middle. */
.landing-packages {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 8px;
}

.landing-packages img {
    width: 96px;
    height: auto;
}

.landing-packages img:nth-child(2) {
    width: 128px;
}

/* The wrapped gift: an inline SVG from stocking.package. */
.stocking-item .gift-block .details.hidden svg.package {
    display: block;
    width: min(80%, 50vh);
    height: auto;
}

/* A wrapped gift that can be opened is a button (it submits the
   "Open This Gift!" form). It should look exactly like the plain
   package: no button look, focus ring, tap highlight or hover effect
   from any browser. */
.stocking-item .gift-block .package-button {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    outline: none;
    background: none;
    box-shadow: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.stocking-item .gift-block .package-button::-moz-focus-inner {
    border: 0;
    padding: 0;
}

.stocking-item .gift-block .details .description {
    flex: 1;
    padding: 20px;
}

.stocking-item .gift-block .details h2 {
    text-align: center;
}

.stocking-item .controls {
    flex: 0;
    display: flex;
    justify-content: space-evenly;
    color: var(--main-page-color);

    border-top: 4px solid var(--second-highlight-color);
}

.stocking-item .controls .nav-link {
    width: 200px;
    display: inline-block;
    padding: 20px;
    text-align: center;
    color: var(--text-color);
}

.stocking-item h1 {
    text-align: center;
}

.list-heading {
    padding: 12px;
    width: 100%;
    background: white;
}

.list-heading h1 {
    text-align: center;
    margin: 0px;
    width: 100%;
    padding-bottom: 20px;
}
