body {
    margin: 0;
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f8f9fa;
    color: #212529;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1rem;
    margin-bottom: 20px;
    color: #555;
}

main {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Padding between boxes */
    justify-content: center;
    align-items: flex-start;
}

.input-box,
.output-box {
    flex: 1 1 calc(50% - 20px);
    max-width: calc(50% - 20px);
    min-width: 500px;
    height: 350px;
    box-sizing: border-box;
    font-size: 1rem;
}

textarea {
    width: 100%;
    height: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    resize: none; /* Disable resizing */
    box-sizing: border-box;
}

.output-box {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    font-family: "Courier New", Courier, monospace;
    line-height: 1;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
    word-wrap: normal;
    overflow-wrap: normal;
    text-align: left;
}

.controls {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px; /* Even spacing between controls */
}

label {
    font-size: 1rem;
    font-weight: bold;
    margin-right: 5px;
}

input[type="number"] {
    width: 100px;
    padding: 5px;
    font-size: 1rem;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

button {
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

#mode-toggle {
    background-color: #007bff;
    color: #fff;
    position: absolute;
    top: 20px;
    right: 20px;
}

#format-button {
    background-color: #28a745;
    color: #fff;
}

#copy-button {
    background-color: #28a745;
    color: white;
    border-radius: 5px;
    transition: background-color 0.3s;
    display: block;
}

#copy-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.custom-checkbox {
    padding: 0;
    margin: 0;
    cursor: pointer;
    height: 1rem;
    width: 1rem;
}

/* Dark Mode */
body.dark {
    background-color: #212529;
    color: #f8f9fa;
}

body.dark textarea,
body.dark .output-box {
    background-color: #343a40;
    color: #f8f9fa;
    border-color: #495057;
}

body.dark button#mode-toggle {
    background-color: #6c757d;
}

.spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner.active {
    display: flex;
}

.spinner::after {
    content: "";
    width: 50px;
    height: 50px;
    border: 5px solid transparent;
    border-top: 5px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 600px) {
    main {
        flex-direction: column;
    }

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

    #mode-toggle {
        top: 10px;
        right: 10px;
    }
}
