/*
 * Reldens - Tile Map Generator App
 */

.reldens-tile-map-generator-app {
    font-family: Verdana, Geneva, sans-serif;
    background-color: #ecf0f1;
    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;

        .close {
            position: absolute;
            top: 1rem;
            right: 1rem;
            cursor: pointer;
            font-weight: 600;
        }
    }

    .notification.error {
        display: block;
        background-color: #ff0000;
        color: #ffffff;
    }

    .notification.success {
        display: block;
        background-color: #27ae60;
        color: #ffffff;
    }

    .header {
        background-color: #000000;
        padding: 0 0 1.5rem;
        text-align: center;

        .title {
            margin-top: 0;

            a {
                color: #ffffff;
                text-decoration: none;
                font-size: 2rem;
                font-weight: 600;
                font-family: "Play", sans-serif;
            }
        }
    }

    .reldens {
        color: #2f7dde;
    }

    .sample-image {
        max-width: 100%;
        margin: 1rem 0;
    }

    .text-center {
        text-align: center;
    }

    h3.select-option {
        display: block;
        margin: 3rem auto;
        text-align: center;
        font-size: 1.5rem;
    }

    .content {
        display: flex;
        position: relative;
    }

    .button {

        padding: 0.5rem 1rem;
        border: none;
        border-radius: 4px;
        font-size: 14px;
        cursor: pointer;
        text-decoration: none;
    }

    .button-primary {
        color: #ffffff;
        background-color: #3498db;
    }

    .button-primary:hover {
        background-color: #3498db;
    }

    .button-secondary {
        color: #ffffff;
        background-color: #7f8c8d;
    }
    .button-secondary:hover {
        background-color: #7f8c8d;
    }

    .button-warning {
        color: #ffffff;
        background-color: #d38200;
    }

    .button-warning:hover {
        background-color: #d38200;
    }

    .button-danger {
        color: #ffffff;
        background-color: #ff0000;
    }

    .button-danger:hover {
        background-color: #ff0000;
    }

    .button:disabled {
        background-color: #7f8c8d !important;
    }

    .icon-sm {
        width: 32px;
    }

    .clickable {
        cursor: pointer;
    }

    .modal-overlay {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 9999;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
    }

    .modal {
        max-width: 92vw;
        max-height: 92vh;
        padding: 1rem;
        overflow: auto;
        cursor: pointer;
        background-color: #fff;
        border-radius: 8px;

        canvas {
            max-width: 100%;
        }
    }

    .response-error {
        color: #ff0000;
        font-weight: 600;
    }

    .main-content {
        padding: 2rem;
        background-color: #ffffff;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        margin: 1.4rem;
        overflow: auto;
        width: 100%;
    }

    .forms-container {
        width: 96%;
        max-width: 400px;
        margin: auto;
    }

    .form-title {
        font-size: 22px;
        margin-bottom: 2%;
        color: #333333;
        text-align: center;
    }

    .input-box {
        margin: 1rem auto;

        label {
            display: inline-block;
            font-weight: 600;
            margin-right: 1rem;
            min-width: 80px;
        }

        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: #3498db;
            }
        }

        input[type='submit']:hover {
            background-color: #3498db;
        }
    }

    h2 {
        font-size: 22px;
        margin: 0 0 2rem;
        color: #333333;
        text-align: center;
    }

    .footer {
        text-align: center;
        padding: 2%;
        background-color: #333333;
        color: #ffffff;

        a {
            color: #ffffff;
            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: #ffffff;
            text-decoration: none;
            padding: 0;
        }

    }

    .alert {
        font-weight: 600;
        color: #ff0000;
    }

    .sub-content {
        background-color: #ecf0f1;
        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;

            .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%;
                gap: 1rem;
                padding: 0;
                margin: 0;
                list-style: none;

            // 3 or more items => 4 columns
            .wizard-map-option-container {
                flex: 0 0 22%;
                padding: 1rem 1% 0;
                margin: 1.5rem 0 0;
                border: 1px solid #ccc;
            }

            // 1 child => 1 columns
            .wizard-map-option-container:only-child {
                flex: 0 0 100%;
                padding: 1rem 0 0;
                border: none;
            }

            // 2 children => 2 columns
            .wizard-map-option-container:first-child:nth-last-child(2),
            .wizard-map-option-container:last-child:nth-child(2) {
                flex: 0 0 47%;
            }

                input.map-wizard-option {
                    top: 2px;
                    margin-right: 0;
                }
            }
        }

        .checkbox-container {
            display: flex;
            flex-direction: row;
            font-weight: 600;
        }

        .wizard-options-container {
            display: flex;
            flex-wrap: wrap;
            padding: 0;
            margin: 0 0 1rem 0;
            width: 100%;
            gap: 1rem;
            list-style: none;
            height: auto;

            input.map-wizard-option {
                position: relative;
                top: -2px;
                margin-right: 6px;
            }

            .wizard-option-container {
                min-width: 400px;
                max-width: 50%;
                aspect-ratio: 1/1;
                flex: 1 0 calc(25% - 1rem);
                box-sizing: border-box;
                padding: 1rem;
                background-color: #f5f5f5;
                border: 1px solid #ddd;
                border-radius: 4px;
                overflow: unset;
                list-style: none;
                margin-bottom: 1rem;
                cursor: pointer;

                .main-option {
                    display: inline-block;
                    cursor: pointer;
                }
            }

            @media (max-width: 1800px) {
                .wizard-option-container {
                    flex: 1 0 calc(50% - 1rem);
                }
            }

            @media (max-width: 900px) {
                .wizard-option-container {
                    flex: 1 0 100%;
                    max-width: 100%;
                }
            }

            .wizard-map-option-container {
                display: flex;
                flex-direction: column;
                list-style: none;
                padding-top: 1rem;
                margin-top: 1.5rem;
                border-top: 1px solid #ccc;

                label {
                    cursor: pointer;
                }

                canvas {
                    width: 100%;
                    margin-top: 1rem;
                }
            }
        }

        .wizard-option-container.active {
            background-color: #d6e7ff;
        }

        .maps-wizard-form {
            align-items: flex-start;
            flex-direction: column;
            justify-content: flex-start;

            .submit-container {
                display: flex;
                justify-content: flex-end;
                width: 100%;
            }
        }

        .sub-map-option-description {
            display: flex;
            align-items: center;

            img.icon-sm {
                margin-right: 1rem;
            }
        }

        .sub-maps-container {
            display: block;

            &.hidden {
                display: none;
            }

            p {
                margin: 1.5rem 0 0;
            }
        }
    }

    .loading {
        max-width: 50px;

        &.hidden {
            display: none;
        }
    }

    .association-maps-container {
        display: block;
        width: 100%;
        max-height: 500px;
        overflow: auto;
    }

    .config-container {
        margin-top: 1rem;
        padding: 1rem;
        background-color: #f9f9f9;
        border: 1px solid #ddd;
        border-radius: 4px;

        .config-grid {
            display: none;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 0.5rem;
        }
    }

    .config-container.active {
        .config-grid {
            display: grid;
        }
    }

    .config-container h4.clickable {
        cursor: pointer;
        position: relative;
        padding-left: 18px;
        margin: 0;
        line-height: 2rem;
    }

    .common-config-container h4.clickable::before,
    .config-container h4.clickable::before {
        content: '+';
        position: absolute;
        left: 0;
        top: 0;
    }

    .common-config-container.active h4.clickable::before{
        content: '-';
        left: 4px;
    }

    .config-container.active h4.clickable::before {
        content: '-';
        left: 2px;
    }

    .config-item:first-child {
        margin-top: 1rem;
    }

    .config-item {
        margin-bottom: 0.5rem;

        label {
            display: block;
            margin-bottom: 0.3rem;
            font-weight: 600;
        }

        select {
            width: 100%;
        }

        input, textarea {
            width: 96%;
        }

        input, select, textarea {
            padding: 0.5rem 2%;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        textarea {
            min-height: 80px;
            resize: vertical;
            margin: 0;
        }
    }

    .generatorData {
        resize: vertical;
    }

    .common-config-container {
        margin: 1rem 0;
        padding: 1rem;
        background-color: #e3f2fd;
        border: 1px solid #bbdefb;
        border-radius: 4px;
    }

    .common-config-container h4 {
        display: block;
        position: relative;
        padding-left: 1.5rem;
        margin: 0;
        line-height: 2rem;
        font-size: 1.2rem;
    }

    .common-config-container .config-grid {
        display: none;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 0.5rem;
    }

    .common-config-container .config-grid .config-item:first-child {
        margin-top: 0;
    }

    .common-config-container.active {
        h4 {
            margin-bottom: 2rem;
        }

        .config-grid {
            display: grid;
        }
    }

    .tooltip {
        display: inline-block;
        color: #3498db;
        font-weight: bold;
        margin-left: 4px;
        cursor: pointer;
    }

    .tooltip .tooltip-text {
        visibility: hidden;
        width: 96%;
        background-color: #333;
        color: #fff;
        text-align: left;
        border-radius: 6px;
        padding: 8px;
        position: absolute;
        z-index: 9999;
        top: -30px;
        left: 0;
        opacity: 0;
        transition: opacity 0.3s;
        font-weight: normal;
        font-size: 12px;
        line-height: 1.4;
        pointer-events: none;
    }

    .tooltip:hover .tooltip-text {
        visibility: visible;
        opacity: 0.95;
    }

    @media (max-width: 1200px) {
        .tooltip .tooltip-text {
            right: 125%;
            left: auto;
        }
    }

    .config-item label {
        position: relative;
        display: flex;
        align-items: center;
        margin-bottom: 0.5rem;
        line-height: 1.4;
    }

}
