:root {
    --color-red: #ff0000;
    --color-orange: #ff7f00;
    --color-yellow: #ffff00;
    --color-green: #00ff00;
    --color-blue: #0000ff;
    --color-indigo: #4b0082;
    --color-violet: #9400d3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Fira Code", monospace;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh !important;
    background: linear-gradient(135deg, #40ff00, #00a6ff);
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ------------------------------------------ HEADER --------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */

header {
    min-height: 80px;
    width: 100%;
    background: #1f1f1f;
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

nav {
    width: 100%;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 40px;
    align-items: center;
    justify-content: center;
}

nav ul li a {
    color: #aaa;
    text-decoration: none;
    font-size: 1.2em;
    padding: 5px 10px 15px;
    position: relative;
    transition: color 0.3s ease-in-out, font-weight 0.3s ease-in-out;
    align-items: center;
    justify-content: center;
}

nav ul li:not(:first-child) a:hover {
    color: #fff;
    font-weight: bold;
}

nav ul li:not(:first-child) a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        var(--color-red),
        var(--color-orange),
        var(--color-yellow),
        var(--color-green),
        var(--color-blue),
        var(--color-indigo),
        var(--color-violet),
        var(--color-red)
    );
    background-size: 200% 100%;
    animation: rainbowBorder2 2s linear infinite;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

nav ul li:not(:first-child) a:hover::after {
    opacity: 1;
}

@keyframes rainbowBorder2 {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 200% 0%;
    }
}

/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ------------------------------------------ FOOTER --------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */

.h1-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    align-items: center;
    justify-content: center;
}

footer {
    width: 100%;
    background: #1f1f1f;
    color: white;
    text-align: center;
    padding: 10px 0;
}

footer p {
    margin-top: 30px;
}

footer h3 {
    margin-bottom: 20px;
}

.nav-footer ul li a:hover {
    color: #fff;
    font-weight: bold;
}

.nav-footer ul li a:hover::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        var(--color-red),
        var(--color-orange),
        var(--color-yellow),
        var(--color-green),
        var(--color-blue),
        var(--color-indigo),
        var(--color-violet),
        var(--color-red)
    );
    background-size: 200% 100%;
    animation: rainbowBorder2 2s linear infinite;
    opacity: 1;
    transition: opacity 0.8s ease-in-out;
}

.nav-footer ul li a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: transparent;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ------------------------------------------ DISEÑO --------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */

main {
    display: flex;
    flex-direction: column;
    min-height: 70vh;
    gap: 20px;
    padding: 20px;
    flex: 1 0 auto !important;
    padding-bottom: 60px;
}

.menu {
    display: flex;
    gap: 25px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 30px;
    margin-top: 10px;
}

.preview-container {
    display: flex;
    flex-direction: row !important;
    gap: 20px;
    width: 100%;
}

.editor-container,
.preview-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 50% !important;
    max-width: 50% !important;
    min-width: 50% !important;
}

.preview-display {
    padding-right: 20px;
}

#editor {
    padding: 15px;
    border: 4px solid #1f1f1f;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    overflow: hidden;
    min-height: 300px;
    resize: none;
    height: 300px;
    max-height: 100% !important;
    box-shadow: 0px 35px 20px 0 rgba(0,0,0,0.35);
}

#preview {
    padding: 15px;
    border: 4px solid #ffffff;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    overflow: hidden;
    min-height: 300px;
    resize: none;
    height: 300px;
    max-height: 100% !important;
    box-shadow: 0px 35px 20px 0 rgba(255, 255, 255, 0.24);
}

#editor:focus {
    outline: none;
}

#editor {
    color: white;
}

.file-input {
    width: 250px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #fff;
}

.file-input input {
    width: 100%;
    padding: 8px 12px;
    font-family: "Fira Code", monospace;
    font-size: 14px;
    color: rgba(226, 226, 226, 0.925);
    background: rgba(0,0,0,0.1);
    border-radius: 12px;
    border: none;
    box-shadow: 0px 35px 20px 0 rgba(0,0,0,0.05);
    outline: none;
    transition: transform 300ms ease, box-shadow 300ms ease, background 0.3s ease;
    backdrop-filter: blur(8px);
}

.file-input input::placeholder {
    color: rgba(26, 25, 25, 0.5);
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%232b2b2b' d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1.003 1.003 0 0 0 0-1.41l-2.34-2.34a1.003 1.003 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E") no-repeat right 8px center;
    padding-right: 32px;
}

.file-input input:focus {
    box-shadow: 0px 10px 20px 0 rgba(0,0,0,0.4);
    transform: scale(1.03);
    background: rgba(0,0,0,0.15);
}

.format-select,
.outline-select {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #ffffff;
}

