/* Rich Text Editor Styles for HamRig Community */

/* Editor Container */
.rich-editor-container {
    position: relative;
    border: 2px solid rgba(52, 144, 220, 0.15);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.rich-editor-container:hover {
    border-color: rgba(52, 144, 220, 0.3);
}

.rich-editor-container:focus-within {
    border-color: var(--hamrig-primary);
    box-shadow: 0 0 0 3px rgba(52, 144, 220, 0.1);
}

/* Quill Editor Styling */
.rich-editor .ql-toolbar {
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.02);
    padding: 12px 16px;
}

.rich-editor .ql-toolbar .ql-formats {
    margin-right: 15px;
}

.rich-editor .ql-toolbar button {
    color: var(--hamrig-light-2) !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 6px !important;
    margin: 0 2px !important;
    transition: all 0.2s ease !important;
}

.rich-editor .ql-toolbar button:hover {
    background: rgba(52, 144, 220, 0.15) !important;
    color: var(--hamrig-primary) !important;
}

.rich-editor .ql-toolbar button.ql-active {
    background: var(--hamrig-primary) !important;
    color: white !important;
}

.rich-editor .ql-toolbar .ql-stroke {
    stroke: var(--hamrig-light-2) !important;
}

.rich-editor .ql-toolbar .ql-fill {
    fill: var(--hamrig-light-2) !important;
}

.rich-editor .ql-toolbar button:hover .ql-stroke {
    stroke: var(--hamrig-primary) !important;
}

.rich-editor .ql-toolbar button:hover .ql-fill {
    fill: var(--hamrig-primary) !important;
}

.rich-editor .ql-toolbar button.ql-active .ql-stroke {
    stroke: white !important;
}

.rich-editor .ql-toolbar button.ql-active .ql-fill {
    fill: white !important;
}

/* Editor Content Area */
.rich-editor .ql-container {
    border: none !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: var(--hamrig-light) !important;
}

.rich-editor .ql-editor {
    padding: 16px !important;
    min-height: 120px !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    color: var(--hamrig-light) !important;
    background: transparent !important;
}

.rich-editor .ql-editor.ql-blank::before {
    color: var(--hamrig-light-3) !important;
    font-style: normal !important;
    opacity: 0.7 !important;
    content: attr(data-placeholder) !important;
}

/* Editor Styling for Rich Content */
.rich-editor .ql-editor p {
    margin: 0 0 8px 0 !important;
}

.rich-editor .ql-editor strong {
    color: var(--hamrig-primary) !important;
    font-weight: 600 !important;
}

.rich-editor .ql-editor em {
    color: var(--hamrig-secondary) !important;
}

.rich-editor .ql-editor a {
    color: var(--hamrig-primary) !important;
    text-decoration: none !important;
}

.rich-editor .ql-editor a:hover {
    text-decoration: underline !important;
}

.rich-editor .ql-editor blockquote {
    border-left: 3px solid var(--hamrig-primary) !important;
    padding-left: 16px !important;
    margin: 12px 0 !important;
    background: rgba(52, 144, 220, 0.05) !important;
    border-radius: 0 8px 8px 0 !important;
}

.rich-editor .ql-editor ul, .rich-editor .ql-editor ol {
    padding-left: 20px !important;
}

.rich-editor .ql-editor li {
    margin: 4px 0 !important;
}

/* Images in Editor */
.rich-editor .ql-editor img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px !important;
    margin: 8px 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

/* Editor Info Section */
.editor-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    gap: 16px;
}

.editor-features {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(52, 144, 220, 0.1);
    border: 1px solid rgba(52, 144, 220, 0.2);
    border-radius: 6px;
    font-size: 11px;
    color: var(--hamrig-primary);
    font-weight: 500;
}

.feature-tag i {
    font-size: 10px;
}

/* Editor Label Hint */
.editor-hint {
    margin-left: 8px;
    font-size: 11px;
    color: var(--hamrig-primary);
    font-weight: 400;
    opacity: 0.8;
}

