/* Notes App Styles */

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2em;
    min-height: calc(100vh - 60px);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2em;
    padding-bottom: 1em;
}

.page-header h1 {
    margin: 0;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 2.5em;
    font-weight: 300;
}

/* Notes List */
.notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5em;
}

.note-card {
    background: white;
    border: none;
    border-radius: 12px;
    padding: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1),
                0 1px 3px rgba(0, 0, 0, 0.08);
}

.note-card:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15),
                0 6px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.note-card-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #667eea;
    margin: 0 0 0.75em 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-card-preview {
    color: #555;
    font-size: 0.95em;
    line-height: 1.6;
    max-height: 4.5em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Simplified markdown styling in card previews */
.note-card-preview h1,
.note-card-preview h2,
.note-card-preview h3,
.note-card-preview h4,
.note-card-preview h5,
.note-card-preview h6 {
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 0.25em 0;
    color: #333;
}

.note-card-preview p {
    margin: 0 0 0.5em 0;
}

.note-card-preview p:last-child {
    margin-bottom: 0;
}

.note-card-preview strong {
    font-weight: 600;
    color: #333;
}

.note-card-preview em {
    font-style: italic;
}

.note-card-preview code {
    background: #f8f9fa;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
    color: #764ba2;
}

.note-card-preview pre {
    display: none; /* Hide code blocks in preview */
}

.note-card-preview ul,
.note-card-preview ol {
    margin: 0 0 0.5em 0;
    padding-left: 1.5em;
}

.note-card-preview li {
    margin: 0.1em 0;
}

.note-card-preview a {
    color: #667eea;
    text-decoration: none;
}

.note-card-preview blockquote {
    margin: 0;
    padding-left: 0.75em;
    border-left: 3px solid #667eea;
    font-style: italic;
    color: #666;
}

.note-card-preview img {
    display: none; /* Hide images in preview */
}

.preview-ellipsis {
    color: #95a5a6;
    font-weight: normal;
}

.note-card-meta {
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid #e8e8e8;
    font-size: 0.85em;
    color: #999;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.note-card-meta::before {
    content: '🕒';
    font-size: 1em;
    opacity: 0.7;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4em 2em;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 0.5em;
    opacity: 0.8;
}

.empty-state p {
    font-size: 1.2em;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Loading State */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3em;
    color: white;
    font-size: 1.2em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Note View/Edit Page */
.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2em;
    flex-wrap: wrap;
    gap: 1em;
}

.note-actions {
    display: flex;
    gap: 0.5em;
}

.note-view {
    background: white;
    border-radius: 12px;
    padding: 2.5em;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.1);
}

.note-title {
    margin: 0 0 1em 0;
    color: #667eea;
    font-size: 2.5em;
    font-weight: 300;
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.5em;
}

.note-content {
    line-height: 1.7;
    color: #333;
}

/* Edit Mode */
.note-edit {
    background: white;
    border-radius: 12px;
    padding: 2.5em;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1.5em;
}

.form-group label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #667eea;
}

.form-control {
    width: 100%;
    padding: 0.75em;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

textarea.form-control {
    font-family: 'Courier New', Courier, monospace;
    resize: vertical;
    min-height: 300px;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.edit-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5em;
    gap: 1em;
    flex-wrap: wrap;
}

.edit-actions > div {
    display: flex;
    gap: 0.5em;
}

/* Preview Panel */
.preview-panel {
    margin-top: 2em;
    padding: 2em;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e8e8e8;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.preview-panel h3 {
    margin: 0 0 1em 0;
    color: #667eea;
    font-size: 1.2em;
    font-weight: 600;
}

/* Markdown Body Styles */
.markdown-body {
    font-size: 1em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 {
    font-size: 2em;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.3em;
    color: #667eea;
}

.markdown-body h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.3em;
    color: #764ba2;
}

.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.875em; }
.markdown-body h6 { font-size: 0.85em; color: #6a737d; }

.markdown-body p {
    margin-top: 0;
    margin-bottom: 1em;
}

.markdown-body ul,
.markdown-body ol {
    margin-top: 0;
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-body li {
    margin-bottom: 0.25em;
}

.markdown-body code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 0.9em;
    background-color: rgba(102, 126, 234, 0.1);
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    color: #764ba2;
}

.markdown-body pre {
    padding: 1em;
    overflow: auto;
    font-size: 0.9em;
    line-height: 1.45;
    background-color: #f6f8fa;
    border-radius: 3px;
}

.markdown-body pre code {
    padding: 0;
    background-color: transparent;
}

.markdown-body blockquote {
    margin: 0;
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
}

.markdown-body table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-bottom: 1em;
    width: 100%;
}

.markdown-body table th,
.markdown-body table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

.markdown-body table th {
    font-weight: 600;
    background-color: #f6f8fa;
}

.markdown-body table tr {
    background-color: #fff;
    border-top: 1px solid #c6cbd1;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

.markdown-body a {
    color: #667eea;
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
    color: #764ba2;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
}

.markdown-body hr {
    height: 0.25em;
    padding: 0;
    margin: 1.5em 0;
    background-color: #e1e4e8;
    border: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1em;
    }

    .notes-list {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .note-header {
        flex-direction: column;
        align-items: stretch;
    }

    .note-actions {
        justify-content: space-between;
    }

    .edit-actions {
        flex-direction: column;
    }

    .edit-actions > div {
        width: 100%;
        justify-content: space-between;
    }

    .note-view,
    .note-edit {
        padding: 1em;
    }

    .note-title {
        font-size: 1.5em;
    }
}

/* Markdown Help Button */
.btn-help {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.4em 0.8em;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-help:hover {
    background: #764ba2;
}

/* Markdown Help Modal */
.markdown-help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1em;
}

.markdown-help-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.markdown-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5em;
    border-bottom: 2px solid #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.markdown-help-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5em;
    font-weight: 300;
}

.close-help-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
    transition: color 0.2s;
}

.close-help-btn:hover {
    color: white;
}

.markdown-help-body {
    padding: 1.5em;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 1.5em;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    margin: 0 0 0.5em 0;
    color: #667eea;
    font-size: 1.1em;
    font-weight: 600;
}

.help-section code {
    display: block;
    background: #f6f8fa;
    padding: 0.75em;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.6;
    color: #24292e;
    white-space: pre-wrap;
}
