@import "foundation/base", "foundation/components/grid", "foundation/components/type", "foundation/components/forms";

.entry-quick-actions .secondary-actions {
    text-align: left;
}

.no-js button.postfix.fi-icon--with-fallback {
    padding: 0 0.75em;
    font-size: 1em;
}

@media #{$medium-up} {
    .components {
        padding: 0 .45rem;
    }

    .second-column, .third-column {
        float: left;
        width: grid-calc(6, 12);
    }

    .entry-quick-actions .secondary-actions {
        text-align: right;
    }
}

@media #{$large-up} {
    .entry-full-width {
        .first-column, .second-column, .third-column {
            float: left;
            width: grid-calc(4, 12);
        }
    }

    .entry-partial-width {
        .current-entry {
            float: left;
            margin-right: $column-gutter / 2;
            width: grid-calc(8, 12);

            & > .columns {
                padding-right: 0;
            }
        }

        .first-column {
            float: left;
            width: grid-calc(4, 12);
        }
        .second-column, .third-column {
            float: left;
            width: grid-calc(6, 12);
        }
    }
}

.js .js-only.components {
    display: none;
}

.community-administration {
    clear: both;

    #canvas & h2 { // exclude from Lynx skin
        font-size: 1.2rem;
    }
}

.entry-quick-actions {
    label {
        @include element-invisible();
    }
    ul {
        margin-bottom: 0;
        padding: 0;
    }
    li {
        display: inline-block;
        margin-left: 0;
    }

    input, select, output, button {
        margin-right: $form-spacing; // Lynx skin only, overridden below.
        margin-bottom: $form-spacing;
    }
}

// pixel-pushing to arrange fancy-selects *just so.*
// only relevant on non-Lynx skins.
#canvas .entry-quick-actions {
    $entry-quick-action-height: ($input-font-size + ($form-spacing * 1.5) - rem-calc(1));

    input, select, output, button {
        margin-right: 0;
        vertical-align: top;
    }

    li {
        input, .button {
            border-radius: 0;
        }

        &:first-of-type input {
            border-top-left-radius: $global-radius;
            border-bottom-left-radius: $global-radius;
        }
        &:last-of-type input, &:last-of-type .button {
            border-top-right-radius: $global-radius !important;
            border-bottom-right-radius: $global-radius !important;
        }
    }
    input[type=text] {
        display: inline-block;

        // force alignment to buttons
        padding-top: $button-med - rem-calc(1);
        position: relative;
        top: 2px;
        border-radius: 0;
    }
    .usejournal-text {
        padding-left: 0.2rem;
        display: inline-block;
    }

    li + li {
        input, button, .fancy-select-output {
            margin-left: -1px;
        }
    }

    select {
        position: relative;
        top: -2px;
    }

    input, .fancy-select-output, select, button, .usejournal-text {
        height: $entry-quick-action-height;
    }

    .usejournal-text {
        line-height: $entry-quick-action-height;
    }
}

.flexbox {
    .entry-quick-actions {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        justify-content: space-between;
        flex-wrap: wrap;

        .entry-quick-metadata, .secondary-actions {
            display: flex;
            flex-grow: 1;
            align-items: flex-start;
            & > li {
                margin-bottom: 0;
            }
        }
        .entry-quick-metadata {
            justify-content: flex-start;
            flex-wrap: wrap;

            // There's a text field if no one's logged in; this aligns it.
            input[type=text] {
                top: 0;
            }
            @media #{$small-only} {
                width: 100%;
                li:last-of-type {
                    width: 100%;
                    .fancy-select {
                        width: 100%;
                    }
                    #canvas & .fancy-select-output { // non-Lynx
                        border-radius: $global-radius; // on own line.
                    }
                }
            }
        }
        .secondary-actions {
            justify-content: flex-end;
        }
    }
}

#canvas .current-entry textarea {
    font-family: monospace;
    font-size: 16px;
}

.current-entry {
    input[type="text"], textarea {
        width: 100%;
        @media (pointer: coarse) {
            // dramatic woodchuck deterrent for mobile, still relevant on Lynx
            font-size: 16px;
        }
    }
}

