// Copyright 2020 Thomas Hintz
//
// This file is part of the Alpha Centauri Farming project.
//
// The Alpha Centauri Farming project is free software: you can
// redistribute it and/or modify it under the terms of the GNU General
// Public License as published by the Free Software Foundation, either
// version 3 of the License, or (at your option) any later version.
//
// The Alpha Centauri Farming project is distributed in the hope that
// it will be useful, but WITHOUT ANY WARRANTY; without even the
// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE.  See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Alpha Centauri Farming project.  If not, see
// <https://www.gnu.org/licenses/>.

@import './foundation/foundation';

// Global styles
@include foundation-global-styles;
@include foundation-forms;
@include foundation-typography;

// Grids
@include foundation-xy-grid-classes;

// Generic components
@include foundation-button;
@include foundation-button-group;
@include foundation-close-button;
@include foundation-label;
@include foundation-progress-bar;
// @include foundation-slider;
@include foundation-switch;
@include foundation-table;
// Basic components
@include foundation-badge;
@include foundation-breadcrumbs;
@include foundation-callout;
@include foundation-card;
@include foundation-dropdown;
@include foundation-pagination;
@include foundation-tooltip;

// Containers
// @include foundation-accordion;
// @include foundation-media-object;
// @include foundation-orbit;
// @include foundation-responsive-embed;
// @include foundation-tabs;
// @include foundation-thumbnail;
// Menu-based containers
@include foundation-menu;
@include foundation-menu-icon;
// @include foundation-accordion-menu;
// @include foundation-drilldown-menu;
// @include foundation-dropdown-menu;

// Layout components
// @include foundation-off-canvas;
// @include foundation-reveal;
// @include foundation-sticky;
// @include foundation-title-bar;
// @include foundation-top-bar;

// Helpers
@include foundation-float-classes;
// @include foundation-flex-classes;
@include foundation-visibility-classes;
// @include foundation-prototype-classes;

@include add-foundation-colors;

$color-primary-dark: #49B383;

$color-subdued: #f2f2f2;
$color-light-primary: #2196f3;

$dark-color: #7F3125;
$light-color: #FFA496;
$orange-color: #FF624A;

$tab-margin: 0.3rem;

.tractor {
    opacity: 0.5;
    z-index: -2;
    position: absolute;
    bottom: 0;
    right: 0;
    img {
        @include breakpoint(small only) {
            width: 90vw; }
        width: 90vh; }
}

.tractor.spikes {
    opacity: 1;
    overflow: hidden;
    img {
        animation: spikes 20s linear 2;
        transform-origin: 40% 67.15%; }
}

@keyframes spikes {
    100% { transform:rotate(360deg); }
}

.background-heading {
    z-index: -1;
    position: absolute;
    text-align: center;
    width: 100%;
    top: 0;
    left: 0;
    h1 {
        color: rgba(127, 49, 37, 0.8);
        text-shadow: 1px 4px 6px $secondary-color, 0 0 0 #000, 1px 4px 6px $secondary-color;
        background: url('../assets/img/mars-texture.png');
        background-repeat: repeat-x;
        background-position: 0 0;
        text-transform: uppercase;
        background-clip: text;
        font-smoothing: antialiased;
        text-fill-color: transparent;
        -webkit-text-fill-color: transparent;
        font-weight: bold;
        font-size: 2.5rem; }
}

.flex-fullcenter {
    background: $secondary-color;
    height: 100vh;
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; }

.view-container {
    border: 0.3rem solid $dark-color;
    background: linear-gradient(180deg, $light-color 0%, $orange-color 100%);
    padding: 1rem;
    border-radius: 0.5rem; }

.column {
    padding-right: 0; }

.column-no-padding {
    padding-left: 0; }

.row.full-width {
    max-width: 100%;
    width: 100%; }

.space {
    flex-grow: 1;
    flex-basis: 0;
    padding: 3px;
    background-color: white;
    border: 1px solid black;
    position: relative;
    @include breakpoint(medium down) {
        font-size: 4px; }
    @include breakpoint(large) {
        font-size: 14px; }
}

.space-description {
    display: none; /* TODO re-show for larger screens */
    position: absolute;
    bottom: 3px;
    overflow: hidden;
    max-height: 27px;
    font-size: 4px; }

.game-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh; }

.row-spaces {
    @include breakpoint(small only) {
        height: 2rem; }
    @include breakpoint(landscape) {
        @include breakpoint(medium) {
            height: 2rem; }
        @include breakpoint(large) {
            height: 5rem; }
    }
    @include breakpoint(portrait) {
        @include breakpoint(medium) {
            height: 5rem; }
    }
    .space {
        height: 100%; }
    .flex-row {
        height: 100%; }
}

.mid-row-container {
    flex-grow: 1; }

.action {
    .space {
        font-size: 15px; }

    .space-description {
        display: block;
        max-height: 81px;
        font-size: 14px; }
}

