/* Styles for the public (shared) note view */

/* Load Inter font */
@font-face {
    font-family: 'Inter';
    src: url('../webfonts/Inter/static/Inter_24pt-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Inter';
    src: url('../webfonts/Inter/static/Inter_24pt-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

body {
    /* background: #f7f7f7; */
    font-family: 'Inter', sans-serif;
}

.public-note {
    max-width: 900px;
    margin: 18px auto;
    padding: 24px;
    /* background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(16,24,40,0.04); */
}

.public-note h1 {
    margin-top: 0;
    font-size: 1.4rem;
    color: #0f172a;
}

.public-note .meta {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 12px;
}

.public-note .content {
    /* container for note HTML */
    line-height: 1.2;
    white-space: normal;
}

.public-note img {
    max-width: 100%;
    height: auto;
}

.public-note video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #000;
    margin: 10px 0;
}

.public-note audio,
.public-note .note-audio-embed {
    max-width: 280px;
    display: block;
    border-radius: 8px;
    background: #f1f3f4;
    margin: 8px 0;
}

@media screen and (max-width: 768px) {
    .public-note audio,
    .public-note .note-audio-embed {
        max-width: 240px;
    }
}

.public-note iframe[data-is-audio] {
    max-width: 280px;
    width: 100%;
    height: 54px;
    display: block;
    overflow: hidden;
    margin: 8px 0;
    border: none;
    border-radius: 8px;
    background: transparent;
}

.public-note iframe.note-audio-embed {
    max-width: 280px;
    width: 100%;
    height: 54px;
    display: block;
    overflow: hidden;
    margin: 8px 0;
    border: none;
    border-radius: 8px;
    background: transparent;
}

@media screen and (max-width: 768px) {
    .public-note iframe[data-is-audio] {
        max-width: 240px;
    }

    .public-note iframe.note-audio-embed {
        max-width: 240px;
    }
}

/* FORCE TABLE STYLES - VERY AGGRESSIVE */
* table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin: 12px 0 !important;
    border-spacing: 0 !important;
}

* table td,
* table th {
    border: 2px solid #333 !important;
    padding: 12px !important;
    min-width: 60px !important;
    text-align: left !important;
    background: white !important;
    color: black !important;
}

* table th {
    background-color: #e0e0e0 !important;
    font-weight: bold !important;
}

/* Table styles for public notes */
table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin: 12px 0 !important;
}

table td,
table th {
    border: 1px solid #ddd !important;
    padding: 8px !important;
    min-width: 50px !important;
    text-align: left !important;
}

table th {
    background-color: #f5f5f5 !important;
    font-weight: 600 !important;
}

/* Also target with more specific selectors */
.public-note table,
.public-note table.inserted-table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin: 12px 0 !important;
}

.public-note table td,
.public-note table th,
.public-note table.inserted-table td,
.public-note table.inserted-table th {
    border: 1px solid #ddd !important;
    padding: 8px !important;
    min-width: 50px !important;
    text-align: left !important;
}

.public-note table th,
.public-note table.inserted-table th {
    background-color: #f5f5f5 !important;
    font-weight: 600 !important;
}

/* Fallback styles for any table in public notes */
.public-note .content table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin: 12px 0 !important;
}

.public-note .content table td,
.public-note .content table th {
    border: 1px solid #ddd !important;
    padding: 8px !important;
    min-width: 50px !important;
    text-align: left !important;
}

.public-note .content table th {
    background-color: #f5f5f5 !important;
    font-weight: 600 !important;
}

/* Code block styles for public notes */
.public-note .content code {
    background-color: transparent;
    padding: 2px 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #333;
    border-radius: 3px;
}

.public-note .content pre {
    background-color: transparent !important;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5em 0;
    position: relative;
    border: 1px solid #e0e0e0;
    white-space: pre;
}

/* Extra padding for code blocks with language badge */
.public-note .content pre[data-language] {
    padding-top: 32px;
}

.public-note .content pre code {
    background-color: transparent !important;
    padding: 0;
    color: inherit;
    border-radius: 0;
    border: none;
    display: block;
    line-height: 1.4;
}

/* Remove Highlight.js background in public notes */
.public-note .content pre code.hljs,
.public-note .content pre .hljs {
    background: transparent !important;
}

/* Copy button for code blocks */
.public-note .content pre .code-block-copy-btn,
.code-block-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    opacity: 1;
    transition: background-color 0.2s;
    font-size: 12px;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.public-note .content pre .code-block-copy-btn:hover,
.code-block-copy-btn:hover {
    background-color: #fff;
    color: #333;
}

.public-note .content pre .code-block-copy-btn.copied,
.code-block-copy-btn.copied {
    background-color: #4caf50;
    color: white;
    border-color: #4caf50;
}

.public-note .content pre .code-block-copy-btn svg,
.code-block-copy-btn svg {
    width: 16px;
    height: 16px;
    display: block;
    stroke: currentColor;
    fill: none;
}

/* Blockquote styles */
.public-note .content blockquote {
    border-left: 4px solid #ddd;
    padding-left: 16px;
    margin: 1em 0;
    color: #666;
    font-style: italic;
}

/* List styles */
.public-note .content ul,
.public-note .content ol {
    margin: 1em 0;
    padding-left: 2em;
    line-height: 1.6;
}

.public-note .content li {
    margin: 0.5em 0;
}

/* Task list styles */
.public-note .content ul.task-list {
    list-style: none;
    padding-left: 0;
}

.public-note .content li.task-list-item {
    list-style: none;
    position: relative;
    padding-left: 0;
}