.markup-container {
    display: flex;
    align-items: center;

    img { // help icon
        margin-bottom: 1rem;
        margin-left: 1rem;
        vertical-align: middle;
    }

    & > * {
        display: inline-block;
        width: auto;
    }

    select#editor {
        flex-grow: 1;
    }
}

.inactive-component {
    display: none;
}

.component {
    padding: 0;

    input, select, textarea {
        #canvas & { // exclude from Lynx skin
            @media (pointer: fine) { // Desktop only, don't attract woodchucks.
                font-size: .8rem;
            }
        }
    }

    h3 {
        margin-top: .2rem; // come closer to the "minus" icon
    }

    &.collapse-collapsed {
        h3 {
           margin-bottom: 0;
           @include single-transition(margin-bottom);
        }
    }

    #canvas &.collapse-expanded { // exclude from Lynx skin
        // .last-visible handles the case when we have invisible elements
        // that are only meant to be revealed by js
        .row:last-child .columns >, .last-visible {
            label input, input, select, button {
                margin-bottom: 0;
            }
        }
    }

    ul {
      list-style-type:none;
      margin: 0;
      padding: 0;
    }

    fieldset {
        padding: .75rem;
    }

    fieldset fieldset {
        padding: 0;
        margin: 0;
    }

    a {
        text-decoration: none;
    }
}

#canvas .component { // Styles to exclude from the Lynx site skin
    font-size: .8rem;

    h3 {
        font-size: 1rem;
    }

    p, label, legend, ul {
        font-size: .8rem;
    }

    input[type=text], input[type=password], select {
        height: 2.2em;
        padding: .4em;
    }

    button { // match sizes of nearby inputs
        @media (pointer: fine) {
            font-size: .8rem;
        }
    }

    .postfix {
        height: 2.2em;
        line-height: 2.2em;
    }
}

.component, .reveal-modal {
    // so that when it wraps it still stays beside the radio/checkbox
    // instead of having the entire label go to the next line
    input[type="checkbox"] + label,
    input[type="radio"] + label {
        display: inline;
    }
}

/* Currents */
.moodpreview {
    text-align: center;

    .moodpreview-image {
        height: auto !important; // avoid distortion if we constrained image width
    }
}

/* Access */
.custom-groups ul {
    -moz-column-width: 12em;
    -webkit-column-width: 12em;
    column-width: 12em;
}

/* Icons */

.icons-component {
    .icon {
        text-align: center;
        margin-bottom: $paragraph-margin-bottom;
    }

    #canvas & .inner .button { // exclude from Lynx skin
        width: 100%;
    }

    .js-only {
        display: none;
    }

}

/* Slug */
.slug-base {
    word-break: break-all;
}

/* Date */

.displaydate-component {
    .picker-output {
        margin-top: -1 * rem-calc(20); // $form-spacing + 2px for borders
    }
    .picker--time {
        // column-gutter: 15
        // component padding: 20
        right: rem-calc(15+20);
    }

    #canvas & { // exclude from Lynx skin
        .columns:nth-child(2) .postfix {
            border-radius: 0;
        }

        .columns:nth-child(3) input {
            border-left: none;
        }
    }
}

/* elements in modals */
// remove extra padding here since the modal has its own padding
.reveal-modal fieldset, .reveal-modal fieldset .columns {
    padding: 0;
}

/* toolbar (temp) */
@-moz-keyframes rotate { 100% { -moz-transform: rotate(90deg); } }
@-webkit-keyframes rotate { 100% { -webkit-transform: rotate(90deg); } }
@keyframes rotate { 100% { transform: rotate(90deg); } }
.toolbar-container {
    .panel {
        margin-bottom: 0;
        border-bottom: 0;
    }
}

#js-settings-panel {
    display: none;

    label {
        display: block;
    }

    fieldset {
        margin: 0;
        padding: 0;
    }

    .row:last-child input {
        margin-bottom: 0;
    }
}

.toolbar {
    padding-bottom: 0.2em;
    padding-top: 0.2em;
    border-bottom: none;
    text-align: right;

    & > * {
        display: inline-block;
        margin-left: 1.25rem;
    }

    a {
        text-decoration: none;

        &.spinner {
            .fi-icon {
                -webkit-animation:rotate 2s linear infinite;
                 -moz-animation:rotate 2s linear infinite;
                 animation:rotate 2s linear infinite;
            }
        }
    }
}
