@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Source+Code+Pro:wght@400;500;600&family=Comic+Neue:wght@700&display=swap');

/* Base transitions */
.transition-all {
    transition: all 0.3s ease;
}

/* Theme variables and styles */
.theme-neon {
    --bg-primary: #000;
    --bg-secondary: #111;
    --text-primary: #0f0;
    --text-secondary: #0a0;
    --border-color: #0a0;
    --accent-color: #0f0;
    --editor-bg: #000;
    --preview-bg: #111;
    font-family: 'Source Code Pro', monospace;
}

.theme-minimal {
    --bg-primary: #111;
    --bg-secondary: #222;
    --text-primary: #fff;
    --text-secondary: #ccc;
    --border-color: #444;
    --accent-color: #4f46e5;
    --editor-bg: #111;
    --preview-bg: #222;
    font-family: 'Inter', sans-serif;
}

.theme-funny {
    --bg-primary: #ffeb3b;
    --bg-secondary: #ffc107;
    --text-primary: #9c27b0;
    --text-secondary: #673ab7;
    --border-color: #e91e63;
    --accent-color: #e91e63;
    --editor-bg: #ffeb3b;
    --preview-bg: #ffc107;
    font-family: 'Comic Neue', cursive;
}

.theme-light {
    --bg-primary: #f5f5f5;
    --bg-secondary: #fff;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #ddd;
    --accent-color: #4f46e5;
    --editor-bg: #f5f5f5;
    --preview-bg: #fff;
    font-family: 'Inter', sans-serif;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    min-width: 120px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 8px;
    position: absolute;
    z-index: 1000;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 5px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    will-change: opacity, transform;
}

.tooltip .tooltip-text::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #333 transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Markdown preview styles */
.markdown-preview {
    overflow-x: auto;
    max-width: 100%;
    white-space: pre-wrap;
    line-height: 1.5;
    padding: 0.5em;
    contain: content;
}

/* Headers */
.markdown-preview h1,
.markdown-preview h2 {
    margin: 0.5em 0;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
    white-space: normal;
}

.markdown-preview h1 { font-size: 2em; }
.markdown-preview h2 { font-size: 1.5em; }
.markdown-preview h3 { font-size: 1.25em; }
.markdown-preview h4 { font-size: 1.1em; }
.markdown-preview h5 { font-size: 1em; }
.markdown-preview h6 { font-size: 0.9em; }

.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    margin: 0.5em 0;
    font-weight: bold;
    white-space: normal;
}

.markdown-preview h5 { letter-spacing: 0.5px; }
.markdown-preview h6 { color: var(--text-secondary); }

/* Text elements */
.markdown-preview p {
    margin: 0.5em 0;
    white-space: pre-wrap;
    padding: 0.25em 0;
}

.markdown-preview a {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Lists */
.markdown-preview ul,
.markdown-preview ol {
    margin: 0.5em 0;
    padding-left: 2em;
}

.markdown-preview ul { list-style-type: disc; }
.markdown-preview ol { list-style-type: decimal; }
.markdown-preview ol ol { list-style-type: lower-roman; }
.markdown-preview ol ol ol { list-style-type: lower-alpha; }

.markdown-preview li {
    margin: 0.25em 0;
    display: list-item;
}

/* Code blocks and inline code */
.markdown-preview code {
    background-color: var(--bg-secondary);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.9em;
    white-space: pre;
    position: relative;
    display: inline-block;
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.markdown-preview pre {
    margin: 1.5em 0;
    padding: 1.5em;
    background-color: #1a1a1a;
    border-radius: 12px;
    overflow-x: auto;
    font-family: 'Source Code Pro', monospace;
    line-height: 1.6;
    position: relative;
    border: 1px solid #333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    contain: content;
}

.markdown-preview pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 0.95em;
    white-space: pre;
    display: block;
    color: #e0e0e0;
    border: none;
    box-shadow: none;
}

/* Copy button styles */
.markdown-preview .copy-button {
    position: absolute;
    top: 0.75em;
    right: 0.75em;
    padding: 0.35em 0.6em;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #e0e0e0;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 0.85em;
    line-height: 1;
    backdrop-filter: blur(4px);
    will-change: opacity, transform;
}

.markdown-preview pre:hover .copy-button,
.markdown-preview code:hover .copy-button {
    opacity: 1;
}

.markdown-preview .copy-button:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.markdown-preview .copy-button.copied {
    background-color: #10B981;
    color: white;
    border-color: #10B981;
}

/* Inline code copy button */
.markdown-preview code .copy-button {
    top: 50%;
    transform: translateY(-50%);
    right: 0.25em;
    padding: 0.15em 0.3em;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.markdown-preview code .copy-button:hover {
    transform: translateY(-50%) translateY(-1px);
}

/* Theme-specific code block styles */
.theme-light .markdown-preview pre {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.theme-light .markdown-preview pre code {
    color: #212529;
}

.theme-neon .markdown-preview pre {
    background-color: #000;
    border-color: var(--accent-color);
}

.theme-neon .markdown-preview pre code {
    color: var(--accent-color);
}

.theme-funny .markdown-preview pre {
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.theme-funny .markdown-preview pre code {
    color: #856404;
}

/* Block elements */
.markdown-preview blockquote {
    margin: 0.5em 0;
    padding-left: 1em;
    border-left: 4px solid var(--accent-color);
    color: var(--text-secondary);
}

.markdown-preview img {
    margin: 0.5em 0;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.markdown-preview hr {
    margin: 0.5em 0;
    border: none;
    border-top: 3px solid var(--border-color);
    height: 3px;
}

/* Tables */
.markdown-preview table {
    margin: 0.5em 0;
    border-collapse: collapse;
    width: 100%;
}

.markdown-preview table th,
.markdown-preview table td {
    padding: 0.5em;
    border: 1px solid var(--border-color);
    text-align: left;
}

.markdown-preview table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
}

.markdown-preview table tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

.markdown-preview table tr:hover {
    background-color: var(--bg-primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Mobile menu styles */
#mobile-menu {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: opacity, visibility;
}

#mobile-menu.active {
    opacity: 1;
    visibility: visible;
}

#mobile-menu > div {
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

#mobile-menu.active > div {
    transform: translateX(0);
}

#mobile-menu .theme-btn {
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

#mobile-menu .theme-btn:hover {
    background-color: var(--bg-primary);
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
}

/* Footer styles */
footer {
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: all 0.3s ease;
}

footer span {
    white-space: nowrap;
    transition: all 0.2s ease;
}

footer i {
    transition: transform 0.2s ease;
}

footer i.fa-heart:hover {
    transform: scale(1.2);
}

@media (max-width: 768px) {
    footer {
        padding: 0.75rem 1rem;
    }
    
    footer span {
        font-size: 0.8125rem;
    }
    
    footer i {
        font-size: 0.875rem;
    }
}