/*
 * Reldens - Administration Panel
 */

$normalFont: Verdana, Geneva, sans-serif;
$reldensFont: "Play", sans-serif;
$bold: 600;
$black: #000000;
$white: #ffffff;
$red: #ff0000;
$orange: #d38200;
$darkGrey: #333333;
$grey: #7f8c8d;
$lightGrey: #ecf0f1;
$lightGrey2: #f9f9f9;
$lightBlue: #3498db;
$darkBlue: #34495e;
$green: #05c459;
$darkGreen: #27ae60;

.reldens-admin-panel {
    font-family: $normalFont;
    background-color: $lightGrey;
    margin: 0;
    padding: 0;
    font-size: 12px;

    .wrapper {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    .notification {
        display: none;
        position: absolute;
        top: 1.5rem;
        right: 0;
        padding: 1rem 5rem 1rem 2rem;
        border-radius: 8px 0 0 8px;
        font-size: 14px;

        &.success, &.error {
            display: block;
        }

        &.error {
            background-color: $red;
            color: $white;
        }

        &.success {
            background-color: $darkGreen;
            color: $white;
        }

        .close {
            position: absolute;
            top: 1rem;
            right: 1rem;
            cursor: pointer;
            font-weight: $bold;
        }
    }

    .header {
        background-color: $darkGrey;
        padding: 1.5rem;
        text-align: center;

        .title a {
            color: $white;
            text-decoration: none;
            font-size: 24px;
            font-weight: $bold;
            font-family: $reldensFont;
        }
    }

    .content {
        display: flex;
        position: relative;
    }

    .button {

        padding: 0.5rem 1rem;
        border: none;
        border-radius: 4px;
        font-size: 14px;
        cursor: pointer;
        text-decoration: none;

        &-primary {
            color: $white;
            background-color: $lightBlue;

            &:hover {
                background-color: $lightBlue;
            }
        }

        &-secondary {
            color: $white;
            background-color: $grey;

            &:hover {
                background-color: $grey;
            }
        }

        &-warning {
            color: $white;
            background-color: $orange;

            &:hover {
                background-color: $orange;
            }
        }

        &-danger {
            color: $white;
            background-color: $red;

            &:hover {
                background-color: $red;
            }
        }

        &:disabled {
            background-color: $grey !important;
        }
    }

    .response-error {
        color: $red;
        font-weight: $bold;
    }

    .side-bar {
        min-width: 230px;
        padding: 1.4rem;
        background-color: $darkBlue;
        color: $lightGrey;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .with-sub-items {
        &.active {
            .side-bar-item {
                display: block;

                &:first-of-type {
                    margin-top: 1rem;
                }

                &.active {
                    a {
                        border-left: 3px solid $white;
                    }
                }
            }
        }

        .side-bar-item {
            display: none;

            a {
                display: block;
                color: $lightGrey;
                text-decoration: none;
                border-left: 3px solid transparent;
                font-size: 12px;
                border-left: 3px solid #0000;
                padding: 0.1rem 0.1rem 0.1rem 1rem;
                margin-top: 0.3rem;
                margin-bottom: 0.5rem;

                &:hover, &:focus, &:active {
                    background-color: $darkBlue;
                    border-left: 3px solid $lightBlue;
                }
            }
        }
    }

    .side-bar-item {
        margin-bottom: 0.2rem;

        &:first-child {
            h3 {
                margin-top: 0;
            }
        }

        h3, a {
            display: block;
            margin: 1rem 0 0;
            border: none;
            padding: 0;
            color: $lightGrey;
            text-decoration: none;
            cursor: pointer;
            font-size: 14px;
            font-weight: 400;
            border-bottom: 1px solid $darkBlue;

            &:hover {
                font-weight: $bold;
            }
        }
    }

    .user-area {
        margin-top: 1.5rem;
    }

    .main-content {
        padding: 2rem;
        background-color: $white;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        margin: 1.4rem;
        overflow: auto;
        width: 100%;
    }

    .entity-list {
        overflow: auto;

        .actions {
            display: flex;
            justify-content: end;
            margin-bottom: 1rem;
        }
    }

    .forms-container {
        width: 96%;
        max-width: 400px;
        margin: auto;
    }

    .form-title {
        font-size: 22px;
        margin-bottom: 2%;
        color: $darkGrey;
        text-align: center;
    }

    .input-box {
        margin: 0 auto 4%;

        label {
            display: block;
            font-weight: 600;
            margin-bottom: 1%;
        }

        input[type='text'], input[type='password'] {
            width: 96%;
            padding: 2%;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        input[type='submit'] {
            margin: 0 auto;
            display: flex;

            &:hover {
                background-color: $lightBlue;
            }
        }
    }

    .table-container {
        width: 96%;
        margin: auto;
    }

    h2 {
        font-size: 22px;
        margin: 0 0 2rem;
        color: $darkGrey;
        text-align: center;
    }

    .list {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 2%;
        color: $darkGrey;
        table-layout: auto;

        .row {
            background-color: $white;

            &.row-header {
                background-color: $darkBlue;
                color: $white;
            }

            &:nth-child(even) {
                background-color: $lightGrey;
            }
        }

        th.field {
            padding: 1.5rem 0;

            span {
                color: $white;
            }
        }

        .field {
            padding: 0.5rem 0;
            min-width: min-content;
            white-space: nowrap;
            height: auto;
            border: 1px solid #ccc;
            text-align: left;

            .button-list-delete {
                border: none;
                background-color: transparent;
                cursor: pointer;
            }

            .field-actions-container {
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                margin: 0 1rem;

                .button {
                    margin-bottom: 1rem;

                    &.list-delete-selection {
                        margin-bottom: 0;
                    }
                }
            }

            a, a:visited {
                color: $black;
                text-decoration: none;
            }

            a:active, a:hover {
                color: $lightBlue;
            }

            span {
                padding: 0 1rem;
                color: $black;
            }

            &-edit, &-delete {
                span {
                    display: block;
                    text-align: center;
                    cursor: pointer;
                }
            }

            &-edit {
                span {
                    svg, path {
                        width: 24px;
                        color: $lightBlue;
                    }
                }
            }

            &-delete {
                span {
                    svg, path {
                        width: 24px;
                        fill: $lightBlue;
                    }
                }
            }
        }
    }

    .filters-toggle {
        cursor: pointer;
    }

    .filters-toggle-content {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;

        &.hidden {
            display: none;
        }
    }

    .pagination {
        width: 100%;
        display: flex;
        flex-flow: wrap;
        justify-content: center;
        padding: 1rem 0;
        text-align: center;

        a {
            margin: 0.2rem;
            padding: 1rem 1.4rem;
            border: 1px solid #ccc;
            color: $lightBlue;
            text-decoration: none;

            &:hover, &:focus, &:active {
                background-color: $lightBlue;
                color: $white;
            }
        }
    }

    .footer {
        text-align: center;
        padding: 2%;
        background-color: $darkGrey;
        color: $white;

        a {
            color: $white;
            text-decoration: none;

            &:hover {
                text-decoration: underline;
            }
        }
    }

    .copyright {
        position: relative;
        display: block;
        width: 100%;
        margin: 0;
        padding: 0;
        text-align: center;

        a, a:hover, a:visited {
            display: block;
            color: $white;
            text-decoration: none;
            padding: 0;
        }

    }

    .alert {
        font-weight: $bold;
        color: $red;
    }

    .shutting-down {
        margin-bottom: 1rem;
    }

    .sub-content {
        background-color: $lightGrey2;
        padding: 1rem;
        margin-bottom: 1rem;
        border: 1px solid #ccc;
        border-radius: 4px;

        .sub-content-form {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-end;
            justify-content: space-between;

            h4 {
                width: 100%;
                margin: 0 0 1rem 0;
                font-size: 14px;
                color: $darkGrey;
            }

            .actions {
                display: flex;
                width: 100%;
                margin: 1rem 0 0 0;
            }

            .sub-content-box {
                margin-bottom: 1rem;
                display: flex;
                flex-direction: column;

                label {
                    font-weight: 600;
                    margin-bottom: 0.5rem;
                }

                input[type="text"] {
                    padding: 0.5rem;
                    border: 1px solid #ccc;
                    border-radius: 4px;
                    min-width: 150px; /* Minimum width for input fields */
                }
            }

            input[type="submit"] {
                margin-right: 1.4rem;

            }
        }

        textarea {
            position: relative;
            display: block;
            width: 98%;
            padding: 1%;
            margin: 1rem 0;
        }
    }

    .maps-wizard {
        .main-action-container.maps-selection {
            width: 100%;

            .wizard-options-container {
                display: flex;
                justify-content: space-between;
                flex-wrap: wrap;
                width: 100%;

                input.map-wizard-option {
                    top: 2px;
                    margin-right: 0;
                }
            }
        }

        .checkbox-container {
            display: flex;
            flex-direction: row;
            font-weight: $bold;
        }

        .wizard-options-container {
            padding: 0;
            margin-bottom: 1rem;

            input.map-wizard-option {
                position: relative;
                top: -2px;
                margin-right: 6px;
            }

            .wizard-map-option-container {
                display: flex;
                flex-direction: column;
                list-style: none;

                label {
                    cursor: pointer;
                }

                canvas {
                    max-width: 400px;
                    margin-top: 1rem;
                }
            }

            .wizard-option-container {
                list-style: none;
                margin-bottom: 1rem;

                .main-option {
                    display: inline-block;
                    cursor: pointer;
                }

                .maps-wizard-option-content {
                    display: none;
                    padding-left: 1.6rem;
                }

                &.active {
                    .maps-wizard-option-content {
                        display: block;
                    }
                }
            }
        }

        .maps-wizard-form {
            align-items: flex-start;
            flex-direction: column;
            justify-content: flex-start;

            .submit-container {
                display: flex;
            }
        }
    }

    .loading {
        max-width: 50px;

        &.hidden {
            display: none;
        }
    }

    .entity-view, .entity-edit {
        h2 {
            font-size: 22px;
            margin-bottom: 2rem;
            color: $darkGrey;
            text-align: center;
        }

        .view-field, .edit-field {
            display: flex;
            justify-content: space-between;
            padding: 0;
            margin-bottom: 1rem;

            span {
                padding: 0.5rem;

                &.field-name {
                    font-weight: $bold;
                    color: $darkGrey;
                    flex: 1;
                }

                &.field-value {
                    flex: 2;
                    color: $darkBlue;
                    background-color: $lightGrey;

                    input[type="checkbox"] {
                        max-width: max-content;
                        margin-left: 0.5rem;
                        margin-top: 0.5rem;
                    }
                }
            }
        }

        .view-field .field-value img {
            max-width: 200px;
        }

        .edit-field {
            span {
                &.field-value {
                    display: flex;
                    flex-direction: column;
                    padding: 0;

                    p {
                        margin-left: 0.5rem;
                    }

                    input, select {
                        margin: 0;
                        padding: 0.5rem;
                        border: none;
                        background: transparent;

                        &:not([disabled]) {
                            margin: 0;
                            border: 1px solid #7f8c8d;
                            background: #fff;

                            &[type="checkbox"] {
                                max-width: max-content;
                                margin-left: 0.5rem;
                                margin-top: 0.5rem;
                            }
                        }
                    }
                }
            }
        }

        .actions {
            margin-top: 2rem;
            text-align: center;

            form {
                display: inline;
            }

            .button {
                display: inline-block;
                margin: 0 0.5rem;
            }
        }
    }

}
