/**
 * User Context and Friend Management Styling
 */

/* User Context Selector */
.user-context-selector {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-context-selector select {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    min-width: 200px;
}

.context-indicator {
    font-weight: bold;
    color: #6c757d;
    font-size: 14px;
}

.context-indicator.active {
    color: #007cba;
}

.context-label {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

/* Friend Buttons */
.friend-btn {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.friend-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.friend-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.friend-btn-add {
    background: #e8f5e8;
    color: #28a745;
    border-color: #28a745;
}

.friend-btn-add:hover {
    background: #d4edda;
    border-color: #1e7e34;
    color: #1e7e34;
}

.friend-btn-remove {
    background: #f8d7da;
    color: #dc3545;
    border-color: #dc3545;
}

.friend-btn-remove:hover {
    background: #f5c6cb;
    border-color: #bd2130;
    color: #bd2130;
}

/* Copy Link Button */
.copy-link-btn {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.copy-link-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

/* Post Highlighting */
.post-highlighted {
    background: rgba(0, 123, 255, 0.1) !important;
    border-left: 4px solid #007cba !important;
    transition: all 0.3s ease;
    animation: highlight-pulse 2s ease-in-out;
}

@keyframes highlight-pulse {
    0% { background: rgba(0, 123, 255, 0.2); }
    50% { background: rgba(0, 123, 255, 0.1); }
    100% { background: rgba(0, 123, 255, 0.1); }
}

/* Post Anchors */
.ostagram-post {
    scroll-margin-top: 20px;
}

/* Mention Links */
.mention-link {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.mention-link:hover {
    background: rgba(0, 123, 255, 0.1);
    text-decoration: none;
    cursor: pointer;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.notification-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Post Actions Container */
.post-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.post-actions .friend-btn,
.post-actions .copy-link-btn {
    margin-left: 0;
}

/* User Context Info */
.user-context-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #6c757d;
}

.user-context-info .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* Friend List in Context */
.friend-list {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

.friend-list h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #495057;
}

.friend-list .friend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
}

.friend-list .friend-item .avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

/* USER CONTEXT BAR - Simplified horizontal layout matching post width */
.user-context-bar {
    background: rgba(238, 232, 213, 0.95);
    border: 2px solid #cb4b16;
    border-radius: 8px;
    margin: 20px auto 15px auto;
    padding: 15px;
    backdrop-filter: blur(5px);
    font-family: 'Courier New', Courier, monospace;
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.user-context-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(203, 75, 22, 0.2);
}

.user-context-bar select {
    width: 100%;
    background: #073642;
    color: #eee8d5;
    border: 1px solid #586e75;
    border-radius: 4px;
    padding: 10px 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-context-bar select:hover {
    border-color: #cb4b16;
    background: #002b36;
}

.user-context-bar select:focus {
    outline: none;
    border-color: #268bd2;
    box-shadow: 0 0 0 2px rgba(38, 139, 210, 0.2);
}

.user-context-bar select option {
    background: #073642;
    color: #eee8d5;
    padding: 10px;
}

/* Mobile responsiveness for context bar */
@media (max-width: 768px) {
    .user-context-bar {
        margin: 10px 15px;
        padding: 12px;
        max-width: none;
    }
    
    .user-context-bar select {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Context Switch Animation */
.context-switching {
    position: relative;
    overflow: hidden;
}

.context-switching::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.1), transparent);
    animation: context-sweep 1s ease-in-out;
}

@keyframes context-sweep {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Following Count Tooltip */
.following-count {
    position: relative;
    cursor: pointer;
}

.following-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: #ecf0f1;
    border: 1px solid #34495e;
    border-radius: 8px;
    padding: 12px;
    min-width: 200px;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.4;
}

.following-count:hover .following-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.following-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #2c3e50;
}

.friends-header {
    font-weight: bold;
    color: #3498db;
    margin-bottom: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.no-friends {
    color: #95a5a6;
    font-style: italic;
    text-align: center;
    padding: 8px;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #34495e;
}

.friend-item:last-child {
    border-bottom: none;
}

.friend-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ecf0f1;
    text-decoration: none;
    width: 100%;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.friend-link:hover {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    text-decoration: none;
}

.friend-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #34495e;
}

.friend-name {
    font-weight: 500;
    font-size: 13px;
}

/* Admin frequency options */
.admin-frequency-options {
    margin-left: 15px;
    display: inline-block;
}

.chronological-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chronological-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    text-decoration: none;
    color: white;
}

.chronological-btn.active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.chronological-btn.active:hover {
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
}

/* Post actions styling */
.post-actions {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    padding: 8px 0;
    border-top: 1px solid #eee;
}

.edit-post-btn,
.copy-link-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #495057;
}

.edit-post-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.copy-link-btn:hover {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1976d2;
}

.edit-post-btn {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.edit-post-btn:hover {
    background: #ffeaa7;
    border-color: #ffd93d;
}