.add-friend-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.add-friend-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.af-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.af-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.af-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: var(--text-secondary);
}

.af-close:hover { background: var(--bg-hover); }

.af-body { padding: 24px; }

.af-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 24px;
}

.af-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.af-tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.af-section { display: none; }
.af-section.active { display: block; }

.af-my-id {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    text-align: center;
}

.af-my-id-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.af-my-id-value {
    font-size: 20px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--primary);
    letter-spacing: 1px;
    word-break: break-all;
}

.af-my-id-copy {
    margin-top: 12px;
    padding: 8px 20px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.af-my-id-copy:hover {
    background: var(--primary);
    color: white;
}

.af-input-group {
    margin-bottom: 16px;
}

.af-input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.af-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    outline: none;
    transition: all 0.2s;
    font-family: 'Courier New', monospace;
}

.af-input:focus {
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(108,92,231,0.1);
}

.af-input::placeholder { color: var(--text-muted); font-family: inherit; }

.af-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    outline: none;
    transition: all 0.2s;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.af-textarea:focus {
    border-color: var(--primary);
    background: var(--bg-primary);
}

.af-btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.af-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 16px rgba(108,92,231,0.3);
}

.af-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108,92,231,0.4);
}

.af-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.af-btn-success {
    background: linear-gradient(135deg, #00B894, #55EFC4);
    color: white;
}

.af-btn-danger {
    background: linear-gradient(135deg, #E17055, #FAB1A0);
    color: white;
}

.af-search-result {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-top: 16px;
    display: none;
}

.af-search-result.show { display: block; }

.af-user-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.af-user-avatar {
    width: 56px; height: 56px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 22px;
}

.af-user-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.af-user-info { flex: 1; min-width: 0; }

.af-user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.af-user-id {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: 'Courier New', monospace;
}

.af-user-actions { flex-shrink: 0; }

.af-btn-sm {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.af-btn-add {
    background: var(--primary);
    color: white;
}

.af-btn-add:hover { background: var(--primary-dark); }

.af-btn-added {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: default;
}

.af-link-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-top: 16px;
    display: none;
}

.af-link-box.show { display: block; }

.af-link-url {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
    word-break: break-all;
    font-family: 'Courier New', monospace;
    margin-bottom: 16px;
}

.af-link-actions {
    display: flex;
    gap: 8px;
}

.af-link-actions .af-btn-sm {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
}

.af-link-copy {
    background: var(--primary);
    color: white;
}

.af-link-qr {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.af-qr-container {
    text-align: center;
    margin-top: 16px;
    display: none;
}

.af-qr-container.show { display: block; }

.af-qr-container canvas {
    border-radius: var(--radius-md);
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.af-qr-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
}

.af-link-expire {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
    text-align: center;
}

.af-request-list {
    margin-top: 16px;
}

.af-request-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.af-request-avatar {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.af-request-avatar img { width: 100%; height: 100%; object-fit: cover; }

.af-request-info { flex: 1; min-width: 0; }

.af-request-name { font-weight: 600; font-size: 15px; }

.af-request-msg { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.af-request-time { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.af-request-actions { display: flex; gap: 6px; flex-shrink: 0; }

.af-accept-btn {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: var(--primary);
    color: white;
    transition: all 0.2s;
}

.af-accept-btn:hover { background: var(--primary-dark); }

.af-reject-btn {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.af-reject-btn:hover { background: var(--bg-hover); }

.af-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.af-empty-icon { font-size: 40px; margin-bottom: 12px; }

.af-empty-text { font-size: 14px; }

.af-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.af-link-history {
    margin-top: 20px;
}

.af-link-history-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.af-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.af-link-status {
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.af-link-status.valid {
    background: rgba(0,184,148,0.1);
    color: var(--success);
}

.af-link-status.used {
    background: rgba(108,92,231,0.1);
    color: var(--primary);
}

.af-link-status.expired {
    background: rgba(178,190,195,0.2);
    color: var(--text-muted);
}

[data-theme="dark"] .add-friend-modal {
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
