:root, [data-bs-theme="light"] {
    --bs-primary: #003454;
    --bs-primary-hover: #002c47;
    --bs-primary-active: #002a43;
    --bs-primary-subtle: #ccd6dd;
    --bs-primary-subtle-hover: #a6b8c3;
    --bs-primary-subtle-active: #99aebb;
    --bs-primary-emphasis: #001f32;
    --bs-primary-emphasis-hover: #001726;
    --bs-primary-border-subtle: #99aebb;
    --bs-primary-rgb: 0, 52, 84;
    --bs-text-on-primary: #ffffff;
    --bs-border-radius: 0.375rem;
    --bs-border-width: 1px;
    --header-bg: var(--bs-primary);
    --header-text: var(--bs-text-on-primary);
    --header-height: 56px;
    --header-shadow: 0 2px 8px rgba(0,52,84,0.08);
}

[data-bs-theme="dark"] {
    --bs-primary: #737373;
    --bs-primary-hover: #5c5c5c;
    --bs-primary-active: #515151;
    --bs-primary-subtle: #101010;
    --bs-primary-subtle-hover: #121212;
    --bs-primary-subtle-active: #181818;
    --bs-primary-emphasis: #9e9e9e;
    --bs-primary-emphasis-hover: #949494;
    --bs-primary-border-subtle: #181818;
    --bs-primary-rgb: 115, 115, 115;
    --bs-text-on-primary: #ffffff;
}

.main-header {
    width: 100%;
    background: var(--header-bg);
    color: var(--header-text);
    box-shadow: var(--header-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    display: flex;
    align-items: center;
}
.header-content {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: var(--header-height);
}
.header-title {
    font-size: 1.4em;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.header-nav {
    display: flex;
    gap: 16px;
}
.header-nav a {
    color: var(--header-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 1em;
    transition: color 0.2s;
}
.header-nav a:hover {
    color: var(--bs-primary-emphasis);
}

@media (max-width: 600px) {
    .header-content {
        padding: 0 10px;
    }
    .header-title {
        font-size: 1.1em;
    }
    .container {
        margin: 0 !important;
        padding-top: 28px !important;
        border: none !important;
    }
    #preview-modal {
        max-width: 90vw;
        max-height: 60vh;
        overflow-y: auto;
    }
    #main-loader-content {
        max-width: 90%;
    }
    #preview-footer {
        overflow-x: auto !important;
    }
}
body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, 'Liberation Sans', sans-serif;
    margin: 0;
    background: var(--bs-primary-subtle);
    color: var(--bs-primary-emphasis);
    transition: background 0.3s, color 0.3s;
}
.container {
    max-width: 600px;
    margin: 48px auto 32px auto;
    background: var(--bs-primary-subtle);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(var(--bs-primary-rgb),0.10);
    padding: 40px 32px 32px 32px;
    border: 1px solid var(--bs-primary-border-subtle);
}
h1 {
    color: var(--bs-primary);
    font-size: 2.2em;
    margin-bottom: 24px;
    text-align: center;
}
label[for="template-select"] {
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}
#template-select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid var(--bs-primary-border-subtle);
    border-radius: 4px;
    margin-bottom: 20px;
    background: var(--bs-primary-subtle-hover);
    color: var(--bs-primary-emphasis);
}
#markdown-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 180px;
    font-size: 16px;
    margin-bottom: 24px;
    padding: 12px;
    border: 1px solid var(--bs-primary-border-subtle);
    border-radius: 6px;
    background: #fff;
    color: var(--bs-primary-emphasis);
    resize: vertical;
    box-sizing: border-box;
    outline: none;
}
#preview-btn {
    padding: 10px 20px;
    font-size: 16px;
    background: var(--bs-primary);
    color: var(--bs-text-on-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 20px;
    margin-right: 10px;
    transition: background 0.2s;
}
#preview-btn:hover {
    background: var(--bs-primary-hover);
}

#preview-btn:disabled {
    background: #bdbdbd;
    color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}
#preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(var(--bs-primary-rgb), 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
#preview-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(var(--bs-primary-rgb),0.18);
    padding: 0;
    color: var(--bs-primary-emphasis);
    overflow-x: hidden;
    position: relative;
    opacity: 1;
    box-shadow: 0 8px 32px rgba(var(--bs-primary-rgb),0.18);
    max-width: 90vw;
    max-height: 60vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}
#close-preview {
    position: absolute;
    top: 12px;
    right: 16px;
    background: var(--bs-primary-subtle);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.5em;
    color: var(--bs-primary-emphasis);
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10001;
}
#close-preview:hover {
    background: var(--bs-primary-subtle-hover);
}
#preview-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #fff;
    border-top: 1px solid var(--bs-primary-border-subtle);
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    z-index: 10002;
    min-height: 56px;
    overflow: visible !important;
}
/* Style for both download and copy html buttons */
#download-md-btn, #copy-html-btn {
    padding: 10px 20px;
    font-size: 18px;
    background: var(--bs-primary);
    color: var(--bs-text-on-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 6px 12px;
    min-width: 48px;
    width: auto;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#download-md-btn:hover, #copy-html-btn:hover {
    background: var(--bs-primary-hover);
}
.darkmode-toggle {
    background: var(--bs-primary-emphasis);
    color: var(--bs-text-on-primary);
    border: none;
    border-radius: 16px;
    padding: 8px 18px;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(var(--bs-primary-rgb),0.08);
    transition: background 0.2s, color 0.2s;
    margin-left: 16px;
    margin-right: 0;
    font-weight: 500;
    align-self: center;
    position: static;
}
.darkmode-toggle:hover {
    background: var(--bs-primary);
    color: var(--header-text);
}
@media (max-width: 600px) {
    .darkmode-toggle {
        padding: 6px 12px;
        font-size: 13px;
        margin-left: 8px;
    }
}
