/* Responsive width classes for larger screens */
@media (min-width: 769px) {
    .md\:w-1\/2 {
        width: 50%;
    }
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

/* Flexible layout for document list */
#documentList {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#documentList > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 0.25rem;
}

#documentList > div > span {
    flex: 1;
    min-width: 0;
    margin-right: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#documentList > div > div {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#documentList > div > div > span {
    display: none;  /* Hide tags by default */
    margin-right: 0.5rem;
    font-size: 0.875rem;
    color: #718096;
}

#documentList > div > div > button {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border-radius: 0.25rem;
    background-color: #EF4444;
    color: white;
    transition: background-color 0.2s;
    white-space: nowrap;
    width: auto;  /* Override the general button style */
    margin-bottom: 0;  /* Override the general button style */
}

#documentList > div > div > button:hover {
    background-color: #DC2626;
}

/* Media query for larger screens */
@media (min-width: 640px) {
    #documentList > div > div > span {
        display: inline;  /* Show tags on larger screens */
    }
}

/* Styles for new Markdown features */
.footnotes {
    border-top: 1px solid #e2e8f0;
    margin-top: 2rem;
    padding-top: 1rem;
}

.footnotes li {
    font-size: 0.875rem;
    color: #4a5568;
}

dl {
    margin-bottom: 1rem;
}

dt {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

dd {
    margin-left: 1rem;
    margin-bottom: 1rem;
}

mark {
    background-color: #fefcbf;
    padding: 0.2em;
}

/* Dark mode styles */
.dark mark {
    background-color: #744210;
    color: #fff;
}

.dark .footnotes {
    border-top-color: #4a5568;
}

.dark .footnotes li {
    color: #a0aec0;
}

/* Responsive button styles */
button {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    button:not(#documentList button) {  /* Exclude document list buttons */
        width: 100%;
        margin-bottom: 0.5rem;
    }
} 

/* Custom scrollbar styles */
/* Webkit browsers (Chrome, Safari) */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar-track {
    background: #2d3748;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4a5568;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.dark * {
    scrollbar-color: #4a5568 #2d3748;
}

.h-custom-large {
    height: 600px;
    min-height: 600px;
}

/* Add a class for Unicode subscripts if needed */
.unicode-subscript {
    font-family: 'Noto Sans', 'Noto Serif', sans-serif;
    /* No additional styling needed as the characters are already subscripts */
}

/* Task list container */
ul.contains-task-list {
    list-style-type: none;
    padding-left: 0;
}

/* Task list item */
li.task-list-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5em;
}

/* Remove default bullet points */
li.task-list-item::before {
    content: none;
}

/* Custom checkbox */
.task-list-item-checkbox {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 1.2em;
    height: 1.2em;
    border: 2px solid #ccc;
    border-radius: 0.25em;
    margin-right: 0.75em;
    cursor: pointer;
    position: relative;
    background-color: white;
}

.task-list-item-checkbox:checked {
    background-color: #4299e1;
    border-color: #4299e1;
}

.task-list-item-checkbox:checked::after {
    content: '\2714';
    font-size: 1em;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Hide any default checkboxes that might be rendered by the font */
.task-list-item span input[type="checkbox"] {
    display: none;
}

/* Ensure space after checkbox */
.task-list-item-checkbox + span {
    margin-left: 0.25em;
}

/* Link styling */
a {
    color: #3B82F6;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #2563EB;
    text-decoration: underline;
}

/* Table column spacing */
table {
    border-collapse: separate;
    border-spacing: 0 0.5em;
}

th, td {
    padding: 0.5em 1em;
}

/* Button styling */
button:not(.delete-button) {
    background-color: #3B82F6;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

button:not(.delete-button):hover {
    background-color: #2563EB;
}

.delete-button {
    background-color: #EF4444;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.delete-button:hover {
    background-color: #DC2626;
}

/* Dark mode adjustments */
.dark a {
    color: #3B82F6;
}

.dark a:hover {
    color: #2563EB;
}

.dark button:not(.delete-button) {
    background-color: #3B82F6;
}

.dark button:not(.delete-button):hover {
    background-color: #2563EB;
}

.dark .delete-button {
    background-color: #EF4444;
}

.dark .delete-button:hover {
    background-color: #DC2626;
}

/* ============================================================================
   New Features - v1.4.0
   ============================================================================ */

/* Keyboard shortcuts section */
kbd {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', 'Droid Sans Mono', monospace;
    font-size: 0.75rem;
}

/* Auto-save indicator animation */
#autoSaveIndicator {
    transition: background-color 0.3s ease;
}

#autoSaveIndicator.bg-green-500 {
    animation: pulse-green 2s ease-in-out;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Undo/Redo buttons */
#undoButton, #redoButton {
    font-size: 0.875rem;
    min-width: 70px;
}

#undoButton:disabled, #redoButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Word count display */
#wordCount,
#autoSaveText {
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Monaco', monospace;
}

/* Document search input */
#documentSearch {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#documentSearch:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Export buttons container */
.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Focus visible styles for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* Skip to main content link (accessibility) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #3B82F6;
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Document list improvements */
#documentList button {
    background: transparent;
}

#documentList > div {
    transition: background-color 0.15s ease;
}

/* Auto-save toggle button states */
#toggleAutoSave {
    transition: background-color 0.2s ease;
}

#toggleAutoSave.bg-green-600:hover {
    background-color: #059669;
}

/* Dark mode specific improvements */
.dark #documentSearch {
    border-color: #4B5563;
}

.dark #documentSearch:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.dark kbd {
    background-color: #374151;
    color: #E5E7EB;
}

/* Smooth transitions for theme switching */
* {
    transition-property: background-color, border-color, color;
    transition-duration: 0.15s;
    transition-timing-function: ease;
}

/* Exclude certain elements from transition */
textarea, input, pre, code {
    transition: none;
}

/* Print styles */
@media print {
    header, footer, #documentList, #customCSS, .export-buttons,
    #undoButton, #redoButton, #toggleAutoSave, #copyButton,
    #fileInput, #documentSearch, #saveDocument {
        display: none !important;
    }

    #preview {
        border: none !important;
        height: auto !important;
        overflow: visible !important;
    }

    body {
        background: white !important;
    }
}