/* Twitter-like Notes Feature - Styles */

/* Compose Box */
.note-composer {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-top: 2rem;
    margin-bottom: 3rem;
    box-shadow: none;
    position: relative;
    max-width: 600px;
}

.note-composer #note-editor-container {
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    border: 2px solid rgba(199, 227, 145, 0.5);
    border-radius: 12px;
    margin-bottom: 1rem;
    background: #fff;
    transition: all 0.2s ease;
    font-size: 16px;
    line-height: 1.5;
}

.note-composer #note-editor-container:focus-within {
    border-color: #aedd56;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(174, 221, 86, 0.15);
}

/* TipTap Editor Styles */
.note-composer .ProseMirror {
    outline: none;
    min-height: 70px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.note-composer .ProseMirror p.is-editor-empty:first-child::before {
    color: #9ca3af;
    content: attr(data-placeholder);
    float: left;
    height: 0;
    pointer-events: none;
    font-size: 16px;
}

/* Tags Input Container */
.tags-separator {
    display: none;
}

/* Tags Input Field */
.tags-input {
    width: 100%;
    border: 2px solid rgba(199, 227, 145, 0.5);
    border-radius: 12px;
    outline: none;
    padding: 1rem;
    font-size: 14px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #99c746;
    background: #fff;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.tags-input::placeholder {
    color: #9ca3af;
    font-weight: normal;
}

.tags-input:focus {
    border-color: #aedd56;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(174, 221, 86, 0.15);
}

/* Code/Preformatted blocks in editor */
.note-composer .ProseMirror pre,
.note-composer .ProseMirror code {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
    background: #f6f8fa;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 14px;
    white-space: pre-wrap;
}

.note-composer .ProseMirror pre {
    padding: 0.75rem;
    display: block;
    overflow-x: auto;
}

/* Hashtag Autocomplete */
.hashtag-autocomplete {
    position: absolute;
    /* top is set dynamically via JavaScript */
    left: 0;
    right: 0;
    background: white;
    border: 1px solid rgba(199, 227, 145, 0.5);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #99c746;
    font-weight: 500;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: rgba(199, 227, 145, 0.2);
}

.autocomplete-item.selected {
    background: rgba(199, 227, 145, 0.4);
}

/* Compose Actions */
.compose-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
}

.compose-actions #note-submit-btn {
    background: #99c746;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0.625rem 2rem;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(153, 199, 70, 0.3);
}

.compose-actions #note-submit-btn:hover:not(:disabled) {
    background: #8ab83d;
    box-shadow: 0 4px 8px rgba(153, 199, 70, 0.4);
    transform: translateY(-1px);
}

.compose-actions #note-submit-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(153, 199, 70, 0.3);
}

.compose-actions #note-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.compose-actions #char-count {
    font-size: 14px;
    color: #657786;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Note Article */
.note {
    background: #fff;
    border: 1px solid rgba(199, 227, 145, 0.3);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    max-width: 600px;
}

.note-content {
    font-size: 16px;
    line-height: 1.6;
    color: #101509;
    margin-bottom: 0.75rem;
    word-wrap: break-word;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.note-content p {
    margin: 0.5rem 0;
}

.note-content strong {
    font-weight: 700;
}

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

.note-content a {
    color: #99c746;
    text-decoration: none;
}

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

/* Code/ASCII art blocks in displayed notes */
.note-content pre,
.note-content code {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
    background: #f6f8fa;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 14px;
    white-space: pre-wrap;
    display: inline-block;
}

.note-content pre {
    padding: 0.75rem;
    display: block;
    overflow-x: auto;
    border: 1px solid #e1e4e8;
}

/* Note Meta */
.note-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 14px;
    color: rgba(16, 21, 9, 0.6);
    border-top: 1px solid rgba(199, 227, 145, 0.3);
    padding-top: 0.75rem;
}

.note-meta .permalink {
    color: rgba(16, 21, 9, 0.6);
    text-decoration: none;
    font-weight: 500;
}

.note-meta .permalink:hover {
    color: #99c746;
}

.note-meta time {
    color: rgba(16, 21, 9, 0.6);
}

.note-meta .admin-edit-link {
    color: rgba(16, 21, 9, 0.6);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.note-meta .admin-edit-link:hover {
    color: #99c746;
}

.note-meta .tag-link {
    color: #99c746;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.note-meta .tag-link:hover {
    text-decoration: underline;
}

/* Like Button */
.note-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    transition: background-color 0.2s;
    margin-left: auto;
}

.note-like-btn:hover {
    background: #fef2f2;
}

.note-like-btn .heart-icon {
    font-size: 18px;
    color: #657786;
    transition: color 0.2s;
}

.note-like-btn.liked .heart-icon {
    color: #99c746;
}

.note-like-btn .like-count {
    font-size: 13px;
    color: rgba(16, 21, 9, 0.6);
    font-weight: 500;
}

