/* MD Viewer styles. */

/* Markdown styling */
#content h1 { margin: 32px 0 16px 0; font-size: 32px; font-weight: 700; }
#content h2 { margin: 28px 0 14px 0; font-size: 24px; font-weight: 700; border-bottom: 1px solid #e0e0e0; padding-bottom: 8px; }
#content h3 { margin: 24px 0 12px 0; font-size: 20px; font-weight: 600; }
#content h4 { margin: 18px 0 10px 0; font-size: 18px; font-weight: 600; }
#content h5 { margin: 16px 0 8px 0; font-size: 16px; font-weight: 600; }
#content h6 { margin: 14px 0 8px 0; font-size: 14px; font-weight: 600; color: #666; }

#content p {
    margin: 12px 0;
}

#content ul, #content ol {
    margin: 12px 0 12px 24px;
}

#content li {
    margin: 6px 0;
}

#content code {
    background: #f4f4f4;
    padding: 3px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #d63384;
}

#content pre {
    background: #f4f4f4;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 12px 0;
    border-left: 4px solid #007bff;
}

#content pre code {
    background: none;
    padding: 0;
    color: #333;
}

#content pre.mermaid {
    border-left: none;
    background: var(--bg-secondary);
    padding: 20px;
    text-align: center;
}

#content pre.mermaid svg {
    max-width: 100%;
    height: auto;
}

#content pre.mermaid-error {
    border-left-color: #dc3545;
    color: #842029;
    text-align: left;
    white-space: pre-wrap;
}

#content blockquote {
    border-left: 4px solid #ddd;
    padding-left: 16px;
    margin: 12px 0;
    color: #666;
    font-style: italic;
}

#content a {
    color: #007bff;
    text-decoration: none;
}

#content a:hover {
    text-decoration: underline;
}

#content table {
    border-collapse: collapse;
    margin: 12px 0;
    width: 100%;
}

#content th, #content td {
    border: 1px solid #ddd;
    padding: 10px 12px;
    text-align: left;
}

#content th {
    background: #f9f9f9;
    font-weight: 600;
}

#content hr {
    margin: 24px 0;
    border: none;
    border-top: 2px solid #e0e0e0;
}

/* Form element styling */
#content input[type="text"],
#content input[type="number"],
#content input[type="date"],
#content input[type="datetime-local"],
#content input[type="time"],
#content input[type="color"],
#content textarea,
#content select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s;
}

#content input[type="text"]:focus,
#content input[type="number"]:focus,
#content input[type="date"]:focus,
#content input[type="datetime-local"]:focus,
#content input[type="time"]:focus,
#content input[type="color"]:focus,
#content textarea:focus,
#content select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

#content textarea {
    resize: vertical;
    min-height: 80px;
}

#content select {
    cursor: pointer;
}

/* Checkbox and Radio styling */
.form-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    padding: 6px 0;
}

.form-item input[type="checkbox"],
.form-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #007bff;
}

.form-item label {
    cursor: pointer;
    flex: 1;
    user-select: none;
    margin: 0;
}

.form-item input[type="checkbox"]:checked + label {
    text-decoration: line-through;
    color: #999;
}

/* Rating styling */
.rating-wrapper {
    display: flex;
    gap: 8px;
    margin: 8px 0;
    align-items: center;
}

.rating-wrapper .star {
    font-size: 24px;
    cursor: pointer;
    color: #ddd;
    transition: color 0.2s;
    user-select: none;
}

.rating-wrapper .star.filled {
    color: #ffc107;
}

.rating-wrapper .star:hover,
.rating-wrapper .star.hover {
    color: #ffc107;
}

/* Collapsible styling */
#content details {
    margin: 12px 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
}

#content details summary {
    cursor: pointer;
    font-weight: 600;
    user-select: none;
    outline: none;
}

#content details summary:hover {
    color: #007bff;
}

#content details[open] summary {
    margin-bottom: 12px;
}

#content details > *:not(summary) {
    margin-left: 12px;
}

/* Save and restore buttons */
#saveBtn, #restoreBtn {
    width: 40px;
    height: 40px;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    padding: 0;
}

#saveBtn {
    background: #007bff;
}

#restoreBtn {
    background: #6c757d;
}

#saveBtn:hover {
    background: #0056b3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

#restoreBtn:hover {
    background: #545b62;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

#saveBtn:active, #restoreBtn:active {
    transform: scale(0.95);
}

#saveBtn.visible, #restoreBtn.visible {
    display: flex;
}

#saveBtn svg, #restoreBtn svg {
    width: 20px;
    height: 20px;
}