.format-select select,
.outline-select select {
    font-family: "Fira Code", monospace;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.84);
    background: rgba(0,0,0,0.1);
    border-radius: 12px;
    border: none;
    padding: 8px 12px;
    padding-right: 32px;
    box-shadow: 0px 35px 20px 0 rgba(0,0,0,0.05);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: transform 300ms ease, box-shadow 300ms ease, background 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23E2E2E2' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px 12px;
}

.format-select select option,
.outline-select select option {
    font-family: "Fira Code", monospace;
    font-size: 14px;
    color: rgb(232, 232, 232);
    background: rgba(30, 30, 30, 0.95);
    padding: 8px 12px;
    border-radius: 10px;
    transition: background 0.3s ease, color 0.3s ease;
}

.format-select select option:hover,
.outline-select select option:hover {
    background: #3b3d4a;
    color: #ffffff;
}

.format-select select:focus option,
.outline-select select:focus option {
    background: rgba(40, 40, 40, 1);
    color: #ffffff;
}

select {
    background: #2b2b2b;
    color: #ffffff;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    outline: none;
}

.editor-container, .preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-label {
    font-weight: bold;
    text-align: left;
    font-size: 26px;
    color: #ffffff;
    background: #181818;
    padding: 10px 10px 10px 20px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.preview-label {
    font-weight: bold;
    text-align: left;
    font-size: 26px;
    color: #212121;
    background: #ffffff;
    padding: 10px 10px 10px 20px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    box-shadow: 0px 35px 20px 0 rgba(0, 0, 0, 0.03);
    z-index: 1;
}

#download-btn {
    font-family: "Fira Code", monospace;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.68);
    font-weight: 800;
    background: rgba(0,0,0,0.1);
    border-radius: 12px;
    border: none;
    padding: 8px 16px 8px 12px;
    padding-right: 32px;
    box-shadow: 0px 35px 20px 0 rgba(0,0,0,0.05);
    outline: none;
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: transform 300ms ease, box-shadow 300ms ease, background 0.3s ease;
    background: rgba(0,0,0,0.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%232b2b2b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M12 3v12M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 8px center;
    background-size: 16px 16px;
}

#download-btn:hover,
#download-btn:focus {
    box-shadow: 0px 10px 20px 0 rgba(0,0,0,0.4);
    transform: scale(1.03);
    background-color: rgba(0,0,0,0.15);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%232b2b2b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M12 3v12M7 10l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px 16px;
}

.download-button label {
    font-family: "Fira Code", monospace;
    font-size: 14px;
    color: rgb(255, 255, 255);
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

#editor {
    font-size: 16px;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: rgb(33, 33, 33);
}

#preview {
    white-space: normal;
    background-color: #ffffff;
}

#preview * {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#preview p,
#preview ul,
#preview ol,
#preview blockquote,
#preview pre,
#preview table {
    margin: 0 0 10px 0;
}

#preview ul {
    margin-left: 0px;
    padding-left: 20px;
}

#preview ol {
    margin-left: 0px;
    padding-left: 27px;
}

#preview hr {
    margin-top: 20px;
    margin-bottom: 20px;
}

#preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
    background-color: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(35, 35, 35, 0.34);
}

#preview thead {
    background-color: #007df9;
    color: #fff;
    text-align: left;
}

#preview th,
#preview td {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
}

#preview tr:nth-child(even) {
    background-color: #f6f8fa;
}

#preview tbody tr:hover {
    background-color: #d5d5d5;
    transition: background 0.2s ease;
}

#preview th:first-child,
#preview td:first-child {
    padding-left: 20px;
}

#preview th:last-child,
#preview td:last-child {
    padding-right: 20px;
}

#preview td code,
#preview th code {
    font-family: "Fira Code", monospace;
    background: #f5f5f5;
    color: #007df9 !important;
    padding: 2px 4px;
    border-radius: 4px;
}

#preview h1, #preview h2, #preview h3, #preview h4, #preview h5 {
    margin-top: 10px;
    margin-bottom: 10px;
}

#preview a {
    color: #007df9;
    transition: font-weight 0.2s ease, font-size 0.2s ease;
}

#preview a:hover {
    font-weight: bold;
    font-size: 15.7px;
}

#preview pre {
    background: #1f1f1f;
    color: #d4d4d4;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: "Fira Code", monospace;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    margin: 16px 0;
}

#preview code {
    font-family: "Fira Code", monospace;
    background: #f5f5f5;
    color: #007df9 !important;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

#preview blockquote {
    border-left: 4px solid #007df9;
    padding-left: 16px;
    margin: 16px 0;
    color: #555;
    background: #f5f5f5;
    border-radius: 4px;
    padding-top: 5px;
    padding-bottom: 5px;
}

#preview img {
    display: block;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#preview input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #007df9;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  top: 4px;
}

#preview input[type="checkbox"]:checked {
  background-color: #34d399;
  border-color: #34d399;
}

#preview input[type="checkbox"]:checked::after {
  content: "✓";
  font-size: 13px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  color: #fff;
}