/* --- Base Styles --- */
html {
    height: 100%; /* For sticky footer */
}
body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    /* color: #1f2937; Set by JS */
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
    font-size: 16px;
    display: flex; /* Prep for sticky footer */
    flex-direction: column; /* Prep for sticky footer */
    min-height: 100%; /* Prep for sticky footer (html also needs height: 100%) */
}
.main-content { /* Wrapper for main content */
    flex-grow: 1; /* Content fills space above footer */
}
.container {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 2rem;
}
.card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

/* --- Header --- */
header { text-align: center; margin-top: 2rem; margin-bottom: 2rem; padding: 1.5rem; }
header h1 { /* color set by JS */ margin-top: 0; margin-bottom: 0.5rem; font-size: 1.8rem; line-height: 1.2; }
header p { color: #555; font-size: 1.05rem; }

/* --- Usage Guide --- */
.usage-guide { background-color: #f9fafb; border: 1px solid #e5e7eb; margin-bottom: 2rem; padding: 1rem 1.5rem; border-radius: 8px; }
.usage-guide h3 { margin-top: 0; margin-bottom: 1rem; font-size: 1.2rem; /* color set by JS */ text-align: center; }
.usage-guide ol { list-style: none; padding-left: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: space-around; gap: 0.5rem; }
.usage-guide li { font-size: 0.9rem; color: #333; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; }
.usage-guide li::before { content: counter(step-counter); counter-increment: step-counter; display: inline-block; background-color: #6366f1; /* Should be set by JS, currently CSS-dependent */ color: white; width: 1.5em; height: 1.5em; line-height: 1.5em; border-radius: 50%; text-align: center; font-weight: bold; font-size: 0.9em; flex-shrink: 0; }
body { counter-reset: step-counter; }

/* --- Input Section --- */
.input-section h2 { margin-top: 0; margin-bottom: 1.5rem; font-size: 1.5rem; text-align: center; }
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2rem; align-items: start; }
@media (max-width: 640px) { .input-grid { grid-template-columns: 1fr; } }
.input-group { margin-bottom: 0; }
.input-group label + input, .input-group label + div, .text-align-group label + div { margin-top: 0rem; }

/* --- Common Control Styles --- */
input[type="text"], input[type="number"], select, .heading-btn, .align-btn { padding: 0.7rem 0.75rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.95rem; box-sizing: border-box; height: 42px; line-height: 1.4; vertical-align: middle; background-color: white; /* color: #1f2937; Set by JS */ transition: border-color 0.2s ease, box-shadow 0.2s ease; }
input[type="text"]:focus, input[type="number"]:focus, select:focus { outline: none; border-color: #6366f1; /* Fixed color */ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2); /* Fixed color */ }
input[type="text"] { width: 100%; }

/* Font Size Group */
.input-group.font-size-group { display: flex; gap: 0.5rem; align-items: center; }
.input-group.font-size-group label { flex-shrink: 0; margin-bottom: 0; margin-top: 0; }
.input-group.font-size-group input[type="number"] { width: 70px; text-align: right; padding-right: 0.5rem; }
.input-group.font-size-group select { cursor: pointer; padding-left: 0.5rem; padding-right: 0.5rem; }

/* Heading Level Group */
.heading-level { display: flex; gap: 0.5rem; }
.heading-btn { flex-grow: 1; background-color: #f3f4f6; cursor: pointer; }

/* Text Alignment Group */
.text-align-group { display: flex; flex-direction: column; }
.align-btns { display: flex; gap: 0.5rem; }
.align-btn { flex-grow: 1; background-color: #f3f4f6; cursor: pointer; }

/* Active button common (kept as fallback, JS sets styles directly) */
.heading-btn.active, .align-btn.active { /* background-color, color, border-color set by JS */ }
.heading-btn:not(.active):hover, .align-btn:not(.active):hover { background-color: #e5e7eb; border-color: #ccc; }

label { display: block; margin-bottom: 0.5rem; font-weight: bold; /* color: #1f2937; Set by JS */ font-size: 0.95em; }

/* --- Color Settings --- */
.color-settings { margin-top: 2rem; padding: 1.5rem; background-color: #f9fafb; border-radius: 8px; }
 .color-settings h3 { margin-top: 0; margin-bottom: 0.8em; text-align: center; /* color set by JS */ }
 .color-description { font-size: 0.9em; color: #555; margin-bottom: 1.5rem; text-align: center; }
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}
.color-item { background-color: white; border: 1px solid #e5e7eb; border-radius: 6px; padding: 0.8rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; box-shadow: 0 2px 4px rgba(0,0,0,0.03); transition: box-shadow 0.3s ease; }
.color-item:hover { box-shadow: 0 4px 8px rgba(0,0,0,0.05); }
.color-item label { margin-bottom: 0; font-weight: 500; font-size: 0.95em; /* color: #1f2937; Set by JS */ cursor: help; flex-grow: 1; }
.color-item input[type="color"] { width: 45px; height: 30px; padding: 0; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; background-color: transparent; flex-shrink: 0; }
.color-item input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-item input[type="color"]::-webkit-color-swatch { border: none; border-radius: 3px; }
.color-item input[type="color"]::-moz-color-swatch { border: none; border-radius: 3px; }

/* --- Preview Section --- */
 .preview-section h2 { text-align: center; margin-top: 0; font-size: 1.5rem; }
  .preview-section p { text-align: center; margin-bottom: 1.5rem; color: #555; font-size: 0.95em; }
.design-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; margin-top: 1rem; }
@media (max-width: 768px) { .design-grid { grid-template-columns: 1fr; } }
.design-card { background-color: white; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); transition: transform 0.3s ease, border-color 0.3s ease; display: flex; flex-direction: column; border: 2px solid transparent; }
/* .design-card.selected styled directly by JS */
.design-card:hover { transform: translateY(-5px); }
.design-preview { padding: 1.5rem; min-height: 100px; display: flex; align-items: center; justify-content: center; background-color: #fff; flex-grow: 1; overflow: hidden; }
/* Apply initial styles to heading elements in preview */
.design-preview h2, .design-preview h3, .design-preview h4 {
    margin: 0;
    width: 100%;
    line-height: 1.4;
    word-wrap: break-word;
    /* font-size, text-align are set directly via JS style attribute */
}
.design-footer { padding: 1rem; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #f3f4f6; font-size: 0.9em; }
.select-btn { /* background-color set by JS */ color: white; border: none; border-radius: 4px; padding: 0.5rem 1rem; cursor: pointer; font-size: 0.9rem; transition: background-color 0.3s ease; }
.select-btn:hover { filter: brightness(90%); }

/* --- Code Section --- */
 .code-section h2 { text-align: center; margin-top: 0; font-size: 1.5rem; }
   .code-section p { text-align: center; margin-bottom: 1.5rem; color: #555; font-size: 0.95em; }
.code-display-area { margin-bottom: 1.5rem; }
.code-display-area:last-child { margin-bottom: 0; }
pre { /* background-color set by JS */ color: white; padding: 1rem; border-radius: 4px; overflow-x: auto; position: relative; padding-top: 2.5rem; margin-top: 0.5rem; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; font-size: 0.9em; }
.copy-btn { position: absolute; top: 0.5rem; right: 0.5rem; /* background-color, color set by JS */ border: none; border-radius: 4px; padding: 0.25rem 0.5rem; font-size: 0.8rem; cursor: pointer; z-index: 10; }
.copy-btn:hover { background-color: #e5e7eb; }

/* --- Heading Style Definitions (base structure only, generated/overridden by JS) --- */
.heading-style1 { position: relative; padding: 0.6em 1em; border-radius: 5px; margin-bottom: 1.5em; }
.heading-style2 { position: relative; padding: 0.5em 1.5em 0.5em 1.5em; margin-bottom: 1.5em; }
.heading-style3 { position: relative; padding-bottom: 0.5em; margin-bottom: 1.5em; }
.heading-style3::after { position: absolute; bottom: -3px; left: 0; content: ''; width: 30%; height: 3px; /* background set by JS */ }
.heading-style4 { position: relative; padding: 1em; border-radius: 5px; margin-bottom: 1.5em; }
.heading-style4::before { content: ""; position: absolute; top: 100%; left: 30px; border: 15px solid transparent; margin-top: -1px; /* border-top set by JS */ }
.heading-style5 { position: relative; padding: 0.8em; border-radius: 5px; margin-bottom: 1.5em; /* border set by JS */ }
.heading-style6 { position: relative; padding: 0.5em 1em; margin-bottom: 1.5em; border-radius: 3px 3px 0 0; /* background, color set by JS */ }
.heading-style6::before { position: absolute; content: ''; top: 100%; left: 0; border: none; border-bottom: solid 15px transparent; /* border-right set by JS */ }
.heading-style7 { position: relative; display: flex; align-items: center; padding: 0.5em 1em; margin-bottom: 1.5em; }
.heading-style7::before, .heading-style7::after { content: ''; flex-grow: 1; height: 2px; /* background-color set by JS */ margin: 0 0.8em; }
.heading-style8 { /* background gradient and text clip set by JS */ font-weight: bold; padding: 0.2em 0; margin-bottom: 1.5em; }
.heading-style9 { position: relative; padding: 0.5em 0.5em 0.5em 2em; margin-bottom: 1.5em; /* border-bottom set by JS */ }
.heading-style9::before { content: '◆'; position: absolute; left: 0.5em; top: 50%; transform: translateY(-50%); font-size: 0.9em; /* color set by JS */ }
.heading-style10 { padding: 0.8em 1em; border-radius: 5px; margin-bottom: 1.5em; /* color, background set by JS */ }
.heading-style11 { padding-bottom: 0.6em; margin-bottom: 1.5em; position: relative; background-position: left bottom; background-size: 10px 3px; background-repeat: repeat-x; /* color, background-image set by JS */ }
.heading-style12 { background: #fffacd; /* Fixed color */ padding: 1em 1.5em; margin-bottom: 1.5em; box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1); position: relative; /* color, border-left set by JS */ }
.heading-style12::after { content: ''; position: absolute; top: 0; right: 0; border-width: 0 20px 20px 0; border-style: solid; box-shadow: -1px 1px 2px rgba(0,0,0,0.1); /* border-color set by JS */ }
.heading-style13 { display: inline-block; position: relative; padding: 0.2em 0; margin-bottom: 1.5em; z-index: 1; /* color set by JS */ }
.heading-style13::before { content: ''; position: absolute; left: 0; bottom: -0.1em; width: 100%; height: 0.5em; opacity: 0.7; z-index: -1; border-radius: 2px; /* background-color set by JS */ }
.heading-style14 { position: relative; padding: 0.5em 2.5em 0.5em 0.5em; margin-bottom: 1.5em; /* color, border-bottom set by JS */ }
.heading-style14::after { content: '→'; position: absolute; right: 0.5em; top: 50%; transform: translateY(-50%); font-size: 1.2em; font-weight: bold; /* color set by JS */ }
.heading-style15 { padding: 0.8em 1.2em; border-radius: 8px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15), 0 2px 5px rgba(0, 0, 0, 0.1); margin-bottom: 1.5em; border: 1px solid #eee; /* background-color, color set by JS */ }
.heading-style16 { position: relative; padding-bottom: 0.8em; margin-bottom: 1.5em; /* color, border-bottom set by JS */ }
.heading-style16::after { content: ''; position: absolute; left: 0; bottom: -8px; width: 100%; height: 2px; /* background-color set by JS */ }

/* --- SEO Content --- */
.seo-content { margin-top: 3rem; padding: 2.5rem; background-color: white; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); line-height: 1.8; font-size: 0.95rem; color: #444; margin-bottom: 2rem; }
.seo-content h2 { text-align: center; /* color set by JS */ margin-top: 0; margin-bottom: 2rem; font-size: 1.8rem; font-weight: 600; line-height: 1.2; }
.seo-content h3 { /* color, border-bottom-color set by JS */ padding-bottom: 0.5rem; margin-top: 2.5rem; margin-bottom: 1.5rem; font-size: 1.4rem; font-weight: 600; line-height: 1.3em;}
.seo-content p { margin-bottom: 1.2rem; }
.seo-content ul, .seo-content ol { margin-left: 0; margin-bottom: 1.5rem; padding-left: 1.8rem; }
.seo-content ul li { list-style-type: disc; margin-bottom: 0.6rem; }
.seo-content ol li { list-style-type: decimal; margin-bottom: 0.6rem; }
.seo-content strong { /* color: #1f2937; Set by JS */ font-weight: 600; }
.seo-content a { /* color set by JS */ text-decoration: none; font-weight: 500; transition: color 0.2s ease; }
.seo-content a:hover { color: #8b5cf6; /* Fixed color */ text-decoration: underline; }
.seo-content code { background-color: #f0f2f5; padding: 0.2em 0.4em; border-radius: 4px; font-size: 0.9em; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; }

/* --- Footer --- */
footer {
    padding: 1.5rem 0;
    background-color: #f9fafb;
    flex-shrink: 0;
}
.copyright {
    font-size: 0.9em;
    text-align: center;
    color: #555;
    margin: 0;
}
footer .container {
    padding-top: 0;
    padding-bottom: 0;
}
footer a {
    /* color set by JS */
    text-decoration: none;
}
 footer a:hover {
    color: #8b5cf6; /* Fixed color */
    text-decoration: underline;
 }