/*  this style sheet should always comes first */

:root {
    --max-width: 1200px;
    --nav-height: 70px;
    --footer-height: 35px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
}

h1 {
    color: #000;
    font-size: 24px;
    margin: 10px 0;
}

.container {
    width: 100%;
    max-width: var(--max-width);
    box-sizing: border-box;
    margin: 0 20px;
    margin-top: calc(var(--nav-height) + 4px);
    margin-bottom: calc(var(--footer-height) + 4px);
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: min-content;
    height: auto;
}

iframe {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

button {
    background-color: rgb(52, 219, 183);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease-in-out;
}

button:hover {
    background-color: #717171;
}

button:disabled {
    background-color: #444 !important;
    cursor: not-allowed;
}

/* Spinner animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

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

/* Button loading state */
button.loading {
    position: relative;
    color: transparent;
    /* Hide text */
    background-color: #444;
}

button.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Keep disabled styles */
button.loading:disabled::after {
    border-top-color: #888;
}

.result {
    min-width: 200px;
    min-height: 1em;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid rgb(52, 219, 183);
}

.result.disabled {
    border-left-color: #444;
}

.result.failed:not(.disabled) {
    border-left-color: #e74c3c;
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

input {
    min-width: 200px;
    min-height: 1em;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    display: flex;
    outline: none;
}

/* gradient shade around */
input:not([disabled]):not(.invalid):focus,
input:not([disabled]):not(.invalid):focus-within {
    border-color: rgb(52, 219, 183) !important;
    box-shadow: 0 0 2px 1px rgba(52, 219, 183, 0.3), 0 0 4px 2px rgba(52, 219, 183, 0.2),
        0 0 8px 4px rgba(52, 219, 183, 0.1) !important;
    transition: box-shadow 0.2s ease-in-out;
}

/* Add hover state */
input:not([disabled]):not(.invalid):hover {
    box-shadow: 0 0 4px 2px rgba(52, 219, 183, 0.2);
    transition: all 0.2s ease-in-out;
}

/* Error state when not being changed */
input:not([disabled]).invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 4px 2px rgba(231, 76, 60, 0.2), 0 0 8px 4px rgba(231, 76, 60, 0.1);
    transition: all 0.2s ease-in-out;
}

.text-highlight {
    color: rgb(52, 219, 183);
    display: inline;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.text-highlight:hover {
    text-decoration: underline !important;
}

.text-highlight.copied {
    text-decoration: underline;
    background-color: rgba(52, 219, 183, 0.1);
}

@keyframes vibrate {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

.fast-vibrate {
    animation: vibrate 0.1s ease-in-out;
}

.normal-vibrate {
    animation: vibrate 0.2s ease-in-out;
}

.slow-vibrate {
    animation: vibrate 0.3s ease-in-out;
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: rgba(177, 216, 238, 0.7);
    color: #054caf;
    padding: 7.5px 15px;
    margin: 10px;
    border-radius: 4px;
    animation: fadeInOut 2.5 ease-in-out;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 16px;
}

.toast-close {
    cursor: pointer;
    opacity: 0.7;
    font-size: 18px;
    padding: 0 4px;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    30% {
        opacity: 1;
        transform: translateY(0);
    }

    70% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

dialog {
    width: max(300px, 20%);
    padding: 1em 1em 0.6em;
    border-radius: 10px;
    border-color: rgba(52, 219, 183, 0.2);
    box-shadow: 0 0 4px 2px rgba(52, 219, 183, 0.2), 0 0 8px 4px rgba(52, 219, 183, 0.1);
    background-color: rgba(203, 235, 229, 0.8);
    text-align: center;
}

dialog::backdrop {
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
}

dialog h2 {
    margin: 0 auto 0.5em;
}

dialog p {
    margin: 0 auto 1em;
}

dialog button {
    margin: 0 0.5em;
}

dialog button:focus {
    outline: none;
}

dialog .dialog-close {
    background-color: #e74c3c;
}

dialog .dialog-close:hover {
    background-color: #cf1d0a;
}