.player {
    display: inline-block;
    @include breakpoint(medium down) {
        height: 7px;
        width: 7px;
        border-radius: 4px; }
    @include breakpoint(large) {
        height: 16px;
        width: 16px;
        border-radius: 12px; }
    margin-top: 4px;
    margin-left: 5px; }

.player-selectable {
    border: 4px solid #ff816e;
    cursor: pointer;
    height: 26px;
    width: 26px; }

.player-selectable:hover {
    border: 4px solid $color-light-primary; }

.player-selectable input[type=checkbox] {
    cursor: pointer;
    opacity: 0; }

.player-selected {
    border: 4px solid $color-light-primary; }

.player-green {
    background-color: green; }
.player-red {
    background-color: red; }
.player-blue {
    background-color: blue; }
.player-yellow {
    background-color: yellow; }
.player-black {
    background-color: black; }
.player-none {
    background-color: #f2f2f2; }

.tab .player {
    height: 27px;
    width: 27px;
    border-radius: 15px;
    margin-right: 0.5rem; }

.player-trade-resources input {
    margin: 0; }

.player-trade-resources .resource-unit {
    width: 4rem; }

.card-id {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.9rem;
}

.flex-row {
    display: flex;
    flex-direction: row; }

.mid-col {
    height: 100%;
    display: flex;
    flex-direction: column; }

.mid-row {
    height: 100%;
    display: flex;
    flex-direction: row; }

.center-board {
    flex-grow: 1;
    flex-basis: 0;
    position: relative;
    z-index: 0;
    background-color: $secondary-color;
    .tractor img {
        opacity: 0.5;
        @include breakpoint(small only) {
            width: 60vw; }
        width: 50vh; }
}

.resource-unit {
    text-align: center;
    margin-right: 0.5rem;
    width: 40px;
    padding: 3px;
    img {
        height: 34px; }
}

.resource-unit-container {
    display: flex;
    flex-direction: row; }

#message-panel {
    display: none;
    position: absolute;
    background: white; }

#message-panel .space {
    width: 160px; }

#message-panel div div .space-description {
    font-size: 16px;
    margin: 0.4rem;
    max-height: 140px; }

#message-panel div div center {
    margin: 0.4rem;
    font-size: 20px;
    font-weight: bold; }

.space-type-hay {
    background-color: hsla(120, 100%, 25%, 0.19); }

.space-type-cherry {
    background-color: hsla(0, 100%, 40%, 0.28); }

.space-type-apple {
    background-color: hsla(0, 100%, 40%, 0.28); }

.space-type-wheat {
    background-color: hsla(50, 97%, 48%, 0.22); }

.space-type-corn {
    background-color: hsla(50, 97%, 48%, 0.22); }

.space-type-cows {
    background-color: hsla(0, 25%, 43%, 0.49); }

.space-title {
    text-align: center;
    font-style: italic; }

.space-orientation-corner-tl {
    border-bottom: 0;
    border-right: 0; }

.space-orientation-corner-tr {
    border-bottom: 0; }

.space-orientation-top {
    border-right: 0; }

.space-orientation-left {
    border-bottom: 0; }

.space-orientation-right {
    border-bottom: 0; }

.space-orientation-bottom {
    border-right: 0; }

.space-orientation-corner-bl {
    border-right: 0; }

.card {
    background: inherit;
    border: 0;
    margin: 0; }

.card p {
    text-align: center;
    margin-bottom: 2px;}

.card-divider {
    padding: 0.5rem 0 0.5rem 0;
    background: none;
    font-weight: bold;
    font-size: 1.5rem; }

.card-action {
    margin-bottom: 0;
    border-top: 1px dashed black;
    padding-top: 0.8rem;
    margin-top: 0.4rem; }

.card-action label {
    margin-bottom: 0; }

.card-action input {
    margin-bottom: 0; }

.card-action button {
    margin-bottom: 0; }

.card-action form {
    margin-bottom: 0; }

.money input[type="number"] {
    float: unset;
    width: 4rem;
    display: unset;
    text-align: right; }

.messages {
    height: 140px;
    overflow: auto;}

.card-select {
    height: 10rem;
    background: white;
    padding: 0.4rem;
    list-style: none inside none;
    margin-left: 0;
    overflow-y: auto;
    border: 1px solid silver; }

.card-select li {
    cursor: pointer; }

