/* Markdown Formatter Styling */

/* Textarea Styling */
.markdown-textarea {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    tab-size: 2;
    resize: vertical;
}

/* Output Container */
.markdown-output {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    max-height: 600px;
    overflow: auto;
}

.markdown-output pre {
    margin: 0;
    background: transparent;
    border: none;
    padding: 0;
}

.markdown-output code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Markdown Preview Styling */
.markdown-preview {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #24292e;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-preview h1 {
    font-size: 2em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

.markdown-preview h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

.markdown-preview h3 {
    font-size: 1.25em;
}

.markdown-preview h4 {
    font-size: 1em;
}

.markdown-preview h5 {
    font-size: 0.875em;
}

.markdown-preview h6 {
    font-size: 0.85em;
    color: #6a737d;
}

.markdown-preview p {
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-preview ul,
.markdown-preview ol {
    margin-top: 0;
    margin-bottom: 16px;
    padding-left: 2em;
}

.markdown-preview li {
    margin-bottom: 0.25em;
}

.markdown-preview li + li {
    margin-top: 0.25em;
}

.markdown-preview code {
    background-color: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
    font-size: 85%;
    margin: 0;
    padding: 0.2em 0.4em;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.markdown-preview pre {
    background-color: #f6f8fa;
    border-radius: 6px;
    font-size: 85%;
    line-height: 1.45;
    overflow: auto;
    padding: 16px;
    margin-bottom: 16px;
}

.markdown-preview pre code {
    background-color: transparent;
    border: 0;
    display: inline;
    line-height: inherit;
    margin: 0;
    overflow: visible;
    padding: 0;
    word-wrap: normal;
}

.markdown-preview blockquote {
    border-left: 4px solid #dfe2e5;
    color: #6a737d;
    padding: 0 1em;
    margin: 0 0 16px 0;
}

.markdown-preview blockquote > :first-child {
    margin-top: 0;
}

.markdown-preview blockquote > :last-child {
    margin-bottom: 0;
}

.markdown-preview a {
    color: #0366d6;
    text-decoration: none;
}

.markdown-preview a:hover {
    text-decoration: underline;
}

.markdown-preview img {
    max-width: 100%;
    box-sizing: content-box;
    background-color: #fff;
}

.markdown-preview hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: #e1e4e8;
    border: 0;
}

.markdown-preview strong {
    font-weight: 600;
}

.markdown-preview em {
    font-style: italic;
}

/* Dark Mode for Markdown Preview */
[data-bs-theme="dark"] .markdown-preview {
    color: #e9ecef;
}

[data-bs-theme="dark"] .markdown-preview h1,
[data-bs-theme="dark"] .markdown-preview h2 {
    border-bottom-color: #343a40;
}

[data-bs-theme="dark"] .markdown-preview h6 {
    color: #9ca3af;
}

[data-bs-theme="dark"] .markdown-preview code {
    background-color: rgba(110, 118, 129, 0.2);
}

[data-bs-theme="dark"] .markdown-preview pre {
    background-color: #1a1d23;
}

[data-bs-theme="dark"] .markdown-preview blockquote {
    border-left-color: #495057;
    color: #9ca3af;
}

[data-bs-theme="dark"] .markdown-preview a {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .markdown-preview hr {
    background-color: #495057;
}

/* Statistics Container */
.stats-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    min-width: 140px;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
}

[data-bs-theme="dark"] .stats-container {
    background: #1a1d23;
    border-color: #343a40;
}

[data-bs-theme="dark"] .stat-label {
    color: #9ca3af;
}

[data-bs-theme="dark"] .stat-value {
    color: #e9ecef;
}

/* Status Message */
#statusMessage {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#statusContent {
    margin-bottom: 0;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
}

/* Alert Colors */
.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.alert-info {
    background-color: #cff4fc;
    border-color: #b6effb;
    color: #055160;
}

[data-bs-theme="dark"] .alert-success {
    background-color: #0f5132;
    border-color: #146c43;
    color: #d1e7dd;
}

[data-bs-theme="dark"] .alert-danger {
    background-color: #842029;
    border-color: #a52834;
    color: #f8d7da;
}

[data-bs-theme="dark"] .alert-info {
    background-color: #055160;
    border-color: #087990;
    color: #cff4fc;
}

/* Button Styling */
.toolBtn {
    transition: all 0.2s ease;
    border-radius: 6px;
    font-weight: 500;
    padding: 8px 16px;
}

.toolBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.toolBtn:active {
    transform: translateY(0);
}

/* To HTML Button - Custom Style */
.btn-to-html {
    background-color: transparent;
    border: 1px solid #052c65;
    color: #052c65;
}

.btn-to-html .fsvg {
    filter: none;
}

.btn-to-html:hover {
    background-color: #052c65;
    border-color: #052c65;
    color: #ffffff;
}

.btn-to-html:hover .fsvg {
    filter: brightness(0) invert(1);
}

[data-bs-theme="dark"] .btn-to-html {
    border-color: #6ea8fe;
    color: #6ea8fe;
}

[data-bs-theme="dark"] .btn-to-html:hover {
    background-color: #6ea8fe;
    border-color: #6ea8fe;
    color: #000000;
}

[data-bs-theme="dark"] .btn-to-html:hover .fsvg {
    filter: none;
}

/* Form Controls Dark Mode */
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .markdown-textarea {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-select:focus,
[data-bs-theme="dark"] .markdown-textarea:focus {
    background-color: #212529;
    border-color: #86b7fe;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-check-input {
    background-color: #495057;
    border-color: #6c757d;
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: #6ea8fe;
    border-color: #6ea8fe;
}

[data-bs-theme="dark"] .form-check-label {
    color: #e9ecef;
}

[data-bs-theme="dark"] .markdown-output {
    background: #1a1d23;
    border-color: #343a40;
}

/* Form Labels */
.form-group label {
    color: #212529;
}

[data-bs-theme="dark"] .form-group label {
    color: #e9ecef;
}

/* Responsive Design */
@media (max-width: 768px) {
    .toolBtn {
        width: 100%;
        margin-bottom: 5px;
    }

    .markdown-textarea {
        font-size: 13px;
    }

    .stats-container {
        gap: 10px;
        padding: 10px;
    }

    .stat-item {
        min-width: 100px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-value {
        font-size: 16px;
    }

    .markdown-preview {
        font-size: 14px;
    }
}

/* Loading Animation */
.toolBtn.loading {
    position: relative;
    pointer-events: none;
}

.toolBtn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

/* Focus States */
.markdown-textarea:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Placeholder Styling */
.markdown-textarea::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

[data-bs-theme="dark"] .markdown-textarea::placeholder {
    color: #9ca3af;
    opacity: 0.8;
}
