/**
 * Transcend Tools - Comments System Styles
 * Shared styles for highlight-to-comment functionality
 */

/* ==================== TOGGLE BUTTON ==================== */
.comments-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--transcend-blue, #2c5aa0);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.4);
    z-index: 1000;
    transition: all 0.2s ease;
}

.comments-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(44, 90, 160, 0.5);
}

.comments-toggle.active {
    background: var(--danger-red, #dc2626);
}

.comments-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger-red, #dc2626);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* ==================== SIDEBAR ==================== */
.comments-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    border-left: 1px solid var(--border-color, #e5e7eb);
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.comments-sidebar.open {
    right: 0;
}

.comments-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.comments-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary, #111827);
}

.comments-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    padding: 4px;
}

.comments-close:hover {
    color: var(--text-primary, #111827);
}

/* ==================== LIST ==================== */
.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.comments-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary, #6b7280);
}

.comments-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ==================== CARD ==================== */
.comments-card {
    background: var(--bg-secondary, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comments-card:hover {
    border-color: var(--transcend-blue, #2c5aa0);
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.15);
}

.comments-card.highlight {
    border-color: var(--transcend-blue, #2c5aa0);
    background: var(--transcend-light, #e8f0f8);
}

.comments-quote {
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
    font-style: italic;
    padding: 10px 12px;
    background: white;
    border-left: 3px solid var(--transcend-blue, #2c5aa0);
    border-radius: 4px;
    margin-bottom: 12px;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comments-text {
    font-size: 14px;
    color: var(--text-primary, #111827);
    margin-bottom: 12px;
    line-height: 1.5;
}

.comments-links {
    margin-bottom: 12px;
}

.comments-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--transcend-blue, #2c5aa0);
    text-decoration: none;
    background: var(--transcend-light, #e8f0f8);
    padding: 4px 10px;
    border-radius: 4px;
    margin-right: 6px;
    margin-bottom: 6px;
}

.comments-link:hover {
    text-decoration: underline;
}

.comments-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.comments-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comments-author-photo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.comments-delete {
    background: none;
    border: none;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.comments-delete:hover {
    color: var(--danger-red, #dc2626);
}

/* ==================== FORM ==================== */
.comments-form {
    padding: 20px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
    flex-shrink: 0;
    display: none;
}

.comments-form.active {
    display: block;
}

.comments-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.comments-form h4 {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary, #111827);
}

.comments-form-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
}

.comments-form-quote {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    font-style: italic;
    padding: 8px 10px;
    background: white;
    border-left: 3px solid var(--transcend-blue, #2c5aa0);
    border-radius: 4px;
    margin-bottom: 12px;
    max-height: 50px;
    overflow: hidden;
}

.comments-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.comments-form textarea:focus {
    outline: none;
    border-color: var(--transcend-blue, #2c5aa0);
}

.comments-links-input {
    margin-bottom: 12px;
}

.comments-links-input label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 6px;
}

.link-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.link-row input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 4px;
    font-size: 13px;
}

.link-row input:focus {
    outline: none;
    border-color: var(--transcend-blue, #2c5aa0);
}

.add-link-btn {
    background: none;
    border: 1px dashed var(--border-color, #d1d5db);
    color: var(--text-secondary, #6b7280);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.add-link-btn:hover {
    border-color: var(--transcend-blue, #2c5aa0);
    color: var(--transcend-blue, #2c5aa0);
}

.comments-form-actions {
    display: flex;
    gap: 8px;
}

.comments-form-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-cancel {
    background: white;
    border: 1px solid var(--border-color, #e5e7eb);
    color: var(--text-secondary, #6b7280);
}

.btn-save {
    background: var(--transcend-blue, #2c5aa0);
    border: none;
    color: white;
}

.btn-save:hover {
    background: var(--transcend-blue-dark, #1e4278);
}

/* ==================== TOOLTIP ==================== */
.selection-tooltip {
    position: fixed;
    background: var(--text-primary, #111827);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    z-index: 1001;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.selection-tooltip:hover {
    background: var(--transcend-blue, #2c5aa0);
}

.selection-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--text-primary, #111827);
}

.selection-tooltip:hover::after {
    border-top-color: var(--transcend-blue, #2c5aa0);
}

/* ==================== MODE INDICATOR ==================== */
.comments-mode-indicator {
    position: fixed;
    top: 80px;
    right: 24px;
    background: var(--transcend-blue, #2c5aa0);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: none;
    z-index: 998;
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.3);
}

.comments-mode-indicator.active {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==================== ONBOARDING BANNER ==================== */
.onboarding-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2c5aa0 0%, #1e4278 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 16px;
    width: calc(100% - 48px);
    max-width: 600px;
    animation: slideUp 0.4s ease-out forwards;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.onboarding-banner.hidden {
    display: none;
}

.onboarding-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.onboarding-content {
    flex: 1;
}

.onboarding-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.onboarding-text {
    font-size: 13px;
    opacity: 0.9;
}

.onboarding-dismiss {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

.onboarding-dismiss:hover {
    background: rgba(255,255,255,0.3);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .comments-sidebar {
        width: 100%;
        right: -100%;
    }
}

/* ==================== SCROLL-TO-COMMENT HIGHLIGHT ==================== */
.comments-highlight {
    background-color: rgba(251, 191, 36, 0.4) !important; /* warning-amber with transparency */
    transition: background-color 0.3s ease-out;
    border-radius: 2px;
}

/* ==================== REVEALED SECTION (for filtered guides) ==================== */
.guide-section.revealed-for-comment {
    opacity: 0.85;
    border-left: 4px solid var(--warning-amber, #f59e0b);
    padding-left: 20px;
    margin-left: -24px;
    background: rgba(251, 191, 36, 0.05);
}

.guide-section.revealed-for-comment::before {
    content: "📌 Section revealed for comment";
    display: block;
    background: var(--warning-amber, #f59e0b);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    width: fit-content;
}

/* Make comment cards clickable */
.comments-card {
    cursor: pointer;
}

.comments-card:hover {
    border-color: var(--transcend-blue, #2c5aa0);
}
