:root {
    --color: black;
    --primary-color: #09639f;
    --secondary-color: #3498db;
    --header-color: #09639f;
    --background-color: #fff;
    --form-background-color: #f9f9f9;
    --table-active-color: #f2f2f2;
    --hr-text-color: #3b3b3b;
    --lable-text-color: #333;
    --border-color: #ddd;
    --button-color: #09639f;
    --input-background-color: white;
    --header-shadow: 2px 2px 4px rgba(0, 0, 0, 0.25);
    --container-border-radius: 28px;
    --inner-container-border-radius: 14px;
    --element-border-radius: 10px;
    --container-padding: 28px;
    --container-gap: 20px;
    --container-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --inner-container-padding: 14px;
    --inner-container-gap: 14px;
}

body {
    font-family: Twemoji Country Flags, system-ui;
    background-color: var(--background-color);
    color: var(--color);
    text-align: center;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.dark-mode {
    --color: white;
    --primary-color: #09639F;
    --secondary-color: #3498DB;
    --header-color: #3498DB;
    --background-color: #121212;
    --form-background-color: #121212;
    --table-active-color: #252525;
    --hr-text-color: #D5D5D5;
    --lable-text-color: #DFDFDF;
    --border-color: #353535;
    --button-color: #3498DB;
    --input-background-color: #252525;
    --header-shadow: 2px 2px 4px rgba(255, 255, 255, 0.25);
    --container-box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

h1 {
    color: var(--header-color);
    text-shadow: var(--header-shadow);
}

.icon {
    vertical-align: middle;
    height: 3rem;
}

.container {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--container-border-radius);
    padding: var(--container-padding);
    box-shadow: var(--container-box-shadow);
}

.section .container {
    gap: var(--container-gap);
}

.container>.section {
    margin: 0;
}

.inner-container {
    display: flex;
    flex-direction: column;
    gap: var(--inner-container-gap);
    box-shadow: var(--container-box-shadow);
    border: 1px solid var(--border-color);
    border-radius: var(--inner-container-border-radius);
    padding: var(--inner-container-padding);
}

.form-container {
    max-width: 90%;
    margin: 0 auto;
    background: var(--form-background-color);
    margin-bottom: 30px;
}

.configForm {
    display: flex;
    flex-direction: column;
}

.section {
    display: flex;
    flex-direction: column;
    gap: var(--container-gap);
    margin-bottom: var(--container-gap);
}

.form-control {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.form-control div {
    display: flex;
    flex: 1;
    width: 100%;
}

.form-control label {
    flex: 1;
    text-align: center;
    width: 100%;
    font-weight: bold;
    color: var(--lable-text-color);
}

input[type="text"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    text-align: center;
    padding: 10px;
    line-height: 1.5;
    border: 1px solid var(--border-color);
    border-radius: var(--element-border-radius);
    color: var(--lable-text-color);
    background-color: var(--input-background-color);
    transition: border-color 0.3s ease;
}

textarea {
    font-family: inherit;
    resize: none;
    color: var(--color);
    max-height: calc(5lh + 10px);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    border-color: var(--secondary-color);
    outline: none;
}

input[type="text"]:read-only,
input[type="number"]:read-only,
input[type="url"]:read-only,
textarea:read-only {
    color: gray;
    background-color: var(--form-background-color);
}

.form-control input[type="password"] {
    text-align: center;
    width: 50%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--element-border-radius);
    color: var(--lable-text-color);
    background-color: var(--input-background-color);
    transition: border-color 0.3s ease;
}

.form-control input[type="password"]:focus {
    border-color: var(--secondary-color);
    outline: none;
}

.form-control a,
a.link {
    width: 100%;
    text-decoration: none;
}

a.scanner {
    margin-left: 8px;
    width: unset;
    color: var(--button-color);
}

button.reverse {
    width: 100%;
    background-color: var(--form-background-color);
    font-weight: 600;
    color: var(--button-color);
    border-color: var(--primary-color);
    border: 1px solid;
    padding: 10px;
}

.protocols {
    flex-direction: row;
    flex-wrap: wrap;
}

.proto {
    gap: 8px;
    display: flex;
    align-items: center;
    flex-direction: row;
    justify-content: center;
}

.proto label {
    width: unset;
    flex: unset;
}

.min-max {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
}

.min-max input {
    width: 100%;
}

.min-max span {
    text-align: center;
    white-space: pre;
}

.ports-block th {
    text-wrap: nowrap;
    background-color: gray;
}

.ports-block td:first-child {
    text-align: center;
    font-size: larger;
}

.ports-block td:last-child {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.rules {
    gap: 16px;
    display: flex;
    flex-direction: row;
    width: 100%;
    flex-wrap: wrap;
}

.form-control div.routing {
    gap: 5px;
    display: flex;
    flex: 1;
    margin: 0;
    align-items: center;
    max-width: fit-content;
}

.routing label {
    text-align: left;
    width: unset;
    font-weight: 400;
    font-size: 100%;
    text-wrap: nowrap;
}

.form-control.apply {
    flex-wrap: wrap;
    flex-direction: row;
    padding: var(--container-padding) 0;
    gap: 8px;
    justify-content: center;
    flex: unset;
}

button.apply-settings {
    margin: 0;
}

button.panel-settings {
    flex: unset;
    border: none;
    cursor: pointer;
    width: fit-content;
    margin: 0;
    background: none;
    color: var(--primary-color);
}

.material-symbols-rounded {
    vertical-align: middle;
    display: inline-block;
    margin: 0 5px 0 5px;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24
}

a .material-symbols-rounded {
    color: var(--secondary-color);
}

details:not(:last-of-type) {
    border-bottom: 1px solid var(--border-color);
}

summary {
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    text-wrap: nowrap;
}

summary::marker {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

summary:focus-visible {
    outline: none;
}

h2,
h3 {
    display: flex;
    text-align: center;
    color: var(--hr-text-color);
    justify-content: center;
    align-items: center;
}

h4 {
    margin: 0;
}

hr {
    margin: 1px 0;
    border: 1px solid var(--border-color);
}

.footer-container {
    overflow-x: auto;
    display: flex;
}

.footer {
    display: flex;
    font-weight: 600;
    margin: 10px auto;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.footer i {
    font-size: 36px;
}

.footer a,
.footer a.link {
    color: var(--color);
    text-decoration: underline;
    width: unset;
    flex: unset;
}

.footer button {
    margin: unset;
    background: #212121;
    max-width: fit-content;
}

.footer .logout {
    background: none;
    color: var(--color);
    margin: 0;
    border: none;
    cursor: pointer;
}

.github-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

label {
    display: block;
    font-weight: 600;
    color: var(--lable-text-color);
}

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    white-space: nowrap;
    padding: 14px 14px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    border: none;
    border-radius: var(--element-border-radius);
    color: white;
    background-color: var(--primary-color);
    cursor: pointer;
    outline: none;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    margin-right: auto;
    margin-left: auto;
}

table button {
    margin-top: auto;
    margin-bottom: auto;
    max-height: fit-content;
    font-size: 16px;
    font-weight: 600;
    border: none;
    background-color: unset;
    cursor: pointer;
    color: var(--lable-text-color);
    padding: 0;
}

table button span.material-symbols-rounded {
    font-size: 28px;
    margin: 0;
    color: var(--button-color)
}

table td div span.material-symbols-rounded {
    color: #3fb950;
}

.button {
    font-weight: 600;
    font-size: 1.1rem;
    width: max-content;
}

input[type="checkbox"] {
    background-color: var(--input-background-color);
}

.button.disabled {
    background-color: #ccc;
    color: white;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
}

.button:hover {
    background-color: #2980b9;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

table button:hover,
table button:focus {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.header-container button:hover {
    transform: scale(1.1);
}

.header-container {
    gap: 10px;
    display: flex;
    justify-content: center;
}

.header-container h3 {
    display: flex;
    justify-content: center;
}

button.button:hover {
    color: white;
}

.button:active {
    transform: translateY(1px);
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
}

table button:active {
    transform: translateY(1px);
}

.table-container {
    overflow-x: auto;
}

.add-noise {
    background: none;
    margin: 0;
    border: none;
    cursor: pointer;
    color: green;
}

.delete-noise {
    background: none;
    margin: 0;
    border: none;
    cursor: pointer;
    color: darkred;
}

.table-container table {
    width: 100%;
    border: 1px solid var(--border-color);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--inner-container-border-radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.table-container tbody {
    display: flex;
    flex-direction: column;
}

.table-container tr {
    display: flex;
    flex-direction: row;
}

.table-container tr td:first-child {
    color: var(--lable-text-color);
    text-wrap: nowrap;
}

.table-container tr td:nth-child(2) {
    flex-direction: row;
    gap: 8px;
}

.my-ip {
    overflow-x: auto;
}

.my-ip table {
    width: 100%;
    border: 1px solid var(--border-color);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--inner-container-border-radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.my-ip th,
.my-ip td {
    text-wrap: nowrap;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.my-ip td:first-child,
.my-ip th {
    background-color: var(--table-active-color);
    font-weight: bold;
}

.table-container th,
.table-container td {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
    width: 100%;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.table-container td div {
    display: flex;
    align-items: center;
}

.table-container tr:hover {
    background-color: var(--table-active-color);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    width: fit-content;
    text-align: center;
    background-color: var(--form-background-color);
    margin: auto;
    padding: 10px 20px 20px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}

.qr-title {
    align-self: center;
    font-weight: bold;
}

.close {
    align-self: flex-end;
    color: var(--color);
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#passwordError {
    color: red;
    margin-bottom: 10px;
}

.modalQR {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.floating-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: var(--color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.3s;
}

.floating-button:hover {
    transform: scale(1.1);
}

body.dark-mode .floating-button {
    background-color: var(--color);
}

.floating-button i {
    color: var(--background-color);
}

body.dark-mode .floating-button:hover {
    transform: scale(1.1);
}

.refresh-geo-location {
    background: none;
    margin: 0;
    border: none;
    cursor: pointer;
}

.refresh-my-ip {
    color: var(--button-color);
}

details h3 {
    display: flex;
    justify-content: center;
}

.udp-noise {
    margin-bottom: 10px;
}

.password-wrapper {
    position: relative;
}

.password-wrapper input[type=password],
.password-wrapper input[type=text] {
    width: 100%;
    padding-right: 40px;
    margin: 0;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
    color: darkgray;
}

.password-error {
    color: red;
    margin-bottom: 10px;
}

summary h3 {
    display: inline-flex;
    align-items: center;
}

@media only screen and (min-width: 768px) {
    .form-container {
        max-width: 60%;
    }

    .form-control {
        flex-direction: row;
    }

    .form-control label {
        text-align: left;
    }
}