.public-note .content li.task-list-item input[type="checkbox"] {
    margin-right: 0.8em;
    cursor: pointer;
    vertical-align: middle;
    display: inline-block;
}

/* Nested task lists need indentation */
.public-note .content li.task-list-item>ul.task-list,
.public-note .content li.task-list-item>ul,
.public-note .content li.task-list-item>ol {
    padding-left: 1.5em;
    margin: 0.5em 0;
}

/* Style for checked task items */
.public-note .content li.task-list-item input[type="checkbox"]:checked+span {
    text-decoration: line-through;
    color: #888;
}

/* Tasklist note styles (JSON-based tasklists) */
.public-note .content .task-item input[type="checkbox"] {
    margin-right: 0.8em;
    cursor: pointer;
    vertical-align: middle;
}

.public-note .content .task-item.completed .task-text {
    text-decoration: line-through;
    color: #888;
}

/* Task actions (edit/delete buttons) */
.task-actions {
    display: flex;
    gap: 5px;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-item:hover .task-actions,
.task-item.completed .task-actions {
    opacity: 1;
}

.task-action-btn {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    transition: color 0.2s;
}

.task-action-btn:hover {
    color: #666;
}

.public-task-delete-btn {
    display: none;
}

.task-item.completed .public-task-delete-btn {
    display: flex;
    opacity: 1;
    /* Ensure opacity is 1 */
}

.public-task-delete-btn:hover {
    color: #dc3545;
}

/* Interactive task text */
.task-text {
    cursor: text;
}

/* Important task styling for public view */
.public-note .content .task-item.important {
    border-color: #ffcccc;
    background: #fff6f6;
}

.public-note .content .task-item.important .task-text {
    color: #c62828;
    font-weight: 600;
}

/* Horizontal rule */
.public-note .content hr {
    border: 0;
    border-top: 2px solid #e0e0e0;
    margin: 2em 0;
}

/* Text formatting */
.public-note .content strong {
    font-weight: bold;
}

.public-note .content em {
    font-style: italic;
}

.public-note .content del {
    text-decoration: line-through;
    color: #999;
}

/* Links */
.public-note .content a {
    color: #007bff;
    text-decoration: none;
}

.public-note .content a:hover {
    text-decoration: underline;
}

/* Remove underline for image links */
.public-note .content a[data-image-link],
.public-note .content a[data-image-link]:hover {
    text-decoration: none;
}

/* Headings in content */
.public-note .content h1 {
    font-size: 2em;
    font-weight: bold;
    margin: 0.67em 0;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.3em;
}

.public-note .content h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0.75em 0;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.3em;
}

.public-note .content h3 {
    font-size: 1.25em;
    font-weight: bold;
    margin: 0.83em 0;
}

.public-note .content h4 {
    font-size: 1em;
    font-weight: bold;
    margin: 1em 0;
}

.public-note .content h5 {
    font-size: 0.875em;
    font-weight: bold;
    margin: 1.33em 0;
}

.public-note .content h6 {
    font-size: 0.75em;
    font-weight: bold;
    margin: 1.67em 0;
    color: #666;
}

/* Paragraphs */
.public-note .content p {
    margin: 0;
    line-height: 1.2;
}

/* Blank lines to preserve spacing in markdown */
.public-note .content p.blank-line {
    margin: 0;
    min-height: 1.2em; /* Match the line-height */
    line-height: 1.2;
}

/* Theme toggle button */
.public-note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.public-note-header h1 {
    margin: 0;
}

.theme-toggle-btn {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    color: #333;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.theme-toggle-btn i {
    pointer-events: none;
}

/* Dark mode styles for theme toggle */
html[data-theme='dark'] .theme-toggle-btn {
    color: #e0e0e0;
    border-color: #404040;
}

html[data-theme='dark'] .theme-toggle-btn:hover {
    background: #333333;
    border-color: #666;
}

/* Dark mode styles for important tasks */
html[data-theme='dark'] .public-note .content .task-item.important {
    border-color: #5a2a2a;
    background: #2d1a1a;
}

html[data-theme='dark'] .public-note .content .task-item.important .task-text {
    color: #ff6b6b;
    font-weight: 600;
}

/* Dark mode styles for tables */
.alert-modal-header {
    display: none !important;
}

.alert-modal-body {
    padding-top: 30px !important;
}

html[data-theme='dark'] * table td,
html[data-theme='dark'] * table th {
    border-color: #404040 !important;
    background: #252526 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] * table th {
    background-color: #333333 !important;
}

html[data-theme='dark'] table td,
html[data-theme='dark'] table th {
    border-color: #404040 !important;
}

html[data-theme='dark'] table th {
    background-color: #333333 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] table td {
    background: #252526 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .public-note table td,
html[data-theme='dark'] .public-note table th,
html[data-theme='dark'] .public-note table.inserted-table td,
html[data-theme='dark'] .public-note table.inserted-table th {
    border-color: #404040 !important;
}

html[data-theme='dark'] .public-note table th,
html[data-theme='dark'] .public-note table.inserted-table th {
    background-color: #333333 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .public-note table td,
html[data-theme='dark'] .public-note table.inserted-table td {
    background: #252526 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .public-note .content table td,
html[data-theme='dark'] .public-note .content table th {
    border-color: #404040 !important;
}

html[data-theme='dark'] .public-note .content table th {
    background-color: #333333 !important;
    color: #e0e0e0 !important;
}

html[data-theme='dark'] .public-note .content table td {
    background: #252526 !important;
    color: #e0e0e0 !important;
}