.note-like-btn.liked .like-count {
    color: #99c746;
    font-weight: 600;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .note-composer #note-editor-container {
        border-color: rgba(153, 199, 70, 0.3);
        background: #1a1a1a;
    }

    .note-composer #note-editor-container:focus-within {
        border-color: #aedd56;
        background: #0d1117;
        box-shadow: 0 0 0 3px rgba(174, 221, 86, 0.2);
    }

    /* Fix text visibility in dark mode */
    .note-composer .ProseMirror {
        color: #e6edf3;
    }

    .note-composer .ProseMirror p.is-editor-empty:first-child::before {
        color: #6b7280;
    }

    /* Code blocks in dark mode - editor */
    .note-composer .ProseMirror pre,
    .note-composer .ProseMirror code {
        background: #161b22;
        color: #e6edf3;
    }

    .note {
        background: #1a2817;
        border-color: rgba(153, 199, 70, 0.2);
    }

    .note-content {
        color: #e7f0db;
    }

    /* Code blocks in dark mode - display */
    .note-content pre,
    .note-content code {
        background: #0f1207;
        color: #e7f0db;
        border-color: rgba(153, 199, 70, 0.2);
    }

    .note-meta {
        border-top-color: rgba(153, 199, 70, 0.2);
    }

    .note-meta .permalink,
    .note-meta time,
    .note-meta .admin-edit-link {
        color: rgba(231, 240, 219, 0.6);
    }

    .note-meta .permalink:hover,
    .note-meta .admin-edit-link:hover {
        color: #aedd56;
    }

    .note-like-btn:hover {
        background: rgba(153, 199, 70, 0.1);
    }

    .note-like-btn .heart-icon {
        color: rgba(231, 240, 219, 0.6);
    }

    .note-like-btn.liked .heart-icon {
        color: #aedd56;
    }

    .note-like-btn .like-count {
        color: rgba(231, 240, 219, 0.6);
    }

    .note-like-btn.liked .like-count {
        color: #aedd56;
    }

    .compose-actions #note-submit-btn {
        box-shadow: 0 2px 4px rgba(153, 199, 70, 0.4);
    }

    .compose-actions #note-submit-btn:hover:not(:disabled) {
        box-shadow: 0 4px 8px rgba(153, 199, 70, 0.5);
    }

    .hashtag-autocomplete {
        background: #192734;
        border-color: rgba(153, 199, 70, 0.3);
    }

    .autocomplete-item:hover,
    .autocomplete-item.selected {
        background: rgba(153, 199, 70, 0.15);
    }

    .autocomplete-item.selected {
        background: rgba(153, 199, 70, 0.25);
    }

    .tags-input {
        border-color: rgba(153, 199, 70, 0.3);
        background: #1a1a1a;
        color: #99c746;
    }

    .tags-input::placeholder {
        color: #6b7280;
    }

    .tags-input:focus {
        border-color: #aedd56;
        background: #0d1117;
        box-shadow: 0 0 0 3px rgba(174, 221, 86, 0.2);
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    /* Compose Box - Better mobile spacing */
    .note-composer {
        margin-top: 1rem;
        margin-bottom: 2rem;
    }

    .note-composer #note-editor-container {
        padding: 0.875rem;
        font-size: 16px; /* Prevents iOS zoom on focus */
        border-radius: 16px;
        min-height: 90px;
    }

    .note-composer .ProseMirror {
        min-height: 60px;
    }

    /* Tags Input - Better mobile touch */
    .tags-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.625rem 0;
    }

    /* Compose Actions - Stack on small screens */
    .compose-actions {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .compose-actions #note-submit-btn {
        padding: 0.75rem 2.5rem;
        font-size: 16px;
        border-radius: 28px;
        min-height: 44px; /* iOS recommended touch target */
    }

    .compose-actions #char-count {
        font-size: 15px;
    }

    /* Note Cards - Better mobile spacing */
    .note {
        border-radius: 16px;
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .note-content {
        font-size: 16px;
        line-height: 1.6;
        margin-bottom: 1rem;
    }

    .note-content p {
        margin: 0.625rem 0;
    }

    /* Code blocks mobile adjustments */
    .note-content pre,
    .note-composer .ProseMirror pre {
        font-size: 13px;
        padding: 0.625rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .note-content code,
    .note-composer .ProseMirror code {
        font-size: 13px;
    }

    /* Note Meta - Better mobile layout */
    .note-meta {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding-top: 0.875rem;
        font-size: 14px;
    }

    .note-meta .permalink,
    .note-meta .admin-edit-link,
    .note-meta .tag-link {
        font-size: 14px;
        min-height: 44px; /* iOS touch target */
        display: inline-flex;
        align-items: center;
    }

    /* Like Button - Larger touch target */
    .note-like-btn {
        padding: 0.5rem 0.75rem;
        border-radius: 16px;
        min-height: 44px;
        min-width: 60px;
    }

    .note-like-btn .heart-icon {
        font-size: 20px;
    }

    .note-like-btn .like-count {
        font-size: 14px;
    }

    /* Hashtag Autocomplete - Mobile optimized */
    .hashtag-autocomplete {
        max-height: 180px;
        border-radius: 12px;
    }

    .autocomplete-item {
        padding: 1rem 1rem;
        font-size: 16px;
        min-height: 48px;
    }
}

/* Extra small screens - even more compact */
@media (max-width: 480px) {
    .note-composer #note-editor-container {
        padding: 0.75rem;
        min-height: 80px;
    }

    .note {
        padding: 0.875rem;
        border-radius: 12px;
    }

    .note-content {
        font-size: 15px;
    }

    .compose-actions #note-submit-btn {
        width: 100%;
        padding: 0.875rem;
    }

    .note-meta {
        font-size: 13px;
    }
}