.card-select-selected {
    background: #dae0ff; }

.die {
    width: 100px;
    height: 100px;
    background: lightyellow;
    position: relative;
    border-radius: 10px;
    border: 1px solid black; }

.die-selected {
    border: 1px solid red; }

.die-face {
    background: black;
    width: 20px;
    height: 20px;
    border-radius: 20px;
    position: absolute; }

.face-1 {
    top: 40px;
    left: 40px; }

.face-21 {
    top: 15px;
    left: 15px; }

.face-22 {
    top: 62px;
    left: 62px; }

.face-52 {
    top: 15px;
    left: 62px; }

.face-54 {
    top: 62px;
    left: 15px; }

.face-63 {
    top: 40px;
    left: 15px; }

.face-64 {
    top: 40px;
    left: 62px; }

.center {
    text-align: center; }

.menu.icons a {
    padding: 0.5rem 0.7rem; }

@include breakpoint(portrait) {
    .menu.vertical {
        display: none; }

    .menu {
        margin-left: $tab-margin;
        margin-right: $tab-margin; }

}

@include breakpoint(landscape) {
    .menu.horizontal {
        display: none; }

    .menu {
        margin-left: $tab-margin; }

    .center-board > .grid-x {
        height: 100%; }

    .center-board-container {
        display: flex;
        align-items: center;
        height: 100%; }

}

.center-board > .grid-x {
    @include breakpoint(medium down) {
        max-width: 30rem; }
    @include breakpoint(large) {
        font-size: 23px;
        max-width: 45rem; }
    margin-left: auto;
    margin-right: auto; }

.tab-container {
    overflow-y: auto;
    max-height: 80vh;
    flex-grow: 2; }

.tab {
    $tab-border: 0.3rem solid $primary-color;
    @include breakpoint(portrait) {
        margin-left: $tab-margin;
        border-top: $tab-border;
        border-bottom: $tab-border; }
    @include breakpoint(landscape) {
        border-left: $tab-border;
        border-right: $tab-border; }
    margin-right: $tab-margin;
    background: $light-color;
    padding: 0.5rem;
    display: none; }

.tab.show {
    display: block; }

.turn-container {
    position: relative;
    height: 56px;
    padding: 0.5rem;
    width: 100%; }

.turn-container .button {
    margin: 0; }

.board-heading {
    z-index: -1;
    position: absolute;
    opacity: 0.5;
    text-align: center;
    width: 100%;
    bottom: 0;
    h1 {
        color: rgba(127, 49, 37, 0.8);
        text-shadow: 1px 4px 6px $secondary-color, 0 0 0 #000, 1px 4px 6px $secondary-color;
        background: url('../assets/img/mars-texture.png');
        background-repeat: repeat-x;
        background-position: 0 0;
        text-transform: uppercase;
        background-clip: text;
        font-smoothing: antialiased;
        text-fill-color: transparent;
        -webkit-text-fill-color: transparent;
        font-weight: bold;
        font-size: 1rem; }
}

.game-card {
    padding: 0.3rem;
    background: rgba(255, 255, 224, 0.5);
    z-index: 1;
    border: 0.15rem solid $primary-color;
    position: relative; }

.game-card::after {
    background: url('../assets/img/mars-texture.png') repeat;
    content: '';
    width: 100%;
    height: 100%;
    opacity: 0.3;
    z-index: -1;
    position: absolute;
    top: 0;
    left: 0; }

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

.green svg {
    color: green; }

.red svg {
    color: red; }

.spacer {
    margin-top: 1rem; }

.clear-background {
    background: white; }

.harvest-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3rem;
    border: 0.15rem solid $primary-color;
    h1 {
        font-weight: bold;
        text-transform: uppercase; }
    button {
        margin-top: 1rem; }
    img {
        @include breakpoint(medium down) {
            width: 20%; }
        @include breakpoint(large) {
            width: 30%; }
    }
    .harvest-card-contents {
        width: 100%; }
}

.alert-overlay {
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    width: 100vw;
    height: 100vh;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; }

.alert-overlay.hidden {
    display: none; }

.alert-overlay-hide {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: white; }

.alert-overlay-contents {
    background: $light-color;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; }

.moving {
    display: flex;
    justify-content: center;
    .action {
        @include breakpoint(small only) {
            width: 100%; }
        @include breakpoint(medium) {
            width: 15rem; }
    }
}

.button.shadow {
    box-shadow: 0 0 4px black; }

$intro-time: 12s;
.intro-text {
    opacity: 0;
    height: 50vh;
    width: 90vw;
    max-width: 30rem;
    font-size: 1.4rem;
    text-shadow: 1px 1px 0px black;
    margin-top: 1rem;
    margin-bottom: 1rem;
    animation-delay: 1s;
    animation: intro-fade $intro-time forwards;
    .game-card {
        border: 0.15rem solid black; }
}

@keyframes intro-fade {
    0% {
        opacity: 0; }
    10% {
        opacity: 1; }
    90% {
        height: 50vh;
        opacity: 1 }
    100% {
        height: 0;
        opacity: 0 }
}

.button.intro {
    opacity: 0.8;
    animation: button-fade 2s forwards;
    animation-delay: $intro-time - 1; }

@keyframes button-fade {
    0% {
        opacity: 0.8; }
   100% {
        opacity: 1; }
}

.tractor.intro {
    opacity: 0.4;
    animation: tractor-fade 2s forwards;
    animation-delay: $intro-time - 1; }

@keyframes tractor-fade {
    0% {
        opacity: 0.4; }
   100% {
        opacity: 0.8; }
}

.credits img {
    height: 34px; }