/* Character Counter */
.char-counter {
    font-size: 11px;
    color: var(--hamrig-light-3);
    font-weight: 500;
}

.char-counter.warning {
    color: var(--hamrig-warning);
}

.char-counter.danger {
    color: var(--hamrig-error);
}

/* Dropdown Menus (for emoji picker, etc.) */
.ql-tooltip {
    background: var(--hamrig-dark-2) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    color: var(--hamrig-light) !important;
}

.ql-tooltip input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 6px !important;
    color: var(--hamrig-light) !important;
    padding: 8px 12px !important;
}

.ql-tooltip .ql-action, .ql-tooltip .ql-remove {
    color: var(--hamrig-primary) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    margin: 0 2px !important;
}

.ql-tooltip .ql-action:hover, .ql-tooltip .ql-remove:hover {
    background: rgba(52, 144, 220, 0.1) !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .rich-editor .ql-toolbar {
        padding: 8px 12px;
    }
    
    .rich-editor .ql-toolbar .ql-formats {
        margin-right: 8px;
    }
    
    .rich-editor .ql-editor {
        padding: 12px !important;
        min-height: 100px !important;
    }
    
    .editor-info {
        padding: 8px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .editor-features {
        gap: 4px;
    }
    
    .feature-tag {
        font-size: 10px;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    .rich-editor .ql-toolbar {
        font-size: 12px;
    }
    
    .editor-features {
        display: none; /* Hide feature tags on very small screens */
    }
}

/* Image Upload Styles */
.ql-editor .ql-image-uploading {
    opacity: 0.6;
    position: relative;
}

.ql-editor .ql-image-uploading::after {
    content: "📤 Uploading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* Emoji Styling */
.rich-editor .ql-editor .emoji {
    font-size: 1.2em;
    vertical-align: middle;
}

/* Link Preview Styling */
.rich-editor .ql-editor .link-preview {
    border: 1px solid rgba(52, 144, 220, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    background: rgba(52, 144, 220, 0.05);
}

.link-preview-title {
    color: var(--hamrig-primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.link-preview-description {
    color: var(--hamrig-light-2);
    font-size: 13px;
    line-height: 1.4;
}

/* Rich Content Display in Posts */
.post-message {
    line-height: 1.6;
    color: var(--hamrig-light);
}

.post-message p {
    margin: 0 0 12px 0;
}

.post-message p:last-child {
    margin-bottom: 0;
}

.post-message strong {
    color: var(--hamrig-primary);
    font-weight: 600;
}

.post-message em {
    color: var(--hamrig-secondary);
    font-style: italic;
}

.post-message u {
    text-decoration: underline;
    text-decoration-color: var(--hamrig-primary);
}

.post-message h1, .post-message h2, .post-message h3 {
    color: var(--hamrig-primary);
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.post-message h1 { font-size: 1.5rem; }
.post-message h2 { font-size: 1.3rem; }
.post-message h3 { font-size: 1.1rem; }

.post-message ul, .post-message ol {
    margin: 8px 0;
    padding-left: 20px;
}

.post-message li {
    margin: 4px 0;
}

.post-message blockquote {
    border-left: 4px solid var(--hamrig-primary);
    padding-left: 16px;
    margin: 16px 0;
    background: rgba(52, 144, 220, 0.05);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--hamrig-light-2);
}

.post-message code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--hamrig-secondary);
}

.post-message pre {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
}

.post-message pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: var(--hamrig-light);
}

.post-message .post-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.post-message .post-image:hover {
    transform: scale(1.02);
}

.post-message .post-link {
    color: var(--hamrig-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.post-message .post-link:hover {
    border-bottom-color: var(--hamrig-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .post-message {
        font-size: 14px;
    }
    
    .post-message h1 { font-size: 1.3rem; }
    .post-message h2 { font-size: 1.2rem; }
    .post-message h3 { font-size: 1.1rem; }
    
    .post-message pre {
        font-size: 0.8em;
        padding: 8px;
    }
    
    .post-message blockquote {
        padding-left: 12px;
        margin: 12px 0;
    }
}