/**
 * Markdown to HTML Converter Tool Styles
 * Extends main.css with tool-specific styling
 */

.markdown-to-html-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.input-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.textarea-wrapper {
    position: relative;
}

.markdown-textarea {
    width: 100%;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2937;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.markdown-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.markdown-textarea::placeholder {
    color: #6b7280;
    opacity: 0.6;
}

/* Options Container */
.options-container {
    padding: 1.25rem;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.options-title {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: center;
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.option-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color, #3b82f6);
}

.checkbox-label {
    font-size: 0.95rem;
    color: #1f2937;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-convert,
.btn-clear,
.btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-convert {
    background: var(--primary-color, #3b82f6);
    color: white;
    flex: 1;
}

.btn-convert:hover {
    background: var(--primary-dark, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-clear {
    background: #f3f4f6;
    color: #1f2937;
    border: 2px solid #e5e7eb;
}

.btn-clear:hover {
    background: #e5e7eb;
    border-color: #6b7280;
}

.btn-copy {
    background: var(--success-color, #10b981);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-copy:hover {
    background: var(--success-dark, #059669);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Output Section */
.output-section {
    margin-top: 1rem;
}

.output-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    background: transparent;
    border: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #1f2937;
    background: #f3f4f6;
}

.tab-btn.active {
    color: var(--primary-color, #3b82f6);
    background: #eff6ff;
    border-bottom: 2px solid var(--primary-color, #3b82f6);
    margin-bottom: -2px;
}

.output-container {
    margin-top: 0.5rem;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.output-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.html-output {
    background: #f8f9fa;
}

/* Preview Output */
.preview-output {
    padding: 1.5rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
}

/* Markdown Preview Styling */
.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    color: #1f2937;
}

.markdown-preview h1 { font-size: 2rem; }
.markdown-preview h2 { font-size: 1.5rem; }
.markdown-preview h3 { font-size: 1.25rem; }
.markdown-preview h4 { font-size: 1.125rem; }
.markdown-preview h5 { font-size: 1rem; }
.markdown-preview h6 { font-size: 0.875rem; }

.markdown-preview p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.markdown-preview a {
    color: var(--primary-color, #3b82f6);
    text-decoration: underline;
}

.markdown-preview ul,
.markdown-preview ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-preview li {
    margin-bottom: 0.5rem;
}

.markdown-preview code {
    background: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875em;
}

.markdown-preview pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-preview pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.markdown-preview blockquote {
    border-left: 4px solid var(--primary-color, #3b82f6);
    padding-left: 1rem;
    margin: 1rem 0;
    color: #6b7280;
    font-style: italic;
}

.markdown-preview table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-preview th,
.markdown-preview td {
    border: 1px solid #e5e7eb;
    padding: 0.75rem;
    text-align: left;
}

.markdown-preview th {
    background: #f8f9fa;
    font-weight: 600;
}

.markdown-preview hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 1.5rem 0;
}

.markdown-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Copy Notification */
.copy-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--success-color, #10b981);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 600;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-convert,
    .btn-clear {
        width: 100%;
    }

    .output-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .copy-notification {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
}

/* ============================================
   Dark Theme Support - System Preference
   ============================================ */
@media (prefers-color-scheme: dark) {
    .input-label,
    .output-label {
        color: #e2e8f0;
    }

    .markdown-textarea {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    .markdown-textarea::placeholder {
        color: #94a3b8;
    }

    .options-container {
        background: #1e293b;
        border-color: #334155;
    }

    .options-title {
        color: #e2e8f0;
    }

    .checkbox-label {
        color: #e2e8f0;
    }

    .btn-clear {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    .btn-clear:hover {
        background: #334155;
        border-color: #475569;
    }

    .output-tabs {
        border-color: #334155;
    }

    .tab-btn {
        color: #94a3b8;
    }

    .tab-btn:hover {
        color: #e2e8f0;
        background: #334155;
    }

    .tab-btn.active {
        background: #1e3a5f;
        color: #60a5fa;
        border-color: #60a5fa;
    }

    .html-output {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    .preview-output {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    .markdown-preview h1,
    .markdown-preview h2,
    .markdown-preview h3,
    .markdown-preview h4,
    .markdown-preview h5,
    .markdown-preview h6 {
        color: #e2e8f0;
    }

    .markdown-preview code {
        background: #334155;
        color: #e2e8f0;
    }

    .markdown-preview blockquote {
        color: #94a3b8;
    }

    .markdown-preview th,
    .markdown-preview td {
        border-color: #334155;
    }

    .markdown-preview th {
        background: #334155;
    }

    .markdown-preview hr {
        border-color: #334155;
    }
}

/* ============================================
   Light Theme Specific (when explicitly set)
   ============================================ */
[data-theme="light"] .input-label,
[data-theme="light"] .output-label {
    color: #1f2937;
}

[data-theme="light"] .markdown-textarea {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] .options-container {
    background: #f8f9fa;
    border-color: #e5e7eb;
}

[data-theme="light"] .options-title {
    color: #1f2937;
}

[data-theme="light"] .checkbox-label {
    color: #1f2937;
}

[data-theme="light"] .btn-clear {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] .btn-clear:hover {
    background: #e5e7eb;
    border-color: #6b7280;
}

[data-theme="light"] .output-tabs {
    border-color: #e5e7eb;
}

[data-theme="light"] .tab-btn {
    color: #6b7280;
}

[data-theme="light"] .tab-btn:hover {
    color: #1f2937;
    background: #f3f4f6;
}

[data-theme="light"] .tab-btn.active {
    background: #eff6ff;
    color: #3b82f6;
    border-color: #3b82f6;
}

[data-theme="light"] .html-output {
    background: #f8f9fa;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] .preview-output {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] .markdown-preview h1,
[data-theme="light"] .markdown-preview h2,
[data-theme="light"] .markdown-preview h3,
[data-theme="light"] .markdown-preview h4,
[data-theme="light"] .markdown-preview h5,
[data-theme="light"] .markdown-preview h6 {
    color: #1f2937;
}

[data-theme="light"] .markdown-preview code {
    background: #f3f4f6;
    color: #1f2937;
}

[data-theme="light"] .markdown-preview blockquote {
    color: #6b7280;
}

[data-theme="light"] .markdown-preview th,
[data-theme="light"] .markdown-preview td {
    border-color: #e5e7eb;
}

[data-theme="light"] .markdown-preview th {
    background: #f8f9fa;
}

[data-theme="light"] .markdown-preview hr {
    border-color: #e5e7eb;
}

/* ============================================
   Dark Theme Specific (when explicitly set)
   ============================================ */
[data-theme="dark"] .input-label,
[data-theme="dark"] .output-label {
    color: #e2e8f0;
}

[data-theme="dark"] .markdown-textarea {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .markdown-textarea::placeholder {
    color: #94a3b8;
}

[data-theme="dark"] .options-container {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .options-title {
    color: #e2e8f0;
}

[data-theme="dark"] .checkbox-label {
    color: #e2e8f0;
}

[data-theme="dark"] .btn-clear {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .btn-clear:hover {
    background: #334155;
    border-color: #475569;
}

[data-theme="dark"] .output-tabs {
    border-color: #334155;
}

[data-theme="dark"] .tab-btn {
    color: #94a3b8;
}

[data-theme="dark"] .tab-btn:hover {
    color: #e2e8f0;
    background: #334155;
}

[data-theme="dark"] .tab-btn.active {
    background: #1e3a5f;
    color: #60a5fa;
    border-color: #60a5fa;
}

[data-theme="dark"] .html-output {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .preview-output {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .markdown-preview h1,
[data-theme="dark"] .markdown-preview h2,
[data-theme="dark"] .markdown-preview h3,
[data-theme="dark"] .markdown-preview h4,
[data-theme="dark"] .markdown-preview h5,
[data-theme="dark"] .markdown-preview h6 {
    color: #e2e8f0;
}

[data-theme="dark"] .markdown-preview code {
    background: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .markdown-preview blockquote {
    color: #94a3b8;
}

[data-theme="dark"] .markdown-preview th,
[data-theme="dark"] .markdown-preview td {
    border-color: #334155;
}

[data-theme="dark"] .markdown-preview th {
    background: #334155;
}

[data-theme="dark"] .markdown-preview hr {
    border-color: #334155;
}
